hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cfd23fb632d49990e523d69c81900e687c7c431a | RMeli/gninascripts | affinity_search/evaluate_cross.py | [
"BSD-3-Clause"
] | Python | analyze_cross_results | <not_specific> | def analyze_cross_results(results,outname,uniquify):
'''Compute error metrics from resulst.
results is formated: (correct, prediction, receptor, ligand, label, posescore,rmsd)
This is assumed to be a cross docked input, where receptor filename is
POCKET/PDB_CH_rec_0.gninatypes
and the ligand is
... | Compute error metrics from resulst.
results is formated: (correct, prediction, receptor, ligand, label, posescore,rmsd)
This is assumed to be a cross docked input, where receptor filename is
POCKET/PDB_CH_rec_0.gninatypes
and the ligand is
POCKET/PDB1_CH_rec_PDB2_lig_...gninatypes
RM... | Compute error metrics from resulst.
results is formated: (correct, prediction, receptor, ligand, label, posescore,rmsd)
This is assumed to be a cross docked input, where receptor filename is
POCKET/PDB_CH_rec_0.gninatypes
and the ligand is
POCKET/PDB1_CH_rec_PDB2_lig_...gninatypes
RMSE, Pearson, Spearman, AUC and top-... | [
"Compute",
"error",
"metrics",
"from",
"resulst",
".",
"results",
"is",
"formated",
":",
"(",
"correct",
"prediction",
"receptor",
"ligand",
"label",
"posescore",
"rmsd",
")",
"This",
"is",
"assumed",
"to",
"be",
"a",
"cross",
"docked",
"input",
"where",
"re... | def analyze_cross_results(results,outname,uniquify):
labels = np.array([r[4] for r in results])
posescores = np.array([r[5] for r in results])
predictions = np.array([r[1] for r in results])
aucpose = sklearn.metrics.roc_auc_score(labels, posescores)
aucaff = sklearn.metrics.roc_auc_score(labels, pr... | [
"def",
"analyze_cross_results",
"(",
"results",
",",
"outname",
",",
"uniquify",
")",
":",
"labels",
"=",
"np",
".",
"array",
"(",
"[",
"r",
"[",
"4",
"]",
"for",
"r",
"in",
"results",
"]",
")",
"posescores",
"=",
"np",
".",
"array",
"(",
"[",
"r",... | Compute error metrics from resulst. | [
"Compute",
"error",
"metrics",
"from",
"resulst",
"."
] | [
"'''Compute error metrics from resulst. \n results is formated: (correct, prediction, receptor, ligand, label, posescore,rmsd)\n This is assumed to be a cross docked input, where receptor filename is\n POCKET/PDB_CH_rec_0.gninatypes\n and the ligand is\n POCKET/PDB1_CH_rec_PDB2_lig_...gninatypes\n ... | [
{
"param": "results",
"type": null
},
{
"param": "outname",
"type": null
},
{
"param": "uniquify",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "results",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outname",
"type": null,
"docstring": null,
"docstring_toke... |
6e24735c64e09035028a55b3f18fcdf36d9e8e99 | RMeli/gninascripts | calctop.py | [
"BSD-3-Clause"
] | Python | evaluate_fold | <not_specific> | def evaluate_fold(testfile, caffemodel, modelname,root_folder):
'''Evaluate the passed model and the specified test set.
Assumes the .model file is named a certain way.
Returns tuple:
(correct, prediction, receptor, ligand, label (optional), posescore (optional))
label and posescore are only provide... | Evaluate the passed model and the specified test set.
Assumes the .model file is named a certain way.
Returns tuple:
(correct, prediction, receptor, ligand, label (optional), posescore (optional))
label and posescore are only provided is trained on pose data
| Evaluate the passed model and the specified test set.
Assumes the .model file is named a certain way.
Returns tuple:
(correct, prediction, receptor, ligand, label (optional), posescore (optional))
label and posescore are only provided is trained on pose data | [
"Evaluate",
"the",
"passed",
"model",
"and",
"the",
"specified",
"test",
"set",
".",
"Assumes",
"the",
".",
"model",
"file",
"is",
"named",
"a",
"certain",
"way",
".",
"Returns",
"tuple",
":",
"(",
"correct",
"prediction",
"receptor",
"ligand",
"label",
"(... | def evaluate_fold(testfile, caffemodel, modelname,root_folder):
caffe.set_mode_gpu()
test_model = ('predict.%d.prototxt' % os.getpid())
print(("test_model:" + test_model))
train.write_model_file(test_model, modelname, testfile, testfile, root_folder)
test_net = caffe.Net(test_model, caffemodel, caff... | [
"def",
"evaluate_fold",
"(",
"testfile",
",",
"caffemodel",
",",
"modelname",
",",
"root_folder",
")",
":",
"caffe",
".",
"set_mode_gpu",
"(",
")",
"test_model",
"=",
"(",
"'predict.%d.prototxt'",
"%",
"os",
".",
"getpid",
"(",
")",
")",
"print",
"(",
"(",... | Evaluate the passed model and the specified test set. | [
"Evaluate",
"the",
"passed",
"model",
"and",
"the",
"specified",
"test",
"set",
"."
] | [
"'''Evaluate the passed model and the specified test set.\n Assumes the .model file is named a certain way.\n Returns tuple:\n (correct, prediction, receptor, ligand, label (optional), posescore (optional))\n label and posescore are only provided is trained on pose data\n '''",
"#index in batch",
... | [
{
"param": "testfile",
"type": null
},
{
"param": "caffemodel",
"type": null
},
{
"param": "modelname",
"type": null
},
{
"param": "root_folder",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "testfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "caffemodel",
"type": null,
"docstring": null,
"docstring_... |
3205ee785812f970ec8e59b1e8c45664d26792ca | RMeli/gninascripts | grid_visualization.py | [
"BSD-3-Clause"
] | Python | make_points | null | def make_points(atom,val_range,root,mapping):
'''
Function that makes the points needed for the types file.
'''
if not os.path.isdir(root+atom):
os.mkdir(root+atom)
counter=0
for x in val_range:
for y in val_range:
for z in val_range:
pos=[x,y,z]
pos=struct.pack('f'*len(pos),*pos)
identity=[m... |
Function that makes the points needed for the types file.
| Function that makes the points needed for the types file. | [
"Function",
"that",
"makes",
"the",
"points",
"needed",
"for",
"the",
"types",
"file",
"."
] | def make_points(atom,val_range,root,mapping):
if not os.path.isdir(root+atom):
os.mkdir(root+atom)
counter=0
for x in val_range:
for y in val_range:
for z in val_range:
pos=[x,y,z]
pos=struct.pack('f'*len(pos),*pos)
identity=[mapping]
identity=struct.pack('i'*len(identity),*identity)
with ... | [
"def",
"make_points",
"(",
"atom",
",",
"val_range",
",",
"root",
",",
"mapping",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"root",
"+",
"atom",
")",
":",
"os",
".",
"mkdir",
"(",
"root",
"+",
"atom",
")",
"counter",
"=",
"0",
... | Function that makes the points needed for the types file. | [
"Function",
"that",
"makes",
"the",
"points",
"needed",
"for",
"the",
"types",
"file",
"."
] | [
"'''\n\tFunction that makes the points needed for the types file.\n\t'''"
] | [
{
"param": "atom",
"type": null
},
{
"param": "val_range",
"type": null
},
{
"param": "root",
"type": null
},
{
"param": "mapping",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atom",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "val_range",
"type": null,
"docstring": null,
"docstring_token... |
3205ee785812f970ec8e59b1e8c45664d26792ca | RMeli/gninascripts | grid_visualization.py | [
"BSD-3-Clause"
] | Python | make_types | <not_specific> | def make_types(atom, root, receptor):
'''
Function that writes a types file for all the points created from make_points in root
Returns the name of the file
'''
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
return [ atoi(c) for c in re.split(r'(\d+)', text) ]
gninaty... |
Function that writes a types file for all the points created from make_points in root
Returns the name of the file
| Function that writes a types file for all the points created from make_points in root
Returns the name of the file | [
"Function",
"that",
"writes",
"a",
"types",
"file",
"for",
"all",
"the",
"points",
"created",
"from",
"make_points",
"in",
"root",
"Returns",
"the",
"name",
"of",
"the",
"file"
] | def make_types(atom, root, receptor):
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
return [ atoi(c) for c in re.split(r'(\d+)', text) ]
gninatypes=glob.glob(root+atom+'/'+atom+'*.gninatypes')
gninatypes.sort(key=natural_keys)
filename=root+receptor.split('_0.gnina')[0]+'... | [
"def",
"make_types",
"(",
"atom",
",",
"root",
",",
"receptor",
")",
":",
"def",
"atoi",
"(",
"text",
")",
":",
"return",
"int",
"(",
"text",
")",
"if",
"text",
".",
"isdigit",
"(",
")",
"else",
"text",
"def",
"natural_keys",
"(",
"text",
")",
":",... | Function that writes a types file for all the points created from make_points in root
Returns the name of the file | [
"Function",
"that",
"writes",
"a",
"types",
"file",
"for",
"all",
"the",
"points",
"created",
"from",
"make_points",
"in",
"root",
"Returns",
"the",
"name",
"of",
"the",
"file"
] | [
"'''\n\tFunction that writes a types file for all the points created from make_points in root\n\n\tReturns the name of the file\n\t'''"
] | [
{
"param": "atom",
"type": null
},
{
"param": "root",
"type": null
},
{
"param": "receptor",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atom",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "root",
"type": null,
"docstring": null,
"docstring_tokens": [... |
3205ee785812f970ec8e59b1e8c45664d26792ca | RMeli/gninascripts | grid_visualization.py | [
"BSD-3-Clause"
] | Python | make_dx | <not_specific> | def make_dx(filename, num_on_axis, min_point, val_delta):
'''
Function that takes the filename IE output of jobs, and makes a dx file from the results for visualization
'''
with open(filename) as fin:
data=fin.readlines()
if len(data) == 0:
return None,None
l=filename.split('_predictscores'... |
Function that takes the filename IE output of jobs, and makes a dx file from the results for visualization
| Function that takes the filename IE output of jobs, and makes a dx file from the results for visualization | [
"Function",
"that",
"takes",
"the",
"filename",
"IE",
"output",
"of",
"jobs",
"and",
"makes",
"a",
"dx",
"file",
"from",
"the",
"results",
"for",
"visualization"
] | def make_dx(filename, num_on_axis, min_point, val_delta):
with open(filename) as fin:
data=fin.readlines()
if len(data) == 0:
return None,None
l=filename.split('_predictscores')[0]
pattern=re.compile("^[0-9]")
data=[float(x.split()[0]) for x in data if pattern.match(x)]
scores=np.array(data)
... | [
"def",
"make_dx",
"(",
"filename",
",",
"num_on_axis",
",",
"min_point",
",",
"val_delta",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"fin",
":",
"data",
"=",
"fin",
".",
"readlines",
"(",
")",
"if",
"len",
"(",
"data",
")",
"==",
"0",
"... | Function that takes the filename IE output of jobs, and makes a dx file from the results for visualization | [
"Function",
"that",
"takes",
"the",
"filename",
"IE",
"output",
"of",
"jobs",
"and",
"makes",
"a",
"dx",
"file",
"from",
"the",
"results",
"for",
"visualization"
] | [
"'''\n\tFunction that takes the filename IE output of jobs, and makes a dx file from the results for visualization\n\t'''"
] | [
{
"param": "filename",
"type": null
},
{
"param": "num_on_axis",
"type": null
},
{
"param": "min_point",
"type": null
},
{
"param": "val_delta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_on_axis",
"type": null,
"docstring": null,
"docstring... |
3205ee785812f970ec8e59b1e8c45664d26792ca | RMeli/gninascripts | grid_visualization.py | [
"BSD-3-Clause"
] | Python | gninatyper | <not_specific> | def gninatyper(pdbfilename):
'''
Function that takes in a pdbfile and converts it to a gninatypes file via gninatyper
Returns 1 on failed gninatyper
Returns newfilename on success.
'''
newname=pdbfilename.split('.')[0]
try:
subprocess.call('gninatyper '+pdbfilename+' '+newname,shell=True)
except:
return ... |
Function that takes in a pdbfile and converts it to a gninatypes file via gninatyper
Returns 1 on failed gninatyper
Returns newfilename on success.
| Function that takes in a pdbfile and converts it to a gninatypes file via gninatyper
Returns 1 on failed gninatyper
Returns newfilename on success. | [
"Function",
"that",
"takes",
"in",
"a",
"pdbfile",
"and",
"converts",
"it",
"to",
"a",
"gninatypes",
"file",
"via",
"gninatyper",
"Returns",
"1",
"on",
"failed",
"gninatyper",
"Returns",
"newfilename",
"on",
"success",
"."
] | def gninatyper(pdbfilename):
newname=pdbfilename.split('.')[0]
try:
subprocess.call('gninatyper '+pdbfilename+' '+newname,shell=True)
except:
return 1
return newname+'_0.gninatypes' | [
"def",
"gninatyper",
"(",
"pdbfilename",
")",
":",
"newname",
"=",
"pdbfilename",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
"try",
":",
"subprocess",
".",
"call",
"(",
"'gninatyper '",
"+",
"pdbfilename",
"+",
"' '",
"+",
"newname",
",",
"shell",
"... | Function that takes in a pdbfile and converts it to a gninatypes file via gninatyper
Returns 1 on failed gninatyper
Returns newfilename on success. | [
"Function",
"that",
"takes",
"in",
"a",
"pdbfile",
"and",
"converts",
"it",
"to",
"a",
"gninatypes",
"file",
"via",
"gninatyper",
"Returns",
"1",
"on",
"failed",
"gninatyper",
"Returns",
"newfilename",
"on",
"success",
"."
] | [
"'''\n\tFunction that takes in a pdbfile and converts it to a gninatypes file via gninatyper\n\n\tReturns 1 on failed gninatyper\n\tReturns newfilename on success.\n\t'''"
] | [
{
"param": "pdbfilename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pdbfilename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bd9363632ecf3adbc432fd7ded35dba0099d4c47 | RMeli/gninascripts | combine_fold_results.py | [
"BSD-3-Clause"
] | Python | makejoint | null | def makejoint(x,y,color,title):
'''Plot x vs y where x are experimental values and y are predictions'''
color_rgb = matplotlib.colors.colorConverter.to_rgb(color)
colors = [seaborn.utils.set_hls_values(color_rgb, l=l)
for l in np.linspace(1, 0, 12)]
cmap = blend_palette(colors, as_cmap=Tru... | Plot x vs y where x are experimental values and y are predictions | Plot x vs y where x are experimental values and y are predictions | [
"Plot",
"x",
"vs",
"y",
"where",
"x",
"are",
"experimental",
"values",
"and",
"y",
"are",
"predictions"
] | def makejoint(x,y,color,title):
color_rgb = matplotlib.colors.colorConverter.to_rgb(color)
colors = [seaborn.utils.set_hls_values(color_rgb, l=l)
for l in np.linspace(1, 0, 12)]
cmap = blend_palette(colors, as_cmap=True)
g = sns.JointGrid(x=x,y=y)
g = g.plot_joint(plt.scatter, marker='... | [
"def",
"makejoint",
"(",
"x",
",",
"y",
",",
"color",
",",
"title",
")",
":",
"color_rgb",
"=",
"matplotlib",
".",
"colors",
".",
"colorConverter",
".",
"to_rgb",
"(",
"color",
")",
"colors",
"=",
"[",
"seaborn",
".",
"utils",
".",
"set_hls_values",
"(... | Plot x vs y where x are experimental values and y are predictions | [
"Plot",
"x",
"vs",
"y",
"where",
"x",
"are",
"experimental",
"values",
"and",
"y",
"are",
"predictions"
] | [
"'''Plot x vs y where x are experimental values and y are predictions'''",
"#g = g.plot_joint(plt.hexbin, cmap=cmap)",
"#ax.plot(x,y,'.',color=color,alpha=.25,markersize=2)"
] | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "color",
"type": null
},
{
"param": "title",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
bd9363632ecf3adbc432fd7ded35dba0099d4c47 | RMeli/gninascripts | combine_fold_results.py | [
"BSD-3-Clause"
] | Python | read_results_file | <not_specific> | def read_results_file(file):
'''Read columns of float data from a file, ignoring # comments'''
rows = []
with open(file, 'r') as f:
for line in f:
line = line.split('#', 1)[0].strip()
if line:
rows.append(list(map(float, line.split(' '))))
return list(zip(... | Read columns of float data from a file, ignoring # comments | Read columns of float data from a file, ignoring # comments | [
"Read",
"columns",
"of",
"float",
"data",
"from",
"a",
"file",
"ignoring",
"#",
"comments"
] | def read_results_file(file):
rows = []
with open(file, 'r') as f:
for line in f:
line = line.split('#', 1)[0].strip()
if line:
rows.append(list(map(float, line.split(' '))))
return list(zip(*rows)) | [
"def",
"read_results_file",
"(",
"file",
")",
":",
"rows",
"=",
"[",
"]",
"with",
"open",
"(",
"file",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line",
".",
"split",
"(",
"'#'",
",",
"1",
")",
"[",
"0",
"]"... | Read columns of float data from a file, ignoring # comments | [
"Read",
"columns",
"of",
"float",
"data",
"from",
"a",
"file",
"ignoring",
"#",
"comments"
] | [
"'''Read columns of float data from a file, ignoring # comments'''"
] | [
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bd9363632ecf3adbc432fd7ded35dba0099d4c47 | RMeli/gninascripts | combine_fold_results.py | [
"BSD-3-Clause"
] | Python | write_results_file | null | def write_results_file(file, *columns, **kwargs):
'''Write columns of data to a file, with optional footer comment'''
footer = kwargs.get('footer', '')
with open(file, 'w') as f:
for row in zip(*columns):
f.write(' '.join(map(str, row)) + '\n')
if footer:
f.write('# %... | Write columns of data to a file, with optional footer comment | Write columns of data to a file, with optional footer comment | [
"Write",
"columns",
"of",
"data",
"to",
"a",
"file",
"with",
"optional",
"footer",
"comment"
] | def write_results_file(file, *columns, **kwargs):
footer = kwargs.get('footer', '')
with open(file, 'w') as f:
for row in zip(*columns):
f.write(' '.join(map(str, row)) + '\n')
if footer:
f.write('# %s' % footer) | [
"def",
"write_results_file",
"(",
"file",
",",
"*",
"columns",
",",
"**",
"kwargs",
")",
":",
"footer",
"=",
"kwargs",
".",
"get",
"(",
"'footer'",
",",
"''",
")",
"with",
"open",
"(",
"file",
",",
"'w'",
")",
"as",
"f",
":",
"for",
"row",
"in",
... | Write columns of data to a file, with optional footer comment | [
"Write",
"columns",
"of",
"data",
"to",
"a",
"file",
"with",
"optional",
"footer",
"comment"
] | [
"'''Write columns of data to a file, with optional footer comment'''"
] | [
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bd9363632ecf3adbc432fd7ded35dba0099d4c47 | RMeli/gninascripts | combine_fold_results.py | [
"BSD-3-Clause"
] | Python | make_uniform_array | <not_specific> | def make_uniform_array(lists):
'''Take a list of possibly variable sized lists and return a numpy 2D array
where the smaller lists are padded to the size of the longest list using
their last value'''
maxlen = max([len(l) for l in lists])
return np.array([list(l) + [l[-1]]*(maxlen-len(l)) fo... | Take a list of possibly variable sized lists and return a numpy 2D array
where the smaller lists are padded to the size of the longest list using
their last value | Take a list of possibly variable sized lists and return a numpy 2D array
where the smaller lists are padded to the size of the longest list using
their last value | [
"Take",
"a",
"list",
"of",
"possibly",
"variable",
"sized",
"lists",
"and",
"return",
"a",
"numpy",
"2D",
"array",
"where",
"the",
"smaller",
"lists",
"are",
"padded",
"to",
"the",
"size",
"of",
"the",
"longest",
"list",
"using",
"their",
"last",
"value"
] | def make_uniform_array(lists):
maxlen = max([len(l) for l in lists])
return np.array([list(l) + [l[-1]]*(maxlen-len(l)) for l in lists]) | [
"def",
"make_uniform_array",
"(",
"lists",
")",
":",
"maxlen",
"=",
"max",
"(",
"[",
"len",
"(",
"l",
")",
"for",
"l",
"in",
"lists",
"]",
")",
"return",
"np",
".",
"array",
"(",
"[",
"list",
"(",
"l",
")",
"+",
"[",
"l",
"[",
"-",
"1",
"]",
... | Take a list of possibly variable sized lists and return a numpy 2D array
where the smaller lists are padded to the size of the longest list using
their last value | [
"Take",
"a",
"list",
"of",
"possibly",
"variable",
"sized",
"lists",
"and",
"return",
"a",
"numpy",
"2D",
"array",
"where",
"the",
"smaller",
"lists",
"are",
"padded",
"to",
"the",
"size",
"of",
"the",
"longest",
"list",
"using",
"their",
"last",
"value"
] | [
"'''Take a list of possibly variable sized lists and return a numpy 2D array\n where the smaller lists are padded to the size of the longest list using \n their last value'''"
] | [
{
"param": "lists",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lists",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bd9363632ecf3adbc432fd7ded35dba0099d4c47 | RMeli/gninascripts | combine_fold_results.py | [
"BSD-3-Clause"
] | Python | combine_fold_results | null | def combine_fold_results(test_metrics, train_metrics, test_labels, test_preds, train_labels, train_preds,
outprefix, test_interval, file_type, second_data_source=False,
filter_actives_test=None, filter_actives_train=None):
'''Make results files and graphs combined f... | Make results files and graphs combined from results for
separate crossvalidation folds. test_metrics and train_metrics
are lists of lists of AUCs or RMSDs for each fold, for each
test_interval. test_labels and test_preds are labels and final
test predictions for each test fold, in a single list. train_l... | Make results files and graphs combined from results for
separate crossvalidation folds. test_metrics and train_metrics
are lists of lists of AUCs or RMSDs for each fold, for each
test_interval. test_labels and test_preds are labels and final
test predictions for each test fold, in a single list. train_labels
and train_... | [
"Make",
"results",
"files",
"and",
"graphs",
"combined",
"from",
"results",
"for",
"separate",
"crossvalidation",
"folds",
".",
"test_metrics",
"and",
"train_metrics",
"are",
"lists",
"of",
"lists",
"of",
"AUCs",
"or",
"RMSDs",
"for",
"each",
"fold",
"for",
"e... | def combine_fold_results(test_metrics, train_metrics, test_labels, test_preds, train_labels, train_preds,
outprefix, test_interval, file_type, second_data_source=False,
filter_actives_test=None, filter_actives_train=None):
if file_type=='affinity':
metric = 'r... | [
"def",
"combine_fold_results",
"(",
"test_metrics",
",",
"train_metrics",
",",
"test_labels",
",",
"test_preds",
",",
"train_labels",
",",
"train_preds",
",",
"outprefix",
",",
"test_interval",
",",
"file_type",
",",
"second_data_source",
"=",
"False",
",",
"filter_... | Make results files and graphs combined from results for
separate crossvalidation folds. | [
"Make",
"results",
"files",
"and",
"graphs",
"combined",
"from",
"results",
"for",
"separate",
"crossvalidation",
"folds",
"."
] | [
"'''Make results files and graphs combined from results for\n separate crossvalidation folds. test_metrics and train_metrics\n are lists of lists of AUCs or RMSDs for each fold, for each\n test_interval. test_labels and test_preds are labels and final\n test predictions for each test fold, in a single l... | [
{
"param": "test_metrics",
"type": null
},
{
"param": "train_metrics",
"type": null
},
{
"param": "test_labels",
"type": null
},
{
"param": "test_preds",
"type": null
},
{
"param": "train_labels",
"type": null
},
{
"param": "train_preds",
"type": n... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "test_metrics",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "train_metrics",
"type": null,
"docstring": null,
"doc... |
83c33fc7143000e9691f203d0175ff5731fcf0ed | RMeli/gninascripts | predict.py | [
"BSD-3-Clause"
] | Python | predict | <not_specific> | def predict(args):
'''Return yscore and/or y_predaff with rest of input line for each example'''
if args.gpu >= 0:
caffe.set_device(args.gpu)
caffe.set_mode_gpu()
test_model = 'predict.%d.prototxt' % os.getpid()
write_model_file(test_model, args.model, args.input, args.data_root)
test_ne... | Return yscore and/or y_predaff with rest of input line for each example | Return yscore and/or y_predaff with rest of input line for each example | [
"Return",
"yscore",
"and",
"/",
"or",
"y_predaff",
"with",
"rest",
"of",
"input",
"line",
"for",
"each",
"example"
] | def predict(args):
if args.gpu >= 0:
caffe.set_device(args.gpu)
caffe.set_mode_gpu()
test_model = 'predict.%d.prototxt' % os.getpid()
write_model_file(test_model, args.model, args.input, args.data_root)
test_net = caffe.Net(test_model, args.weights, caffe.TEST)
with open(args.input, 'r')... | [
"def",
"predict",
"(",
"args",
")",
":",
"if",
"args",
".",
"gpu",
">=",
"0",
":",
"caffe",
".",
"set_device",
"(",
"args",
".",
"gpu",
")",
"caffe",
".",
"set_mode_gpu",
"(",
")",
"test_model",
"=",
"'predict.%d.prototxt'",
"%",
"os",
".",
"getpid",
... | Return yscore and/or y_predaff with rest of input line for each example | [
"Return",
"yscore",
"and",
"/",
"or",
"y_predaff",
"with",
"rest",
"of",
"input",
"line",
"for",
"each",
"example"
] | [
"'''Return yscore and/or y_predaff with rest of input line for each example'''",
"# auc, y_true, y_score, loss, rmsd, y_affinity, y_predaff = result",
"#check alignment",
"#this is all awkward and should be rewritten with a smarter approach than munging strings",
"#have to recalculate RMSD and AUC "
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83c33fc7143000e9691f203d0175ff5731fcf0ed | RMeli/gninascripts | predict.py | [
"BSD-3-Clause"
] | Python | predict_lines | <not_specific> | def predict_lines(args):
'''Return previous format of a list of strings corresponding to the output lines of a prediction file'''
predictions = predict(args)
lines = []
for line in predictions[0]:
l = ''
for val in line[:-1]:
l += '%f '%val
l += '| %s' % line[-1]
... | Return previous format of a list of strings corresponding to the output lines of a prediction file | Return previous format of a list of strings corresponding to the output lines of a prediction file | [
"Return",
"previous",
"format",
"of",
"a",
"list",
"of",
"strings",
"corresponding",
"to",
"the",
"output",
"lines",
"of",
"a",
"prediction",
"file"
] | def predict_lines(args):
predictions = predict(args)
lines = []
for line in predictions[0]:
l = ''
for val in line[:-1]:
l += '%f '%val
l += '| %s' % line[-1]
lines.append(l)
if predictions[1] != None:
lines.append('# AUC %f\n'%predictions[1])
if p... | [
"def",
"predict_lines",
"(",
"args",
")",
":",
"predictions",
"=",
"predict",
"(",
"args",
")",
"lines",
"=",
"[",
"]",
"for",
"line",
"in",
"predictions",
"[",
"0",
"]",
":",
"l",
"=",
"''",
"for",
"val",
"in",
"line",
"[",
":",
"-",
"1",
"]",
... | Return previous format of a list of strings corresponding to the output lines of a prediction file | [
"Return",
"previous",
"format",
"of",
"a",
"list",
"of",
"strings",
"corresponding",
"to",
"the",
"output",
"lines",
"of",
"a",
"prediction",
"file"
] | [
"'''Return previous format of a list of strings corresponding to the output lines of a prediction file'''"
] | [
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a62fc4f2e7c33e636dc8178106b1048560a8311d | RMeli/gninascripts | create_caches2.py | [
"BSD-3-Clause"
] | Python | read_data | null | def read_data(data_root):
'''read a types file and put it in mols_to_write'''
while True:
sys.stdout.flush()
mol = mols_to_read.get()
if mol == None:
break
fname = mol
if len(data_root):
fname = data_root+'/'+mol
try:
with open(... | read a types file and put it in mols_to_write | read a types file and put it in mols_to_write | [
"read",
"a",
"types",
"file",
"and",
"put",
"it",
"in",
"mols_to_write"
] | def read_data(data_root):
while True:
sys.stdout.flush()
mol = mols_to_read.get()
if mol == None:
break
fname = mol
if len(data_root):
fname = data_root+'/'+mol
try:
with open(fname,'rb') as gninatype:
data = gninatype.r... | [
"def",
"read_data",
"(",
"data_root",
")",
":",
"while",
"True",
":",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"mol",
"=",
"mols_to_read",
".",
"get",
"(",
")",
"if",
"mol",
"==",
"None",
":",
"break",
"fname",
"=",
"mol",
"if",
"len",
"(",
... | read a types file and put it in mols_to_write | [
"read",
"a",
"types",
"file",
"and",
"put",
"it",
"in",
"mols_to_write"
] | [
"'''read a types file and put it in mols_to_write'''"
] | [
{
"param": "data_root",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_root",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a62fc4f2e7c33e636dc8178106b1048560a8311d | RMeli/gninascripts | create_caches2.py | [
"BSD-3-Clause"
] | Python | create_cache2 | null | def create_cache2(molfiles, data_root, outfile):
'''Create an outfile molcache2 file from the list molfiles stored at data_root.'''
out = open(outfile,'wb')
#first byte is for versioning
out.write(struct.pack('i',-1))
out.write(struct.pack('L',0)) #placeholder for offset to keys
filler = multip... | Create an outfile molcache2 file from the list molfiles stored at data_root. | Create an outfile molcache2 file from the list molfiles stored at data_root. | [
"Create",
"an",
"outfile",
"molcache2",
"file",
"from",
"the",
"list",
"molfiles",
"stored",
"at",
"data_root",
"."
] | def create_cache2(molfiles, data_root, outfile):
out = open(outfile,'wb')
out.write(struct.pack('i',-1))
out.write(struct.pack('L',0))
filler = multiprocessing.Process(target=fill_queue,args=(molfiles,))
filler.start()
readers = multiprocessing.Pool(N)
for _ in range(N):
readers.apply... | [
"def",
"create_cache2",
"(",
"molfiles",
",",
"data_root",
",",
"outfile",
")",
":",
"out",
"=",
"open",
"(",
"outfile",
",",
"'wb'",
")",
"out",
".",
"write",
"(",
"struct",
".",
"pack",
"(",
"'i'",
",",
"-",
"1",
")",
")",
"out",
".",
"write",
... | Create an outfile molcache2 file from the list molfiles stored at data_root. | [
"Create",
"an",
"outfile",
"molcache2",
"file",
"from",
"the",
"list",
"molfiles",
"stored",
"at",
"data_root",
"."
] | [
"'''Create an outfile molcache2 file from the list molfiles stored at data_root.'''",
"#first byte is for versioning",
"#placeholder for offset to keys",
"#indxed by mol, location of data",
"#start writing molecular data",
"#where the names start",
"#now set start"
] | [
{
"param": "molfiles",
"type": null
},
{
"param": "data_root",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "molfiles",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data_root",
"type": null,
"docstring": null,
"docstring_t... |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | calcDistanceMatrix | <not_specific> | def calcDistanceMatrix(targets):
'''compute full pairwise target distance matrix in parallel'''
n = len(targets)
pairs = [(r, c) for r in range(n) for c in range(r+1, n)] #upper triangle
pool = Pool()
function = partial(cUTDM2, targets)
distanceTuples = pool.map(function, pairs)
distanceMatr... | compute full pairwise target distance matrix in parallel | compute full pairwise target distance matrix in parallel | [
"compute",
"full",
"pairwise",
"target",
"distance",
"matrix",
"in",
"parallel"
] | def calcDistanceMatrix(targets):
n = len(targets)
pairs = [(r, c) for r in range(n) for c in range(r+1, n)]
pool = Pool()
function = partial(cUTDM2, targets)
distanceTuples = pool.map(function, pairs)
distanceMatrix = np.zeros((n, n))
for (a, b, distance) in distanceTuples:
distance... | [
"def",
"calcDistanceMatrix",
"(",
"targets",
")",
":",
"n",
"=",
"len",
"(",
"targets",
")",
"pairs",
"=",
"[",
"(",
"r",
",",
"c",
")",
"for",
"r",
"in",
"range",
"(",
"n",
")",
"for",
"c",
"in",
"range",
"(",
"r",
"+",
"1",
",",
"n",
")",
... | compute full pairwise target distance matrix in parallel | [
"compute",
"full",
"pairwise",
"target",
"distance",
"matrix",
"in",
"parallel"
] | [
"'''compute full pairwise target distance matrix in parallel'''",
"#upper triangle"
] | [
{
"param": "targets",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "targets",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | assignGroup | <not_specific> | def assignGroup(dists, ligandsim, t, t2, ligandt, explore, names):
'''group targets that are less than t away from each other and what's in explore'''
group = set(explore)
while explore:
frontier = set()
for i in explore:
for j in range(dists.shape[1]):
if j not i... | group targets that are less than t away from each other and what's in explore | group targets that are less than t away from each other and what's in explore | [
"group",
"targets",
"that",
"are",
"less",
"than",
"t",
"away",
"from",
"each",
"other",
"and",
"what",
"'",
"s",
"in",
"explore"
] | def assignGroup(dists, ligandsim, t, t2, ligandt, explore, names):
group = set(explore)
while explore:
frontier = set()
for i in explore:
for j in range(dists.shape[1]):
if j not in group:
if dists[i][j] < t or (ligandsim[i][j] > ligandt and dists[... | [
"def",
"assignGroup",
"(",
"dists",
",",
"ligandsim",
",",
"t",
",",
"t2",
",",
"ligandt",
",",
"explore",
",",
"names",
")",
":",
"group",
"=",
"set",
"(",
"explore",
")",
"while",
"explore",
":",
"frontier",
"=",
"set",
"(",
")",
"for",
"i",
"in"... | group targets that are less than t away from each other and what's in explore | [
"group",
"targets",
"that",
"are",
"less",
"than",
"t",
"away",
"from",
"each",
"other",
"and",
"what",
"'",
"s",
"in",
"explore"
] | [
"'''group targets that are less than t away from each other and what's in explore'''",
"#add to the group if protein is close by threshold t (these are distances - default 0.5)",
"#also add if the ligands are more similar (not distance) than ligandt and ",
"#the protein is closer than t2 (default 0.8 - meanin... | [
{
"param": "dists",
"type": null
},
{
"param": "ligandsim",
"type": null
},
{
"param": "t",
"type": null
},
{
"param": "t2",
"type": null
},
{
"param": "ligandt",
"type": null
},
{
"param": "explore",
"type": null
},
{
"param": "names",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dists",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ligandsim",
"type": null,
"docstring": null,
"docstring_toke... |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | calcClusterGroups | <not_specific> | def calcClusterGroups(dists, ligandsim, target_names, t, t2, ligandt):
'''dists is a distance matrix (full) for target_names'''
assigned = set()
groups = []
for i in range(dists.shape[0]):
if i not in assigned:
group = assignGroup(dists, ligandsim, t, t2, ligandt, set([i]),target_nam... | dists is a distance matrix (full) for target_names | dists is a distance matrix (full) for target_names | [
"dists",
"is",
"a",
"distance",
"matrix",
"(",
"full",
")",
"for",
"target_names"
] | def calcClusterGroups(dists, ligandsim, target_names, t, t2, ligandt):
assigned = set()
groups = []
for i in range(dists.shape[0]):
if i not in assigned:
group = assignGroup(dists, ligandsim, t, t2, ligandt, set([i]),target_names)
groups.append(group)
assigned.upd... | [
"def",
"calcClusterGroups",
"(",
"dists",
",",
"ligandsim",
",",
"target_names",
",",
"t",
",",
"t2",
",",
"ligandt",
")",
":",
"assigned",
"=",
"set",
"(",
")",
"groups",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"dists",
".",
"shape",
"[",
"... | dists is a distance matrix (full) for target_names | [
"dists",
"is",
"a",
"distance",
"matrix",
"(",
"full",
")",
"for",
"target_names"
] | [
"'''dists is a distance matrix (full) for target_names'''"
] | [
{
"param": "dists",
"type": null
},
{
"param": "ligandsim",
"type": null
},
{
"param": "target_names",
"type": null
},
{
"param": "t",
"type": null
},
{
"param": "t2",
"type": null
},
{
"param": "ligandt",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dists",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ligandsim",
"type": null,
"docstring": null,
"docstring_toke... |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | createFolds | <not_specific> | def createFolds(cluster_groups, numfolds, target_lines, randomize):
'''split target clusters into numfolds folds with balanced num poses per fold
If randomize, will balance less well.
'''
folds = [[] for _ in range(numfolds)]
fold_numposes = [0]*numfolds
group_numposes = [0]*len(cluster_group... | split target clusters into numfolds folds with balanced num poses per fold
If randomize, will balance less well.
| split target clusters into numfolds folds with balanced num poses per fold
If randomize, will balance less well. | [
"split",
"target",
"clusters",
"into",
"numfolds",
"folds",
"with",
"balanced",
"num",
"poses",
"per",
"fold",
"If",
"randomize",
"will",
"balance",
"less",
"well",
"."
] | def createFolds(cluster_groups, numfolds, target_lines, randomize):
folds = [[] for _ in range(numfolds)]
fold_numposes = [0]*numfolds
group_numposes = [0]*len(cluster_groups)
foldmap = {}
for i, group in enumerate(cluster_groups):
for target in group:
group_numposes[... | [
"def",
"createFolds",
"(",
"cluster_groups",
",",
"numfolds",
",",
"target_lines",
",",
"randomize",
")",
":",
"folds",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"range",
"(",
"numfolds",
")",
"]",
"fold_numposes",
"=",
"[",
"0",
"]",
"*",
"numfolds",
"gro... | split target clusters into numfolds folds with balanced num poses per fold
If randomize, will balance less well. | [
"split",
"target",
"clusters",
"into",
"numfolds",
"folds",
"with",
"balanced",
"num",
"poses",
"per",
"fold",
"If",
"randomize",
"will",
"balance",
"less",
"well",
"."
] | [
"'''split target clusters into numfolds folds with balanced num poses per fold\n If randomize, will balance less well.\n '''",
"#count num poses per group",
"#iteratively assign group with most poses to fold with fewest poses",
"#weighted selection, prefer spots with more free space"
] | [
{
"param": "cluster_groups",
"type": null
},
{
"param": "numfolds",
"type": null
},
{
"param": "target_lines",
"type": null
},
{
"param": "randomize",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cluster_groups",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "numfolds",
"type": null,
"docstring": null,
"docstr... |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | index | <not_specific> | def index(a, x):
'Locate the leftmost value exactly equal to x'
i = bisect.bisect_left(a, x)
if i != len(a) and a[i] == x:
return i
else: return -1 | Locate the leftmost value exactly equal to x | Locate the leftmost value exactly equal to x | [
"Locate",
"the",
"leftmost",
"value",
"exactly",
"equal",
"to",
"x"
] | def index(a, x):
i = bisect.bisect_left(a, x)
if i != len(a) and a[i] == x:
return i
else: return -1 | [
"def",
"index",
"(",
"a",
",",
"x",
")",
":",
"i",
"=",
"bisect",
".",
"bisect_left",
"(",
"a",
",",
"x",
")",
"if",
"i",
"!=",
"len",
"(",
"a",
")",
"and",
"a",
"[",
"i",
"]",
"==",
"x",
":",
"return",
"i",
"else",
":",
"return",
"-",
"1... | Locate the leftmost value exactly equal to x | [
"Locate",
"the",
"leftmost",
"value",
"exactly",
"equal",
"to",
"x"
] | [
"'Locate the leftmost value exactly equal to x'"
] | [
{
"param": "a",
"type": null
},
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | checkFolds | <not_specific> | def checkFolds(dists, target_names, threshold, foldmap):
'''check that targets in different folds pass dissimilarity threshold'''
ok = True
n_targets = dists.shape[0]
min_dist = np.inf
closest = None
for t in foldmap:
if t not in set(target_names):
print('warning: {} not foun... | check that targets in different folds pass dissimilarity threshold | check that targets in different folds pass dissimilarity threshold | [
"check",
"that",
"targets",
"in",
"different",
"folds",
"pass",
"dissimilarity",
"threshold"
] | def checkFolds(dists, target_names, threshold, foldmap):
ok = True
n_targets = dists.shape[0]
min_dist = np.inf
closest = None
for t in foldmap:
if t not in set(target_names):
print('warning: {} not found in distance matrix'.format(t))
for a in range(n_targets):
for b... | [
"def",
"checkFolds",
"(",
"dists",
",",
"target_names",
",",
"threshold",
",",
"foldmap",
")",
":",
"ok",
"=",
"True",
"n_targets",
"=",
"dists",
".",
"shape",
"[",
"0",
"]",
"min_dist",
"=",
"np",
".",
"inf",
"closest",
"=",
"None",
"for",
"t",
"in"... | check that targets in different folds pass dissimilarity threshold | [
"check",
"that",
"targets",
"in",
"different",
"folds",
"pass",
"dissimilarity",
"threshold"
] | [
"'''check that targets in different folds pass dissimilarity threshold'''"
] | [
{
"param": "dists",
"type": null
},
{
"param": "target_names",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "foldmap",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dists",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target_names",
"type": null,
"docstring": null,
"docstring_t... |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | linesFromInput | <not_specific> | def linesFromInput(infile):
'''return dictionary mapping target name to all lines of types file
Gets target name by looking for (\S+)/'''
ret = collections.defaultdict(list)
for line in open(infile):
m = re.search('\s(\S+)/',line)
if m:
targ = m.group(1)
ret[targ]... | return dictionary mapping target name to all lines of types file
Gets target name by looking for (\S+)/ | return dictionary mapping target name to all lines of types file
Gets target name by looking for (\S+) | [
"return",
"dictionary",
"mapping",
"target",
"name",
"to",
"all",
"lines",
"of",
"types",
"file",
"Gets",
"target",
"name",
"by",
"looking",
"for",
"(",
"\\",
"S",
"+",
")"
] | def linesFromInput(infile):
ret = collections.defaultdict(list)
for line in open(infile):
m = re.search('\s(\S+)/',line)
if m:
targ = m.group(1)
ret[targ].append(line)
else:
print ("Could not identify target from line:\n%s"%line)
sys.exit(1... | [
"def",
"linesFromInput",
"(",
"infile",
")",
":",
"ret",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"line",
"in",
"open",
"(",
"infile",
")",
":",
"m",
"=",
"re",
".",
"search",
"(",
"'\\s(\\S+)/'",
",",
"line",
")",
"if",
"m",
... | return dictionary mapping target name to all lines of types file
Gets target name by looking for (\S+) | [
"return",
"dictionary",
"mapping",
"target",
"name",
"to",
"all",
"lines",
"of",
"types",
"file",
"Gets",
"target",
"name",
"by",
"looking",
"for",
"(",
"\\",
"S",
"+",
")"
] | [
"'''return dictionary mapping target name to all lines of types file\n Gets target name by looking for (\\S+)/'''"
] | [
{
"param": "infile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e8a3c11f5ff2ca278a11f65263301ec281150dee | RMeli/gninascripts | clustering.py | [
"BSD-3-Clause"
] | Python | computeLigandSimilarity | <not_specific> | def computeLigandSimilarity(target_names, fname):
'''Read target (first col) and ligand (third col) from fname.
Return ligand similarity matrix indexed according to target_names'''
fingerprints = dict()
for line in open(fname):
vals = line.split()
targ = vals[0]
ligfile = vals[2... | Read target (first col) and ligand (third col) from fname.
Return ligand similarity matrix indexed according to target_names | Read target (first col) and ligand (third col) from fname.
Return ligand similarity matrix indexed according to target_names | [
"Read",
"target",
"(",
"first",
"col",
")",
"and",
"ligand",
"(",
"third",
"col",
")",
"from",
"fname",
".",
"Return",
"ligand",
"similarity",
"matrix",
"indexed",
"according",
"to",
"target_names"
] | def computeLigandSimilarity(target_names, fname):
fingerprints = dict()
for line in open(fname):
vals = line.split()
targ = vals[0]
ligfile = vals[2]
smi = open(ligfile).readline().split()[0]
mol = AllChem.MolFromSmiles(smi)
if mol == None:
mol = AllCh... | [
"def",
"computeLigandSimilarity",
"(",
"target_names",
",",
"fname",
")",
":",
"fingerprints",
"=",
"dict",
"(",
")",
"for",
"line",
"in",
"open",
"(",
"fname",
")",
":",
"vals",
"=",
"line",
".",
"split",
"(",
")",
"targ",
"=",
"vals",
"[",
"0",
"]"... | Read target (first col) and ligand (third col) from fname. | [
"Read",
"target",
"(",
"first",
"col",
")",
"and",
"ligand",
"(",
"third",
"col",
")",
"from",
"fname",
"."
] | [
"'''Read target (first col) and ligand (third col) from fname. \n Return ligand similarity matrix indexed according to target_names'''"
] | [
{
"param": "target_names",
"type": null
},
{
"param": "fname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target_names",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_t... |
72ceaece24a9817ad7c9c022a194fa35c0c99ad7 | mjachowdhury/knowledgeRepresentation | labs/Lab_W3_Solution.py | [
"MIT"
] | Python | actions | <not_specific> | def actions(self, state):
"""Return the actions that can be executed in the given
state. The result would typically be a list, but if there are
many actions, consider yielding them one at a time in an
iterator, rather than building them all at once."""
"""Return... | Return the actions that can be executed in the given
state. The result would typically be a list, but if there are
many actions, consider yielding them one at a time in an
iterator, rather than building them all at once. | Return the actions that can be executed in the given
state. The result would typically be a list, but if there are
many actions, consider yielding them one at a time in an
iterator, rather than building them all at once. | [
"Return",
"the",
"actions",
"that",
"can",
"be",
"executed",
"in",
"the",
"given",
"state",
".",
"The",
"result",
"would",
"typically",
"be",
"a",
"list",
"but",
"if",
"there",
"are",
"many",
"actions",
"consider",
"yielding",
"them",
"one",
"at",
"a",
"... | def actions(self, state):
possible_actions = ["101", "011", "201", "021", "111","101", "011", "201",
"021", "111"]
return possible_actions | [
"def",
"actions",
"(",
"self",
",",
"state",
")",
":",
"\"\"\"Return a list of (action . state) pairs. An action is a triple of the\n form (delta-m delta-c delta-b), where a positive delta means to move from\n side 1 to side 2; negative is the opposite. For example, the action (1 0 1... | Return the actions that can be executed in the given
state. | [
"Return",
"the",
"actions",
"that",
"can",
"be",
"executed",
"in",
"the",
"given",
"state",
"."
] | [
"\"\"\"Return the actions that can be executed in the given\n state. The result would typically be a list, but if there are\n many actions, consider yielding them one at a time in an\n iterator, rather than building them all at once.\"\"\"",
"\"\"\"Return a list of (action . state) pairs. An... | [
{
"param": "self",
"type": null
},
{
"param": "state",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": null,
"docstring": null,
"docstring_tokens": ... |
1d7fc7aa33bd708ebe349af1308a523103de1975 | mjachowdhury/knowledgeRepresentation | labs/Lab_W2_Solution.py | [
"MIT"
] | Python | compare_graph_searchers | null | def compare_graph_searchers(uninformed_searchers):
"""Prints a table of search results."""
outputString = 'Actions/Goal Tests/States/Goal\n'
print(outputString)
compare_searchers(problems=[cork_To_Dublin_problem, rosslare_To_Letterkenny_problem, limerick_To_Belfast_problem], header=['Searcher', 'ireland... | Prints a table of search results. | Prints a table of search results. | [
"Prints",
"a",
"table",
"of",
"search",
"results",
"."
] | def compare_graph_searchers(uninformed_searchers):
outputString = 'Actions/Goal Tests/States/Goal\n'
print(outputString)
compare_searchers(problems=[cork_To_Dublin_problem, rosslare_To_Letterkenny_problem, limerick_To_Belfast_problem], header=['Searcher', 'ireland_map(Cork, Dublin)','ireland_map(Rosslare, L... | [
"def",
"compare_graph_searchers",
"(",
"uninformed_searchers",
")",
":",
"outputString",
"=",
"'Actions/Goal Tests/States/Goal\\n'",
"print",
"(",
"outputString",
")",
"compare_searchers",
"(",
"problems",
"=",
"[",
"cork_To_Dublin_problem",
",",
"rosslare_To_Letterkenny_prob... | Prints a table of search results. | [
"Prints",
"a",
"table",
"of",
"search",
"results",
"."
] | [
"\"\"\"Prints a table of search results.\"\"\""
] | [
{
"param": "uninformed_searchers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "uninformed_searchers",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c533c8136f9e069aa0dbf068b14392c384fc88e | mjachowdhury/knowledgeRepresentation | labs/Lab_W1_Solution.py | [
"MIT"
] | Python | TableDrivenFarmerAgentProgram | <not_specific> | def TableDrivenFarmerAgentProgram(table):
"""This agent selects an action based on the percept sequence.
It is practical only for tiny domains.
To customize it, provide as table a dictionary of all
{percept_sequence:action} pairs. [Figure 2.7]"""
percepts = []
def program(percept):
prin... | This agent selects an action based on the percept sequence.
It is practical only for tiny domains.
To customize it, provide as table a dictionary of all
{percept_sequence:action} pairs. [Figure 2.7] | This agent selects an action based on the percept sequence.
It is practical only for tiny domains.
To customize it, provide as table a dictionary of all
{percept_sequence:action} pairs. | [
"This",
"agent",
"selects",
"an",
"action",
"based",
"on",
"the",
"percept",
"sequence",
".",
"It",
"is",
"practical",
"only",
"for",
"tiny",
"domains",
".",
"To",
"customize",
"it",
"provide",
"as",
"table",
"a",
"dictionary",
"of",
"all",
"{",
"percept_s... | def TableDrivenFarmerAgentProgram(table):
percepts = []
def program(percept):
print("TableDrivenFarmerAgentProgram [Percept]: ", percept)
percepts.append(percept)
action = table.get(tuple(percepts))
print("TableDrivenFarmerAgentProgram [Action]: ", action)
retur... | [
"def",
"TableDrivenFarmerAgentProgram",
"(",
"table",
")",
":",
"percepts",
"=",
"[",
"]",
"def",
"program",
"(",
"percept",
")",
":",
"print",
"(",
"\"TableDrivenFarmerAgentProgram [Percept]: \"",
",",
"percept",
")",
"percepts",
".",
"append",
"(",
"percept",
... | This agent selects an action based on the percept sequence. | [
"This",
"agent",
"selects",
"an",
"action",
"based",
"on",
"the",
"percept",
"sequence",
"."
] | [
"\"\"\"This agent selects an action based on the percept sequence.\n It is practical only for tiny domains.\n To customize it, provide as table a dictionary of all\n {percept_sequence:action} pairs. [Figure 2.7]\"\"\""
] | [
{
"param": "table",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "table",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5c533c8136f9e069aa0dbf068b14392c384fc88e | mjachowdhury/knowledgeRepresentation | labs/Lab_W1_Solution.py | [
"MIT"
] | Python | execute_action | null | def execute_action(self, agent, action):
"""Change agent's location and/or location's status; track performance.
Score 10 for each dirt cleaned; -1 for each move."""
"""
moveChicken
move
moveFox
moveFeed
moveChicken
SUCCESS
... | Change agent's location and/or location's status; track performance.
Score 10 for each dirt cleaned; -1 for each move. | Change agent's location and/or location's status; track performance.
Score 10 for each dirt cleaned; -1 for each move. | [
"Change",
"agent",
"'",
"s",
"location",
"and",
"/",
"or",
"location",
"'",
"s",
"status",
";",
"track",
"performance",
".",
"Score",
"10",
"for",
"each",
"dirt",
"cleaned",
";",
"-",
"1",
"for",
"each",
"move",
"."
] | def execute_action(self, agent, action):
if action == 'move':
self.move(agent)
elif action == 'moveChicken':
self.moveChicken(agent)
agent.performance -= 1
elif action == 'moveFox':
self.moveFox(agent)
agent.performance -= 1
eli... | [
"def",
"execute_action",
"(",
"self",
",",
"agent",
",",
"action",
")",
":",
"\"\"\" \n moveChicken\n move\n moveFox\n moveFeed\n moveChicken\n SUCCESS\n \"\"\"",
"if",
"action",
"==",
"'move'",
":",
"self",
".",
"move",
"(",... | Change agent's location and/or location's status; track performance. | [
"Change",
"agent",
"'",
"s",
"location",
"and",
"/",
"or",
"location",
"'",
"s",
"status",
";",
"track",
"performance",
"."
] | [
"\"\"\"Change agent's location and/or location's status; track performance.\n Score 10 for each dirt cleaned; -1 for each move.\"\"\"",
"\"\"\" \n moveChicken\n move\n moveFox\n moveFeed\n moveChicken\n SUCCESS\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "agent",
"type": null
},
{
"param": "action",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "agent",
"type": null,
"docstring": null,
"docstring_tokens": ... |
3b6fa247ef1d19bd38dd688d69c8e6377be5a483 | izihawa/types | izihawa_types/var.py | [
"MIT"
] | Python | process_varint | <not_specific> | def process_varint(payload, inverted=False):
"""Read a varint from `stream`"""
shift = 0
result = 0
count = 0
while True:
i = payload[count]
count += 1
result |= (i & 0x7f) << shift
shift += 7
if bool(i & 0x80) == inverted:
break
return result,... | Read a varint from `stream` | Read a varint from `stream` | [
"Read",
"a",
"varint",
"from",
"`",
"stream",
"`"
] | def process_varint(payload, inverted=False):
shift = 0
result = 0
count = 0
while True:
i = payload[count]
count += 1
result |= (i & 0x7f) << shift
shift += 7
if bool(i & 0x80) == inverted:
break
return result, count | [
"def",
"process_varint",
"(",
"payload",
",",
"inverted",
"=",
"False",
")",
":",
"shift",
"=",
"0",
"result",
"=",
"0",
"count",
"=",
"0",
"while",
"True",
":",
"i",
"=",
"payload",
"[",
"count",
"]",
"count",
"+=",
"1",
"result",
"|=",
"(",
"i",
... | Read a varint from `stream` | [
"Read",
"a",
"varint",
"from",
"`",
"stream",
"`"
] | [
"\"\"\"Read a varint from `stream`\"\"\""
] | [
{
"param": "payload",
"type": null
},
{
"param": "inverted",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "payload",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inverted",
"type": null,
"docstring": null,
"docstring_tok... |
14a777476e7b2b2ccbb0e0c17b451009a9bdddc5 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/pages/fetch.py | [
"Apache-2.0"
] | Python | fetch | null | def fetch(obj, doc_id, api_id):
"""Fetch documentation of api or portal."""
page_client: ApiClient = obj['page_client']
response = page_client.fetch(api_id, doc_id)
if api_id and doc_id:
click.echo("Page [{}] for API [{}] is uptodate.".format(response.name, api_id))
elif doc_id:
cli... | Fetch documentation of api or portal. | Fetch documentation of api or portal. | [
"Fetch",
"documentation",
"of",
"api",
"or",
"portal",
"."
] | def fetch(obj, doc_id, api_id):
page_client: ApiClient = obj['page_client']
response = page_client.fetch(api_id, doc_id)
if api_id and doc_id:
click.echo("Page [{}] for API [{}] is uptodate.".format(response.name, api_id))
elif doc_id:
click.echo("Page [{}] for portal is uptodate.".forma... | [
"def",
"fetch",
"(",
"obj",
",",
"doc_id",
",",
"api_id",
")",
":",
"page_client",
":",
"ApiClient",
"=",
"obj",
"[",
"'page_client'",
"]",
"response",
"=",
"page_client",
".",
"fetch",
"(",
"api_id",
",",
"doc_id",
")",
"if",
"api_id",
"and",
"doc_id",
... | Fetch documentation of api or portal. | [
"Fetch",
"documentation",
"of",
"api",
"or",
"portal",
"."
] | [
"\"\"\"Fetch documentation of api or portal.\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "doc_id",
"type": null
},
{
"param": "api_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "doc_id",
"type": null,
"docstring": null,
"docstring_tokens": ... |
46e3f9183039bd0ab8594fc6352d0e9a5133696c | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apps/apply.py | [
"Apache-2.0"
] | Python | apply | null | def apply(ctx, app_id, values_file, set, debug, config_path):
"""
This command allow to apply an APP configuration.
If app id is not filled, api definition will be created.
app id can be passed in option of command line, with a pipe (i.e echo $APP_ID | gio apply ...) or in the values file with app-id p... |
This command allow to apply an APP configuration.
If app id is not filled, api definition will be created.
app id can be passed in option of command line, with a pipe (i.e echo $APP_ID | gio apply ...) or in the values file with app-id param
The APP is managed with the template engine (jinja).
APP... | This command allow to apply an APP configuration.
If app id is not filled, api definition will be created.
app id can be passed in option of command line, with a pipe or in the values file with app-id param
The APP is managed with the template engine (jinja).
APP propetries are defined in plain YAML or JSON files. | [
"This",
"command",
"allow",
"to",
"apply",
"an",
"APP",
"configuration",
".",
"If",
"app",
"id",
"is",
"not",
"filled",
"api",
"definition",
"will",
"be",
"created",
".",
"app",
"id",
"can",
"be",
"passed",
"in",
"option",
"of",
"command",
"line",
"with"... | def apply(ctx, app_id, values_file, set, debug, config_path):
app_client: AppClient = ctx.obj['app_client']
app_resolver = ConfigResolver(config_path, values_file)
app_data = app_resolver.get_data(
Config_Type.APP,
set_values=set,
debug=debug
)
if debug:
c... | [
"def",
"apply",
"(",
"ctx",
",",
"app_id",
",",
"values_file",
",",
"set",
",",
"debug",
",",
"config_path",
")",
":",
"app_client",
":",
"AppClient",
"=",
"ctx",
".",
"obj",
"[",
"'app_client'",
"]",
"app_resolver",
"=",
"ConfigResolver",
"(",
"config_pat... | This command allow to apply an APP configuration. | [
"This",
"command",
"allow",
"to",
"apply",
"an",
"APP",
"configuration",
"."
] | [
"\"\"\"\n This command allow to apply an APP configuration.\n If app id is not filled, api definition will be created. \n app id can be passed in option of command line, with a pipe (i.e echo $APP_ID | gio apply ...) or in the values file with app-id param\n The APP is managed with the template engine (... | [
{
"param": "ctx",
"type": null
},
{
"param": "app_id",
"type": null
},
{
"param": "values_file",
"type": null
},
{
"param": "set",
"type": null
},
{
"param": "debug",
"type": null
},
{
"param": "config_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "app_id",
"type": null,
"docstring": null,
"docstring_tokens": ... |
d8808e95669e1b5abc35a411676f8baf502f39c0 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/apis.py | [
"Apache-2.0"
] | Python | apis | null | def apis(ctx):
"""
This group includes the commands regarding apis.
"""
ctx.obj['api_client'] = APIM_Client.API.http(ctx.obj['config']) |
This group includes the commands regarding apis.
| This group includes the commands regarding apis. | [
"This",
"group",
"includes",
"the",
"commands",
"regarding",
"apis",
"."
] | def apis(ctx):
ctx.obj['api_client'] = APIM_Client.API.http(ctx.obj['config']) | [
"def",
"apis",
"(",
"ctx",
")",
":",
"ctx",
".",
"obj",
"[",
"'api_client'",
"]",
"=",
"APIM_Client",
".",
"API",
".",
"http",
"(",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
")"
] | This group includes the commands regarding apis. | [
"This",
"group",
"includes",
"the",
"commands",
"regarding",
"apis",
"."
] | [
"\"\"\"\n This group includes the commands regarding apis.\n \"\"\""
] | [
{
"param": "ctx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1f170e05a02199fe8f66c559aa7a2a0edbf528a6 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/definition_group/apply.py | [
"Apache-2.0"
] | Python | apply | null | def apply(ctx, api_id, values_file, set, debug, config_path, with_deploy):
"""
This command allow to apply an API definition configuration.
If api id is not filled, api definition will be created.
api id can be passed in option of command line, with a pipe (i.e echo $API_ID | gio apply ...) or in the va... |
This command allow to apply an API definition configuration.
If api id is not filled, api definition will be created.
api id can be passed in option of command line, with a pipe (i.e echo $API_ID | gio apply ...) or in the values file with api-id param
The API definition is managed with the template en... | This command allow to apply an API definition configuration.
If api id is not filled, api definition will be created.
api id can be passed in option of command line, with a pipe or in the values file with api-id param
The API definition is managed with the template engine (jinja).
API propetries are defined in plain Y... | [
"This",
"command",
"allow",
"to",
"apply",
"an",
"API",
"definition",
"configuration",
".",
"If",
"api",
"id",
"is",
"not",
"filled",
"api",
"definition",
"will",
"be",
"created",
".",
"api",
"id",
"can",
"be",
"passed",
"in",
"option",
"of",
"command",
... | def apply(ctx, api_id, values_file, set, debug, config_path, with_deploy):
api_client: ApiClient = ctx.obj['api_client']
gio_config: GraviteeioConfig = ctx.obj['config']
api_resolver = ConfigResolver(config_path, values_file)
api_data = api_resolver.get_data(
Config_Type.API,
deb... | [
"def",
"apply",
"(",
"ctx",
",",
"api_id",
",",
"values_file",
",",
"set",
",",
"debug",
",",
"config_path",
",",
"with_deploy",
")",
":",
"api_client",
":",
"ApiClient",
"=",
"ctx",
".",
"obj",
"[",
"'api_client'",
"]",
"gio_config",
":",
"GraviteeioConfi... | This command allow to apply an API definition configuration. | [
"This",
"command",
"allow",
"to",
"apply",
"an",
"API",
"definition",
"configuration",
"."
] | [
"\"\"\"\n This command allow to apply an API definition configuration.\n If api id is not filled, api definition will be created.\n api id can be passed in option of command line, with a pipe (i.e echo $API_ID | gio apply ...) or in the values file with api-id param\n The API definition is managed with ... | [
{
"param": "ctx",
"type": null
},
{
"param": "api_id",
"type": null
},
{
"param": "values_file",
"type": null
},
{
"param": "set",
"type": null
},
{
"param": "debug",
"type": null
},
{
"param": "config_path",
"type": null
},
{
"param": "wit... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "api_id",
"type": null,
"docstring": null,
"docstring_tokens": ... |
7920d91300ca68f3cab8ccae742be43165c4bc9c | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/spec_group/lint.py | [
"Apache-2.0"
] | Python | lint | null | def lint(obj, api_id, file):
"""This command allow to run a serie of tests to verify that api specification is correctly formed."""
try:
with open(file, 'r') as f:
api_spec = f.read()
except FileNotFoundError:
raise GraviteeioError("Missing values file {}".format(file))
gio... | This command allow to run a serie of tests to verify that api specification is correctly formed. | This command allow to run a serie of tests to verify that api specification is correctly formed. | [
"This",
"command",
"allow",
"to",
"run",
"a",
"serie",
"of",
"tests",
"to",
"verify",
"that",
"api",
"specification",
"is",
"correctly",
"formed",
"."
] | def lint(obj, api_id, file):
try:
with open(file, 'r') as f:
api_spec = f.read()
except FileNotFoundError:
raise GraviteeioError("Missing values file {}".format(file))
gio_config: GraviteeioConfig = obj['config']
lint_service.validate_from_file(file, api_spec, DocumentType.oa... | [
"def",
"lint",
"(",
"obj",
",",
"api_id",
",",
"file",
")",
":",
"try",
":",
"with",
"open",
"(",
"file",
",",
"'r'",
")",
"as",
"f",
":",
"api_spec",
"=",
"f",
".",
"read",
"(",
")",
"except",
"FileNotFoundError",
":",
"raise",
"GraviteeioError",
... | This command allow to run a serie of tests to verify that api specification is correctly formed. | [
"This",
"command",
"allow",
"to",
"run",
"a",
"serie",
"of",
"tests",
"to",
"verify",
"that",
"api",
"specification",
"is",
"correctly",
"formed",
"."
] | [
"\"\"\"This command allow to run a serie of tests to verify that api specification is correctly formed.\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "api_id",
"type": null
},
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "api_id",
"type": null,
"docstring": null,
"docstring_tokens": ... |
eb21bd09b04255384eb27e4e8e8018643e882567 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apps/apps.py | [
"Apache-2.0"
] | Python | apps | null | def apps(ctx):
"""
This group includes the commands regarding application.
"""
ctx.obj['app_client'] = APIM_Client.APP.http(ctx.obj['config']) |
This group includes the commands regarding application.
| This group includes the commands regarding application. | [
"This",
"group",
"includes",
"the",
"commands",
"regarding",
"application",
"."
] | def apps(ctx):
ctx.obj['app_client'] = APIM_Client.APP.http(ctx.obj['config']) | [
"def",
"apps",
"(",
"ctx",
")",
":",
"ctx",
".",
"obj",
"[",
"'app_client'",
"]",
"=",
"APIM_Client",
".",
"APP",
".",
"http",
"(",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
")"
] | This group includes the commands regarding application. | [
"This",
"group",
"includes",
"the",
"commands",
"regarding",
"application",
"."
] | [
"\"\"\"\n This group includes the commands regarding application.\n \"\"\""
] | [
{
"param": "ctx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c4199ad983a10e1b8b136dc7c805dea00a58e28f | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/definition_group/diff.py | [
"Apache-2.0"
] | Python | diff | null | def diff(obj, api_id, values_file, set, config_path):
"""
This commande compare the api definition configuration developed on local machine with the configuration on the remote server.
"""
api_client: ApiClient = obj['api_client']
if not config_path:
config_path = "./"
if not os.path.e... |
This commande compare the api definition configuration developed on local machine with the configuration on the remote server.
| This commande compare the api definition configuration developed on local machine with the configuration on the remote server. | [
"This",
"commande",
"compare",
"the",
"api",
"definition",
"configuration",
"developed",
"on",
"local",
"machine",
"with",
"the",
"configuration",
"on",
"the",
"remote",
"server",
"."
] | def diff(obj, api_id, values_file, set, config_path):
api_client: ApiClient = obj['api_client']
if not config_path:
config_path = "./"
if not os.path.exists(config_path):
raise GraviteeioError("No resources folder {} found.".format(config_path))
api_resolver = ConfigResolver(config_path,... | [
"def",
"diff",
"(",
"obj",
",",
"api_id",
",",
"values_file",
",",
"set",
",",
"config_path",
")",
":",
"api_client",
":",
"ApiClient",
"=",
"obj",
"[",
"'api_client'",
"]",
"if",
"not",
"config_path",
":",
"config_path",
"=",
"\"./\"",
"if",
"not",
"os"... | This commande compare the api definition configuration developed on local machine with the configuration on the remote server. | [
"This",
"commande",
"compare",
"the",
"api",
"definition",
"configuration",
"developed",
"on",
"local",
"machine",
"with",
"the",
"configuration",
"on",
"the",
"remote",
"server",
"."
] | [
"\"\"\"\n This commande compare the api definition configuration developed on local machine with the configuration on the remote server.\n \"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "api_id",
"type": null
},
{
"param": "values_file",
"type": null
},
{
"param": "set",
"type": null
},
{
"param": "config_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "api_id",
"type": null,
"docstring": null,
"docstring_tokens": ... |
241a22df85af3b31444f8de23259849395e6da39 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/definition_group/lint.py | [
"Apache-2.0"
] | Python | lint | null | def lint(obj, config_path, file, set):
"""This command allow to run a serie of tests to verify that api definition configuration is correctly formed."""
gio_config: GraviteeioConfig = obj['config']
api_resolver = ConfigResolver(config_path, file)
api_def_config = api_resolver.get_data(
Config_T... | This command allow to run a serie of tests to verify that api definition configuration is correctly formed. | This command allow to run a serie of tests to verify that api definition configuration is correctly formed. | [
"This",
"command",
"allow",
"to",
"run",
"a",
"serie",
"of",
"tests",
"to",
"verify",
"that",
"api",
"definition",
"configuration",
"is",
"correctly",
"formed",
"."
] | def lint(obj, config_path, file, set):
gio_config: GraviteeioConfig = obj['config']
api_resolver = ConfigResolver(config_path, file)
api_def_config = api_resolver.get_data(
Config_Type.API,
debug=False,
set_values=set
)
lint_service.validate(api_def_config, DocumentType.gio_a... | [
"def",
"lint",
"(",
"obj",
",",
"config_path",
",",
"file",
",",
"set",
")",
":",
"gio_config",
":",
"GraviteeioConfig",
"=",
"obj",
"[",
"'config'",
"]",
"api_resolver",
"=",
"ConfigResolver",
"(",
"config_path",
",",
"file",
")",
"api_def_config",
"=",
"... | This command allow to run a serie of tests to verify that api definition configuration is correctly formed. | [
"This",
"command",
"allow",
"to",
"run",
"a",
"serie",
"of",
"tests",
"to",
"verify",
"that",
"api",
"definition",
"configuration",
"is",
"correctly",
"formed",
"."
] | [
"\"\"\"This command allow to run a serie of tests to verify that api definition configuration is correctly formed.\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "config_path",
"type": null
},
{
"param": "file",
"type": null
},
{
"param": "set",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_path",
"type": null,
"docstring": null,
"docstring_toke... |
9fafae8ffabbb40e7dfeeb56902be2ea602a9d5d | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/ls.py | [
"Apache-2.0"
] | Python | ls | <not_specific> | def ls(obj, output, query):
"""
This command lists all API available on Api management platform.
Default query with output `table`: `[].{Id: id, Name: name, Tags: style_tags(tags), Synchronized: style_synchronized(is_synchronized), Status: style_state(state), Workflow: style_workflow_state(workflow_state)}`
""... |
This command lists all API available on Api management platform.
Default query with output `table`: `[].{Id: id, Name: name, Tags: style_tags(tags), Synchronized: style_synchronized(is_synchronized), Status: style_state(state), Workflow: style_workflow_state(workflow_state)}`
| This command lists all API available on Api management platform. | [
"This",
"command",
"lists",
"all",
"API",
"available",
"on",
"Api",
"management",
"platform",
"."
] | def ls(obj, output, query):
async def get_apis():
client = ApiClientAsync(obj['config'])
apis = await client.get_apis_with_state()
return apis
loop = asyncio.get_event_loop()
apis = loop.run_until_complete(get_apis())
logger.debug("apis response: {}".format(apis))
if not apis... | [
"def",
"ls",
"(",
"obj",
",",
"output",
",",
"query",
")",
":",
"async",
"def",
"get_apis",
"(",
")",
":",
"client",
"=",
"ApiClientAsync",
"(",
"obj",
"[",
"'config'",
"]",
")",
"apis",
"=",
"await",
"client",
".",
"get_apis_with_state",
"(",
")",
"... | This command lists all API available on Api management platform. | [
"This",
"command",
"lists",
"all",
"API",
"available",
"on",
"Api",
"management",
"platform",
"."
] | [
"\"\"\"\nThis command lists all API available on Api management platform.\n\nDefault query with output `table`: `[].{Id: id, Name: name, Tags: style_tags(tags), Synchronized: style_synchronized(is_synchronized), Status: style_state(state), Workflow: style_workflow_state(workflow_state)}`\n \"\"\"",
"# TODO: Dy... | [
{
"param": "obj",
"type": null
},
{
"param": "output",
"type": null
},
{
"param": "query",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": ... |
5cc6b78d8835babb676d2aefbee21a163dd8e906 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apps/generate.py | [
"Apache-2.0"
] | Python | generate | null | def generate(obj, config_path, format, from_id):
"""Generate default templates, setting and value files for api definition"""
if not os.path.exists(config_path):
os.mkdir(config_path)
app_string = None
if from_id:
app_client: AppClient = obj['app_client']
app_string = app_client... | Generate default templates, setting and value files for api definition | Generate default templates, setting and value files for api definition | [
"Generate",
"default",
"templates",
"setting",
"and",
"value",
"files",
"for",
"api",
"definition"
] | def generate(obj, config_path, format, from_id):
if not os.path.exists(config_path):
os.mkdir(config_path)
app_string = None
if from_id:
app_client: AppClient = obj['app_client']
app_string = app_client.get_export(from_id, filter_app_values)
resolver = ConfigResolver(config_path)... | [
"def",
"generate",
"(",
"obj",
",",
"config_path",
",",
"format",
",",
"from_id",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_path",
")",
":",
"os",
".",
"mkdir",
"(",
"config_path",
")",
"app_string",
"=",
"None",
"if",
"fr... | Generate default templates, setting and value files for api definition | [
"Generate",
"default",
"templates",
"setting",
"and",
"value",
"files",
"for",
"api",
"definition"
] | [
"\"\"\"Generate default templates, setting and value files for api definition\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "config_path",
"type": null
},
{
"param": "format",
"type": null
},
{
"param": "from_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_path",
"type": null,
"docstring": null,
"docstring_toke... |
b832bffbddd76653ee4b4d1ed5dff08e3cfb0104 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/definition_group/generate.py | [
"Apache-2.0"
] | Python | generate | null | def generate(obj, config_path, format, from_id):
"""Generate default templates, setting and value files for api definition"""
if not os.path.exists(config_path):
os.mkdir(config_path)
api_def_string = None
if from_id:
api_client: ApiClient = obj['api_client']
api_def_string = ap... | Generate default templates, setting and value files for api definition | Generate default templates, setting and value files for api definition | [
"Generate",
"default",
"templates",
"setting",
"and",
"value",
"files",
"for",
"api",
"definition"
] | def generate(obj, config_path, format, from_id):
if not os.path.exists(config_path):
os.mkdir(config_path)
api_def_string = None
if from_id:
api_client: ApiClient = obj['api_client']
api_def_string = api_client.get_export(from_id, filter_api_values)
resolver = ConfigResolver(conf... | [
"def",
"generate",
"(",
"obj",
",",
"config_path",
",",
"format",
",",
"from_id",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_path",
")",
":",
"os",
".",
"mkdir",
"(",
"config_path",
")",
"api_def_string",
"=",
"None",
"if",
... | Generate default templates, setting and value files for api definition | [
"Generate",
"default",
"templates",
"setting",
"and",
"value",
"files",
"for",
"api",
"definition"
] | [
"\"\"\"Generate default templates, setting and value files for api definition\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "config_path",
"type": null
},
{
"param": "format",
"type": null
},
{
"param": "from_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_path",
"type": null,
"docstring": null,
"docstring_toke... |
7252008c26b1662083a1400694c806c34e33ed67 | gravitee-io/gravitee-cli | graviteeio_cli/lint/functions/length.py | [
"Apache-2.0"
] | Python | length | <not_specific> | def length(value, **kwargs):
"""Count the length of a string an or array, the number of properties in an object, or a numeric value, and define minimum and/or maximum values."""
min = None
max = None
if "min" in kwargs and type(kwargs["min"]) is int:
min = kwargs["min"]
if "max" in kwargs ... | Count the length of a string an or array, the number of properties in an object, or a numeric value, and define minimum and/or maximum values. | Count the length of a string an or array, the number of properties in an object, or a numeric value, and define minimum and/or maximum values. | [
"Count",
"the",
"length",
"of",
"a",
"string",
"an",
"or",
"array",
"the",
"number",
"of",
"properties",
"in",
"an",
"object",
"or",
"a",
"numeric",
"value",
"and",
"define",
"minimum",
"and",
"/",
"or",
"maximum",
"values",
"."
] | def length(value, **kwargs):
min = None
max = None
if "min" in kwargs and type(kwargs["min"]) is int:
min = kwargs["min"]
if "max" in kwargs and type(kwargs["max"]) is int:
max = kwargs["max"]
value_length = 0
if value:
if type(value) is (int or float):
value_... | [
"def",
"length",
"(",
"value",
",",
"**",
"kwargs",
")",
":",
"min",
"=",
"None",
"max",
"=",
"None",
"if",
"\"min\"",
"in",
"kwargs",
"and",
"type",
"(",
"kwargs",
"[",
"\"min\"",
"]",
")",
"is",
"int",
":",
"min",
"=",
"kwargs",
"[",
"\"min\"",
... | Count the length of a string an or array, the number of properties in an object, or a numeric value, and define minimum and/or maximum values. | [
"Count",
"the",
"length",
"of",
"a",
"string",
"an",
"or",
"array",
"the",
"number",
"of",
"properties",
"in",
"an",
"object",
"or",
"a",
"numeric",
"value",
"and",
"define",
"minimum",
"and",
"/",
"or",
"maximum",
"values",
"."
] | [
"\"\"\"Count the length of a string an or array, the number of properties in an object, or a numeric value, and define minimum and/or maximum values.\"\"\""
] | [
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0f160b6bb8e74f789737fa5f79b2187cd5e8ab2d | gravitee-io/gravitee-cli | graviteeio_cli/commands/profiles.py | [
"Apache-2.0"
] | Python | profiles | null | def profiles():
"""
`profiles` command allow to config modules APIM and AM
Configuration values are stored in file with structure of INI file. The config file is located `~/graviteeio`.
Each section contains the configuration by profile for each module. Environment can mean staging, production...
... |
`profiles` command allow to config modules APIM and AM
Configuration values are stored in file with structure of INI file. The config file is located `~/graviteeio`.
Each section contains the configuration by profile for each module. Environment can mean staging, production...
Environment variables:... | `profiles` command allow to config modules APIM and AM
Configuration values are stored in file with structure of INI file. The config file is located `~/graviteeio`.
Each section contains the configuration by profile for each module. Environment can mean staging, production
Environment variables.
`GRAVITEEIO_CONF_FI... | [
"`",
"profiles",
"`",
"command",
"allow",
"to",
"config",
"modules",
"APIM",
"and",
"AM",
"Configuration",
"values",
"are",
"stored",
"in",
"file",
"with",
"structure",
"of",
"INI",
"file",
".",
"The",
"config",
"file",
"is",
"located",
"`",
"~",
"/",
"g... | def profiles():
pass | [
"def",
"profiles",
"(",
")",
":",
"pass"
] | `profiles` command allow to config modules APIM and AM
Configuration values are stored in file with structure of INI file. | [
"`",
"profiles",
"`",
"command",
"allow",
"to",
"config",
"modules",
"APIM",
"and",
"AM",
"Configuration",
"values",
"are",
"stored",
"in",
"file",
"with",
"structure",
"of",
"INI",
"file",
"."
] | [
"\"\"\"\n `profiles` command allow to config modules APIM and AM\n\n Configuration values are stored in file with structure of INI file. The config file is located `~/graviteeio`.\n\n Each section contains the configuration by profile for each module. Environment can mean staging, production...\n\n Envi... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0f160b6bb8e74f789737fa5f79b2187cd5e8ab2d | gravitee-io/gravitee-cli | graviteeio_cli/commands/profiles.py | [
"Apache-2.0"
] | Python | create | null | def create(obj, profile, module, url, environment, organization):
"""This command create a new profile configuration according to module."""
gio_config: GraviteeioConfig = obj['config']
data = {
"address_url": url
}
if environment:
data["env"] = environment
if organization:
... | This command create a new profile configuration according to module. | This command create a new profile configuration according to module. | [
"This",
"command",
"create",
"a",
"new",
"profile",
"configuration",
"according",
"to",
"module",
"."
] | def create(obj, profile, module, url, environment, organization):
gio_config: GraviteeioConfig = obj['config']
data = {
"address_url": url
}
if environment:
data["env"] = environment
if organization:
data["org"] = organization
gio_config.save(profile=profile, module=modul... | [
"def",
"create",
"(",
"obj",
",",
"profile",
",",
"module",
",",
"url",
",",
"environment",
",",
"organization",
")",
":",
"gio_config",
":",
"GraviteeioConfig",
"=",
"obj",
"[",
"'config'",
"]",
"data",
"=",
"{",
"\"address_url\"",
":",
"url",
"}",
"if"... | This command create a new profile configuration according to module. | [
"This",
"command",
"create",
"a",
"new",
"profile",
"configuration",
"according",
"to",
"module",
"."
] | [
"\"\"\"This command create a new profile configuration according to module.\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "profile",
"type": null
},
{
"param": "module",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "environment",
"type": null
},
{
"param": "organization",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "profile",
"type": null,
"docstring": null,
"docstring_tokens":... |
0f160b6bb8e74f789737fa5f79b2187cd5e8ab2d | gravitee-io/gravitee-cli | graviteeio_cli/commands/profiles.py | [
"Apache-2.0"
] | Python | ls | null | def ls(obj, output):
"""
This command display profile(s) available
"""
gio_config: GraviteeioConfig = obj['config']
profiles = gio_config.profiles()
new_profiles = []
for profile in profiles:
if profile == gio_config.profile:
new_profiles.append("{} (active)".format(prof... |
This command display profile(s) available
| This command display profile(s) available | [
"This",
"command",
"display",
"profile",
"(",
"s",
")",
"available"
] | def ls(obj, output):
gio_config: GraviteeioConfig = obj['config']
profiles = gio_config.profiles()
new_profiles = []
for profile in profiles:
if profile == gio_config.profile:
new_profiles.append("{} (active)".format(profile))
else:
new_profiles.append(profile)
... | [
"def",
"ls",
"(",
"obj",
",",
"output",
")",
":",
"gio_config",
":",
"GraviteeioConfig",
"=",
"obj",
"[",
"'config'",
"]",
"profiles",
"=",
"gio_config",
".",
"profiles",
"(",
")",
"new_profiles",
"=",
"[",
"]",
"for",
"profile",
"in",
"profiles",
":",
... | This command display profile(s) available | [
"This",
"command",
"display",
"profile",
"(",
"s",
")",
"available"
] | [
"\"\"\"\n This command display profile(s) available\n \"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0f160b6bb8e74f789737fa5f79b2187cd5e8ab2d | gravitee-io/gravitee-cli | graviteeio_cli/commands/profiles.py | [
"Apache-2.0"
] | Python | remove | null | def remove(obj, profile_name):
"""Remove profile and all configurations."""
gio_config: GraviteeioConfig = obj['config']
gio_config.remove(profile=profile_name)
click.echo("Profile [%s] removed." % profile_name) | Remove profile and all configurations. | Remove profile and all configurations. | [
"Remove",
"profile",
"and",
"all",
"configurations",
"."
] | def remove(obj, profile_name):
gio_config: GraviteeioConfig = obj['config']
gio_config.remove(profile=profile_name)
click.echo("Profile [%s] removed." % profile_name) | [
"def",
"remove",
"(",
"obj",
",",
"profile_name",
")",
":",
"gio_config",
":",
"GraviteeioConfig",
"=",
"obj",
"[",
"'config'",
"]",
"gio_config",
".",
"remove",
"(",
"profile",
"=",
"profile_name",
")",
"click",
".",
"echo",
"(",
"\"Profile [%s] removed.\"",
... | Remove profile and all configurations. | [
"Remove",
"profile",
"and",
"all",
"configurations",
"."
] | [
"\"\"\"Remove profile and all configurations.\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "profile_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "profile_name",
"type": null,
"docstring": null,
"docstring_tok... |
0f160b6bb8e74f789737fa5f79b2187cd5e8ab2d | gravitee-io/gravitee-cli | graviteeio_cli/commands/profiles.py | [
"Apache-2.0"
] | Python | load | null | def load(ctx, profile_name):
"""
This command switches of profile. The configuration of the profile is loaded for the execution of command.
"""
gio_config: GraviteeioConfig = ctx.obj['config']
old_profile = gio_config.profile
if gio_config.config_module[GioModule.APIM] and gio_config.config_mod... |
This command switches of profile. The configuration of the profile is loaded for the execution of command.
| This command switches of profile. The configuration of the profile is loaded for the execution of command. | [
"This",
"command",
"switches",
"of",
"profile",
".",
"The",
"configuration",
"of",
"the",
"profile",
"is",
"loaded",
"for",
"the",
"execution",
"of",
"command",
"."
] | def load(ctx, profile_name):
gio_config: GraviteeioConfig = ctx.obj['config']
old_profile = gio_config.profile
if gio_config.config_module[GioModule.APIM] and gio_config.config_module[GioModule.APIM].is_logged_in():
ctx.obj['auth_client'] = APIM_Client.AUTH.http(ctx.obj['config'])
ctx.obj['m... | [
"def",
"load",
"(",
"ctx",
",",
"profile_name",
")",
":",
"gio_config",
":",
"GraviteeioConfig",
"=",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
"old_profile",
"=",
"gio_config",
".",
"profile",
"if",
"gio_config",
".",
"config_module",
"[",
"GioModule",
".",
... | This command switches of profile. | [
"This",
"command",
"switches",
"of",
"profile",
"."
] | [
"\"\"\"\n This command switches of profile. The configuration of the profile is loaded for the execution of command.\n \"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "profile_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "profile_name",
"type": null,
"docstring": null,
"docstring_tok... |
a3d5c5f7eba5f2bbe456b4b8a46d9335049331a2 | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/health.py | [
"Apache-2.0"
] | Python | health | <not_specific> | def health(obj, output, query, api_id):
"""API health: return the lastest availability: minute, hour, day, week, month"""
api_client: ApiClient = obj['api_client']
health_values = None
# health = api_client.health(api_id, time_frame_seconds = parse(time_frame))
health = api_client.health(api_id)
... | API health: return the lastest availability: minute, hour, day, week, month | API health: return the lastest availability: minute, hour, day, week, month | [
"API",
"health",
":",
"return",
"the",
"lastest",
"availability",
":",
"minute",
"hour",
"day",
"week",
"month"
] | def health(obj, output, query, api_id):
api_client: ApiClient = obj['api_client']
health_values = None
health = api_client.health(api_id)
if 'global' in health:
health_values = health['global']
else:
click.echo("No health data")
return
to_return = []
for key, value in... | [
"def",
"health",
"(",
"obj",
",",
"output",
",",
"query",
",",
"api_id",
")",
":",
"api_client",
":",
"ApiClient",
"=",
"obj",
"[",
"'api_client'",
"]",
"health_values",
"=",
"None",
"health",
"=",
"api_client",
".",
"health",
"(",
"api_id",
")",
"if",
... | API health: return the lastest availability: minute, hour, day, week, month | [
"API",
"health",
":",
"return",
"the",
"lastest",
"availability",
":",
"minute",
"hour",
"day",
"week",
"month"
] | [
"\"\"\"API health: return the lastest availability: minute, hour, day, week, month\"\"\"",
"# health = api_client.health(api_id, time_frame_seconds = parse(time_frame))"
] | [
{
"param": "obj",
"type": null
},
{
"param": "output",
"type": null
},
{
"param": "query",
"type": null
},
{
"param": "api_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": ... |
30508c095103dab46fcb7230cec62a01b2b02a5d | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/pages/pages.py | [
"Apache-2.0"
] | Python | pages | null | def pages(ctx):
"""
This group includes the commands regarding documentation pages.
"""
ctx.obj['page_client'] = APIM_Client.PAGE.http(ctx.obj['config']) |
This group includes the commands regarding documentation pages.
| This group includes the commands regarding documentation pages. | [
"This",
"group",
"includes",
"the",
"commands",
"regarding",
"documentation",
"pages",
"."
] | def pages(ctx):
ctx.obj['page_client'] = APIM_Client.PAGE.http(ctx.obj['config']) | [
"def",
"pages",
"(",
"ctx",
")",
":",
"ctx",
".",
"obj",
"[",
"'page_client'",
"]",
"=",
"APIM_Client",
".",
"PAGE",
".",
"http",
"(",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
")"
] | This group includes the commands regarding documentation pages. | [
"This",
"group",
"includes",
"the",
"commands",
"regarding",
"documentation",
"pages",
"."
] | [
"\"\"\"\n This group includes the commands regarding documentation pages.\n \"\"\""
] | [
{
"param": "ctx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7e8935be9d8cf670ec08ed71c058bcb59bc6fbfd | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apis/definition_group/create.py | [
"Apache-2.0"
] | Python | create | null | def create(ctx, values_file, set, debug, config_path, with_start):
"""
This command allow to create api definition.
"""
ctx.invoke(
apply,
api_id=None,
values_file=values_file,
set=set,
debug=debug,
config_path=config_path,
with_deploy=with_start
... |
This command allow to create api definition.
| This command allow to create api definition. | [
"This",
"command",
"allow",
"to",
"create",
"api",
"definition",
"."
] | def create(ctx, values_file, set, debug, config_path, with_start):
ctx.invoke(
apply,
api_id=None,
values_file=values_file,
set=set,
debug=debug,
config_path=config_path,
with_deploy=with_start
) | [
"def",
"create",
"(",
"ctx",
",",
"values_file",
",",
"set",
",",
"debug",
",",
"config_path",
",",
"with_start",
")",
":",
"ctx",
".",
"invoke",
"(",
"apply",
",",
"api_id",
"=",
"None",
",",
"values_file",
"=",
"values_file",
",",
"set",
"=",
"set",
... | This command allow to create api definition. | [
"This",
"command",
"allow",
"to",
"create",
"api",
"definition",
"."
] | [
"\"\"\"\n This command allow to create api definition.\n \"\"\""
] | [
{
"param": "ctx",
"type": null
},
{
"param": "values_file",
"type": null
},
{
"param": "set",
"type": null
},
{
"param": "debug",
"type": null
},
{
"param": "config_path",
"type": null
},
{
"param": "with_start",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ctx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "values_file",
"type": null,
"docstring": null,
"docstring_toke... |
1cadc12ab46d4bd3394cb327a209b66a230a3d5e | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/pages/update.py | [
"Apache-2.0"
] | Python | update_content | null | def update_content(obj, page_id, api_id, file):
"""Update content for page documentation."""
page_content = None
if file.startswith("http://") or file.startswith("https://"):
try:
page_content = requests.get(file).text
except Exception:
raise GraviteeioError(f'Invali... | Update content for page documentation. | Update content for page documentation. | [
"Update",
"content",
"for",
"page",
"documentation",
"."
] | def update_content(obj, page_id, api_id, file):
page_content = None
if file.startswith("http://") or file.startswith("https://"):
try:
page_content = requests.get(file).text
except Exception:
raise GraviteeioError(f'Invalid value for "--file" / "-f": Call error for URL "{... | [
"def",
"update_content",
"(",
"obj",
",",
"page_id",
",",
"api_id",
",",
"file",
")",
":",
"page_content",
"=",
"None",
"if",
"file",
".",
"startswith",
"(",
"\"http://\"",
")",
"or",
"file",
".",
"startswith",
"(",
"\"https://\"",
")",
":",
"try",
":",
... | Update content for page documentation. | [
"Update",
"content",
"for",
"page",
"documentation",
"."
] | [
"\"\"\"Update content for page documentation.\"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "page_id",
"type": null
},
{
"param": "api_id",
"type": null
},
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "page_id",
"type": null,
"docstring": null,
"docstring_tokens":... |
d01a3fdd6c6efe8f9a7753db41a8f6eab2f342ce | gravitee-io/gravitee-cli | graviteeio_cli/commands/apim/apps/ls.py | [
"Apache-2.0"
] | Python | ls | <not_specific> | def ls(obj, output):
"""
This command lists all Application available on Api management platform.
Default query with output `table`: `[].{Id: id, Name: name, Tags: style_tags(tags), Synchronized: style_synchronized(is_synchronized), Status: style_state(state), Workflow: style_workflow_state(workflow_state)}`
"... |
This command lists all Application available on Api management platform.
Default query with output `table`: `[].{Id: id, Name: name, Tags: style_tags(tags), Synchronized: style_synchronized(is_synchronized), Status: style_state(state), Workflow: style_workflow_state(workflow_state)}`
| This command lists all Application available on Api management platform. | [
"This",
"command",
"lists",
"all",
"Application",
"available",
"on",
"Api",
"management",
"platform",
"."
] | def ls(obj, output):
app_client: AppClient = obj['app_client']
apps = app_client.get()
outputFormatType = OutputFormatType.value_of(output)
if outputFormatType.TABLE == outputFormatType:
query = "[].{Id: id, Name: name, Type: type, Owner: owner.displayName}"
try:
apps_filtered = jmes... | [
"def",
"ls",
"(",
"obj",
",",
"output",
")",
":",
"app_client",
":",
"AppClient",
"=",
"obj",
"[",
"'app_client'",
"]",
"apps",
"=",
"app_client",
".",
"get",
"(",
")",
"outputFormatType",
"=",
"OutputFormatType",
".",
"value_of",
"(",
"output",
")",
"if... | This command lists all Application available on Api management platform. | [
"This",
"command",
"lists",
"all",
"Application",
"available",
"on",
"Api",
"management",
"platform",
"."
] | [
"\"\"\"\nThis command lists all Application available on Api management platform.\n\nDefault query with output `table`: `[].{Id: id, Name: name, Tags: style_tags(tags), Synchronized: style_synchronized(is_synchronized), Status: style_state(state), Workflow: style_workflow_state(workflow_state)}`\n \"\"\""
] | [
{
"param": "obj",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": ... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | q2 | <not_specific> | def q2(omega, twotheta, phi, wavelength):
"""
Convert angles and wavelength (lambda) to Q vector.
Parameters
----------
omega: float
angle of incidence of beam (with respect to xy plane).
twotheta: float
angle between direct beam and the projection of the reflected beam onto
... |
Convert angles and wavelength (lambda) to Q vector.
Parameters
----------
omega: float
angle of incidence of beam (with respect to xy plane).
twotheta: float
angle between direct beam and the projection of the reflected beam onto
xz plane.
phi: float
azimuthal a... | Convert angles and wavelength (lambda) to Q vector.
Parameters
float
angle of incidence of beam (with respect to xy plane).
twotheta: float
angle between direct beam and the projection of the reflected beam onto
xz plane.
phi: float
azimuthal angle between reflected beam and xz plane.
wavelength: float
Returns
Not... | [
"Convert",
"angles",
"and",
"wavelength",
"(",
"lambda",
")",
"to",
"Q",
"vector",
".",
"Parameters",
"float",
"angle",
"of",
"incidence",
"of",
"beam",
"(",
"with",
"respect",
"to",
"xy",
"plane",
")",
".",
"twotheta",
":",
"float",
"angle",
"between",
... | def q2(omega, twotheta, phi, wavelength):
omega = np.radians(omega)
twotheta = np.radians(twotheta)
phi = np.radians(phi)
qx = (
2
* np.pi
/ wavelength
* (np.cos(twotheta - omega) * np.cos(phi) - np.cos(omega))
)
qy = 2 * np.pi / wavelength * np.cos(twotheta - ome... | [
"def",
"q2",
"(",
"omega",
",",
"twotheta",
",",
"phi",
",",
"wavelength",
")",
":",
"omega",
"=",
"np",
".",
"radians",
"(",
"omega",
")",
"twotheta",
"=",
"np",
".",
"radians",
"(",
"twotheta",
")",
"phi",
"=",
"np",
".",
"radians",
"(",
"phi",
... | Convert angles and wavelength (lambda) to Q vector. | [
"Convert",
"angles",
"and",
"wavelength",
"(",
"lambda",
")",
"to",
"Q",
"vector",
"."
] | [
"\"\"\"\n Convert angles and wavelength (lambda) to Q vector.\n\n Parameters\n ----------\n omega: float\n angle of incidence of beam (with respect to xy plane).\n twotheta: float\n angle between direct beam and the projection of the reflected beam onto\n xz plane.\n phi: floa... | [
{
"param": "omega",
"type": null
},
{
"param": "twotheta",
"type": null
},
{
"param": "phi",
"type": null
},
{
"param": "wavelength",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "omega",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "twotheta",
"type": null,
"docstring": null,
"docstring_token... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | double_chopper_frequency | <not_specific> | def double_chopper_frequency(min_wavelength, max_wavelength, L, N=1):
r"""
Calculates the maximum frequency available for a given wavelength band
without getting frame overlap in a chopper spectrometer.
Parameters
----------
min_wavelength: float
minimum wavelength to be used
max_wa... | r"""
Calculates the maximum frequency available for a given wavelength band
without getting frame overlap in a chopper spectrometer.
Parameters
----------
min_wavelength: float
minimum wavelength to be used
max_wavelength: float
maximum wavelength to be used
L: float
... | r"""
Calculates the maximum frequency available for a given wavelength band
without getting frame overlap in a chopper spectrometer.
Parameters
float
minimum wavelength to be used
max_wavelength: float
maximum wavelength to be used
L: float
Flight length of instrument (m)
N: float, optional
number of windows in chopp... | [
"r",
"\"",
"\"",
"\"",
"Calculates",
"the",
"maximum",
"frequency",
"available",
"for",
"a",
"given",
"wavelength",
"band",
"without",
"getting",
"frame",
"overlap",
"in",
"a",
"chopper",
"spectrometer",
".",
"Parameters",
"float",
"minimum",
"wavelength",
"to",... | def double_chopper_frequency(min_wavelength, max_wavelength, L, N=1):
return K / ((max_wavelength - min_wavelength) * L * N) | [
"def",
"double_chopper_frequency",
"(",
"min_wavelength",
",",
"max_wavelength",
",",
"L",
",",
"N",
"=",
"1",
")",
":",
"return",
"K",
"/",
"(",
"(",
"max_wavelength",
"-",
"min_wavelength",
")",
"*",
"L",
"*",
"N",
")"
] | r"""
Calculates the maximum frequency available for a given wavelength band
without getting frame overlap in a chopper spectrometer. | [
"r",
"\"",
"\"",
"\"",
"Calculates",
"the",
"maximum",
"frequency",
"available",
"for",
"a",
"given",
"wavelength",
"band",
"without",
"getting",
"frame",
"overlap",
"in",
"a",
"chopper",
"spectrometer",
"."
] | [
"r\"\"\"\n Calculates the maximum frequency available for a given wavelength band\n without getting frame overlap in a chopper spectrometer.\n\n Parameters\n ----------\n min_wavelength: float\n minimum wavelength to be used\n max_wavelength: float\n maximum wavelength to be used\n ... | [
{
"param": "min_wavelength",
"type": null
},
{
"param": "max_wavelength",
"type": null
},
{
"param": "L",
"type": null
},
{
"param": "N",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "min_wavelength",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "max_wavelength",
"type": null,
"docstring": null,
"... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | resolution_double_chopper | <not_specific> | def resolution_double_chopper(
wavelength, z0=0.358, R=0.35, freq=24, H=0.005, xsi=0, L=7.5, tau_da=0
):
"""
Calculates the fractional resolution of a double chopper pair, dl/l.
Parameters
----------
wavelength: float
wavelength in Angstroms
z0: float
distance between choppe... |
Calculates the fractional resolution of a double chopper pair, dl/l.
Parameters
----------
wavelength: float
wavelength in Angstroms
z0: float
distance between chopper pair (m)
R: float
radius of chopper discs (m)
freq: float
rotation frequency of choppers (... | Calculates the fractional resolution of a double chopper pair, dl/l.
Parameters
Returns
float
Fractional wavelength resolution of a double chopper system. | [
"Calculates",
"the",
"fractional",
"resolution",
"of",
"a",
"double",
"chopper",
"pair",
"dl",
"/",
"l",
".",
"Parameters",
"Returns",
"float",
"Fractional",
"wavelength",
"resolution",
"of",
"a",
"double",
"chopper",
"system",
"."
] | def resolution_double_chopper(
wavelength, z0=0.358, R=0.35, freq=24, H=0.005, xsi=0, L=7.5, tau_da=0
):
TOF = L / wavelength_velocity(wavelength)
tc = tauC(wavelength, xsi=xsi, z0=z0, freq=freq)
tau_h = H / R / (2 * np.pi * freq)
return 0.68 * np.sqrt(
(tc / TOF) ** 2 + (tau_h / TOF) ** 2 +... | [
"def",
"resolution_double_chopper",
"(",
"wavelength",
",",
"z0",
"=",
"0.358",
",",
"R",
"=",
"0.35",
",",
"freq",
"=",
"24",
",",
"H",
"=",
"0.005",
",",
"xsi",
"=",
"0",
",",
"L",
"=",
"7.5",
",",
"tau_da",
"=",
"0",
")",
":",
"TOF",
"=",
"L... | Calculates the fractional resolution of a double chopper pair, dl/l. | [
"Calculates",
"the",
"fractional",
"resolution",
"of",
"a",
"double",
"chopper",
"pair",
"dl",
"/",
"l",
"."
] | [
"\"\"\"\n Calculates the fractional resolution of a double chopper pair, dl/l.\n\n Parameters\n ----------\n wavelength: float\n wavelength in Angstroms\n z0: float\n distance between chopper pair (m)\n R: float\n radius of chopper discs (m)\n freq: float\n rotation ... | [
{
"param": "wavelength",
"type": null
},
{
"param": "z0",
"type": null
},
{
"param": "R",
"type": null
},
{
"param": "freq",
"type": null
},
{
"param": "H",
"type": null
},
{
"param": "xsi",
"type": null
},
{
"param": "L",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wavelength",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "z0",
"type": null,
"docstring": null,
"docstring_tokens... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | _neutron_transmission_depth | <not_specific> | def _neutron_transmission_depth(material, wavelength):
"""
Calculate the penetration depth for a material with a given neutron
wavelength
Parameters
----------
material : pt.Formula
wavelength : float
neutron wavelength in Angstrom
"""
import periodictable as pt
return... |
Calculate the penetration depth for a material with a given neutron
wavelength
Parameters
----------
material : pt.Formula
wavelength : float
neutron wavelength in Angstrom
| Calculate the penetration depth for a material with a given neutron
wavelength
Parameters
wavelength : float
neutron wavelength in Angstrom | [
"Calculate",
"the",
"penetration",
"depth",
"for",
"a",
"material",
"with",
"a",
"given",
"neutron",
"wavelength",
"Parameters",
"wavelength",
":",
"float",
"neutron",
"wavelength",
"in",
"Angstrom"
] | def _neutron_transmission_depth(material, wavelength):
import periodictable as pt
return 10.0 * pt.neutron_scattering(material, wavelength=wavelength)[-1] | [
"def",
"_neutron_transmission_depth",
"(",
"material",
",",
"wavelength",
")",
":",
"import",
"periodictable",
"as",
"pt",
"return",
"10.0",
"*",
"pt",
".",
"neutron_scattering",
"(",
"material",
",",
"wavelength",
"=",
"wavelength",
")",
"[",
"-",
"1",
"]"
] | Calculate the penetration depth for a material with a given neutron
wavelength | [
"Calculate",
"the",
"penetration",
"depth",
"for",
"a",
"material",
"with",
"a",
"given",
"neutron",
"wavelength"
] | [
"\"\"\"\n Calculate the penetration depth for a material with a given neutron\n wavelength\n\n Parameters\n ----------\n material : pt.Formula\n\n wavelength : float\n neutron wavelength in Angstrom\n \"\"\""
] | [
{
"param": "material",
"type": null
},
{
"param": "wavelength",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "material",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wavelength",
"type": null,
"docstring": null,
"docstring_... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | neutron_transmission | <not_specific> | def neutron_transmission(formula, density, wavelength, thickness):
"""
Calculates the transmission of neutrons through a material.
Includes absorption + scattering (coherent+incoherent) cross sections.
Parameters
----------
formula : str
Chemical formula of the material.
density : f... |
Calculates the transmission of neutrons through a material.
Includes absorption + scattering (coherent+incoherent) cross sections.
Parameters
----------
formula : str
Chemical formula of the material.
density : float
material density in g/cm^3
wavelength : float, np.ndarray... | Calculates the transmission of neutrons through a material.
Includes absorption + scattering (coherent+incoherent) cross sections.
Parameters
formula : str
Chemical formula of the material.
density : float
material density in g/cm^3
wavelength : float, np.ndarray
wavelength of neutron in Angstrom
thickness : float
th... | [
"Calculates",
"the",
"transmission",
"of",
"neutrons",
"through",
"a",
"material",
".",
"Includes",
"absorption",
"+",
"scattering",
"(",
"coherent",
"+",
"incoherent",
")",
"cross",
"sections",
".",
"Parameters",
"formula",
":",
"str",
"Chemical",
"formula",
"o... | def neutron_transmission(formula, density, wavelength, thickness):
import periodictable as pt
material = pt.formula(formula, density=density)
_depth_fn = np.vectorize(_neutron_transmission_depth, excluded={0})
depths = _depth_fn(material, wavelength)
transmission = np.exp(-(thickness / depths))
... | [
"def",
"neutron_transmission",
"(",
"formula",
",",
"density",
",",
"wavelength",
",",
"thickness",
")",
":",
"import",
"periodictable",
"as",
"pt",
"material",
"=",
"pt",
".",
"formula",
"(",
"formula",
",",
"density",
"=",
"density",
")",
"_depth_fn",
"=",... | Calculates the transmission of neutrons through a material. | [
"Calculates",
"the",
"transmission",
"of",
"neutrons",
"through",
"a",
"material",
"."
] | [
"\"\"\"\n Calculates the transmission of neutrons through a material.\n Includes absorption + scattering (coherent+incoherent) cross sections.\n\n Parameters\n ----------\n formula : str\n Chemical formula of the material.\n density : float\n material density in g/cm^3\n wavelengt... | [
{
"param": "formula",
"type": null
},
{
"param": "density",
"type": null
},
{
"param": "wavelength",
"type": null
},
{
"param": "thickness",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "formula",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "density",
"type": null,
"docstring": null,
"docstring_toke... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | penetration_depth | <not_specific> | def penetration_depth(qq, rho):
"""
Calculates the penetration depth of a neutron/xray beam
Parameters
----------
qq: float
Q values to calculate the penetration depth at
rho: float or complex
Complex SLD of material
Returns
-------
penetration_depth: float
"""
... |
Calculates the penetration depth of a neutron/xray beam
Parameters
----------
qq: float
Q values to calculate the penetration depth at
rho: float or complex
Complex SLD of material
Returns
-------
penetration_depth: float
| Calculates the penetration depth of a neutron/xray beam
Parameters
float
Q values to calculate the penetration depth at
rho: float or complex
Complex SLD of material
Returns
float | [
"Calculates",
"the",
"penetration",
"depth",
"of",
"a",
"neutron",
"/",
"xray",
"beam",
"Parameters",
"float",
"Q",
"values",
"to",
"calculate",
"the",
"penetration",
"depth",
"at",
"rho",
":",
"float",
"or",
"complex",
"Complex",
"SLD",
"of",
"material",
"R... | def penetration_depth(qq, rho):
kk = 0.25 * qq ** 2.0
kk -= 4 * np.pi * rho
temp = np.sqrt(kk + 0j)
return np.abs(1 / temp.imag) | [
"def",
"penetration_depth",
"(",
"qq",
",",
"rho",
")",
":",
"kk",
"=",
"0.25",
"*",
"qq",
"**",
"2.0",
"kk",
"-=",
"4",
"*",
"np",
".",
"pi",
"*",
"rho",
"temp",
"=",
"np",
".",
"sqrt",
"(",
"kk",
"+",
"0j",
")",
"return",
"np",
".",
"abs",
... | Calculates the penetration depth of a neutron/xray beam
Parameters | [
"Calculates",
"the",
"penetration",
"depth",
"of",
"a",
"neutron",
"/",
"xray",
"beam",
"Parameters"
] | [
"\"\"\"\n Calculates the penetration depth of a neutron/xray beam\n\n Parameters\n ----------\n qq: float\n Q values to calculate the penetration depth at\n rho: float or complex\n Complex SLD of material\n\n Returns\n -------\n penetration_depth: float\n \"\"\""
] | [
{
"param": "qq",
"type": null
},
{
"param": "rho",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "qq",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rho",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | beamfrac | <not_specific> | def beamfrac(FWHM, length, angle):
"""
Calculate the beam fraction intercepted by a sample.
Parameters
----------
FWHM: float
The FWHM of the beam height
length: float
Length of the sample in mm
angle: float
Angle that the sample makes w.r.t the beam (degrees)
R... |
Calculate the beam fraction intercepted by a sample.
Parameters
----------
FWHM: float
The FWHM of the beam height
length: float
Length of the sample in mm
angle: float
Angle that the sample makes w.r.t the beam (degrees)
Returns
-------
beamfrac: float
... | Calculate the beam fraction intercepted by a sample.
Parameters
float
The FWHM of the beam height
length: float
Length of the sample in mm
angle: float
Angle that the sample makes w.r.t the beam (degrees)
Returns
float
The fraction of the beam that intercepts the sample | [
"Calculate",
"the",
"beam",
"fraction",
"intercepted",
"by",
"a",
"sample",
".",
"Parameters",
"float",
"The",
"FWHM",
"of",
"the",
"beam",
"height",
"length",
":",
"float",
"Length",
"of",
"the",
"sample",
"in",
"mm",
"angle",
":",
"float",
"Angle",
"that... | def beamfrac(FWHM, length, angle):
height_of_sample = length * np.sin(np.radians(angle))
beam_sd = FWHM / 2 / np.sqrt(2 * np.log(2))
probability = 2.0 * (
stats.norm.cdf(height_of_sample / 2.0 / beam_sd) - 0.5
)
return probability | [
"def",
"beamfrac",
"(",
"FWHM",
",",
"length",
",",
"angle",
")",
":",
"height_of_sample",
"=",
"length",
"*",
"np",
".",
"sin",
"(",
"np",
".",
"radians",
"(",
"angle",
")",
")",
"beam_sd",
"=",
"FWHM",
"/",
"2",
"/",
"np",
".",
"sqrt",
"(",
"2"... | Calculate the beam fraction intercepted by a sample. | [
"Calculate",
"the",
"beam",
"fraction",
"intercepted",
"by",
"a",
"sample",
"."
] | [
"\"\"\"\n Calculate the beam fraction intercepted by a sample.\n\n Parameters\n ----------\n FWHM: float\n The FWHM of the beam height\n length: float\n Length of the sample in mm\n angle: float\n Angle that the sample makes w.r.t the beam (degrees)\n\n Returns\n -------... | [
{
"param": "FWHM",
"type": null
},
{
"param": "length",
"type": null
},
{
"param": "angle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "FWHM",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": null,
"docstring": null,
"docstring_tokens":... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | beamfrackernel | <not_specific> | def beamfrackernel(kernelx, kernely, length, angle):
"""
The beam fraction intercepted by a sample, used for calculating footprints.
Parameters
----------
kernelx: array-like
x axis for the probability kernel
kernely: array-like
probability kernel describing the intensity distri... |
The beam fraction intercepted by a sample, used for calculating footprints.
Parameters
----------
kernelx: array-like
x axis for the probability kernel
kernely: array-like
probability kernel describing the intensity distribution of the beam
length: float
length of the s... | The beam fraction intercepted by a sample, used for calculating footprints.
Parameters
array-like
x axis for the probability kernel
kernely: array-like
probability kernel describing the intensity distribution of the beam
length: float
length of the sample
angle: float
angle of incidence (degrees)
Returns
float
The f... | [
"The",
"beam",
"fraction",
"intercepted",
"by",
"a",
"sample",
"used",
"for",
"calculating",
"footprints",
".",
"Parameters",
"array",
"-",
"like",
"x",
"axis",
"for",
"the",
"probability",
"kernel",
"kernely",
":",
"array",
"-",
"like",
"probability",
"kernel... | def beamfrackernel(kernelx, kernely, length, angle):
height_of_sample = length * np.sin(np.radians(angle))
total = integrate.simps(kernely, kernelx)
lowlimit = np.where(-height_of_sample / 2.0 >= kernelx)[0][-1]
hilimit = np.where(height_of_sample / 2.0 <= kernelx)[0][0]
area = integrate.simps(
... | [
"def",
"beamfrackernel",
"(",
"kernelx",
",",
"kernely",
",",
"length",
",",
"angle",
")",
":",
"height_of_sample",
"=",
"length",
"*",
"np",
".",
"sin",
"(",
"np",
".",
"radians",
"(",
"angle",
")",
")",
"total",
"=",
"integrate",
".",
"simps",
"(",
... | The beam fraction intercepted by a sample, used for calculating footprints. | [
"The",
"beam",
"fraction",
"intercepted",
"by",
"a",
"sample",
"used",
"for",
"calculating",
"footprints",
"."
] | [
"\"\"\"\n The beam fraction intercepted by a sample, used for calculating footprints.\n\n Parameters\n ----------\n kernelx: array-like\n x axis for the probability kernel\n kernely: array-like\n probability kernel describing the intensity distribution of the beam\n length: float\n ... | [
{
"param": "kernelx",
"type": null
},
{
"param": "kernely",
"type": null
},
{
"param": "length",
"type": null
},
{
"param": "angle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "kernelx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kernely",
"type": null,
"docstring": null,
"docstring_toke... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | height_of_beam_after_dx | <not_specific> | def height_of_beam_after_dx(d1, d2, L12, distance):
"""
Calculate the total widths of beam a given distance away from a collimation
slit.
if distance >= 0, then it's taken to be the distance after d2.
if distance < 0, then it's taken to be the distance before d1.
Parameters
----------
... |
Calculate the total widths of beam a given distance away from a collimation
slit.
if distance >= 0, then it's taken to be the distance after d2.
if distance < 0, then it's taken to be the distance before d1.
Parameters
----------
d1: float
opening of first collimation slit
d2:... | Calculate the total widths of beam a given distance away from a collimation
slit.
if distance >= 0, then it's taken to be the distance after d2.
if distance < 0, then it's taken to be the distance before d1.
Parameters
float
opening of first collimation slit
d2: float
opening of second collimation slit
L12: float
di... | [
"Calculate",
"the",
"total",
"widths",
"of",
"beam",
"a",
"given",
"distance",
"away",
"from",
"a",
"collimation",
"slit",
".",
"if",
"distance",
">",
"=",
"0",
"then",
"it",
"'",
"s",
"taken",
"to",
"be",
"the",
"distance",
"after",
"d2",
".",
"if",
... | def height_of_beam_after_dx(d1, d2, L12, distance):
alpha = (d1 + d2) / 2.0 / L12
beta = abs(d1 - d2) / 2.0 / L12
if distance >= 0:
return (beta * distance * 2) + d2, (alpha * distance * 2) + d2
else:
return (
(beta * abs(distance) * 2) + d1,
(alpha * abs(distance... | [
"def",
"height_of_beam_after_dx",
"(",
"d1",
",",
"d2",
",",
"L12",
",",
"distance",
")",
":",
"alpha",
"=",
"(",
"d1",
"+",
"d2",
")",
"/",
"2.0",
"/",
"L12",
"beta",
"=",
"abs",
"(",
"d1",
"-",
"d2",
")",
"/",
"2.0",
"/",
"L12",
"if",
"distan... | Calculate the total widths of beam a given distance away from a collimation
slit. | [
"Calculate",
"the",
"total",
"widths",
"of",
"beam",
"a",
"given",
"distance",
"away",
"from",
"a",
"collimation",
"slit",
"."
] | [
"\"\"\"\n Calculate the total widths of beam a given distance away from a collimation\n slit.\n\n if distance >= 0, then it's taken to be the distance after d2.\n if distance < 0, then it's taken to be the distance before d1.\n\n Parameters\n ----------\n d1: float\n opening of first col... | [
{
"param": "d1",
"type": null
},
{
"param": "d2",
"type": null
},
{
"param": "L12",
"type": null
},
{
"param": "distance",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "d1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "d2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | actual_footprint | <not_specific> | def actual_footprint(d1, d2, L12, L2S, angle):
"""
Calculate the actual footprint on a reflectivity sample.
Parameters
----------
d1: float
opening of first collimation slit
d2: float
opening of second collimation slit
L12: float
distance between first and second col... |
Calculate the actual footprint on a reflectivity sample.
Parameters
----------
d1: float
opening of first collimation slit
d2: float
opening of second collimation slit
L12: float
distance between first and second collimation slits
L2S: float
distance from se... | Calculate the actual footprint on a reflectivity sample.
Parameters
float
opening of first collimation slit
d2: float
opening of second collimation slit
L12: float
distance between first and second collimation slits
L2S: float
distance from second collimation slit to sample
angle: float
angle of incidence of sample (d... | [
"Calculate",
"the",
"actual",
"footprint",
"on",
"a",
"reflectivity",
"sample",
".",
"Parameters",
"float",
"opening",
"of",
"first",
"collimation",
"slit",
"d2",
":",
"float",
"opening",
"of",
"second",
"collimation",
"slit",
"L12",
":",
"float",
"distance",
... | def actual_footprint(d1, d2, L12, L2S, angle):
umbra, penumbra = height_of_beam_after_dx(d1, d2, L12, L2S)
return umbra / np.radians(angle), penumbra / np.radians(angle) | [
"def",
"actual_footprint",
"(",
"d1",
",",
"d2",
",",
"L12",
",",
"L2S",
",",
"angle",
")",
":",
"umbra",
",",
"penumbra",
"=",
"height_of_beam_after_dx",
"(",
"d1",
",",
"d2",
",",
"L12",
",",
"L2S",
")",
"return",
"umbra",
"/",
"np",
".",
"radians"... | Calculate the actual footprint on a reflectivity sample. | [
"Calculate",
"the",
"actual",
"footprint",
"on",
"a",
"reflectivity",
"sample",
"."
] | [
"\"\"\"\n Calculate the actual footprint on a reflectivity sample.\n\n Parameters\n ----------\n d1: float\n opening of first collimation slit\n d2: float\n opening of second collimation slit\n L12: float\n distance between first and second collimation slits\n L2S: float\n ... | [
{
"param": "d1",
"type": null
},
{
"param": "d2",
"type": null
},
{
"param": "L12",
"type": null
},
{
"param": "L2S",
"type": null
},
{
"param": "angle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "d1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "d2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
f20d82bed3f0ecea0f3335765a99772f8032d11a | dcortie/refnx | refnx/util/general.py | [
"BSD-3-Clause"
] | Python | slit_optimiser | <not_specific> | def slit_optimiser(
footprint,
resolution,
angle=1.0,
L12=2859.5,
L2S=180,
LS3=290.5,
LSD=2500,
verbose=True,
):
"""
Optimise slit settings for a given angular resolution, and a given
footprint.
footprint: float
maximum footprint onto sample (mm)
resolution: ... |
Optimise slit settings for a given angular resolution, and a given
footprint.
footprint: float
maximum footprint onto sample (mm)
resolution: float
fractional dtheta/theta resolution (FWHM)
angle: float, optional
angle of incidence in degrees
| Optimise slit settings for a given angular resolution, and a given
footprint.
float
maximum footprint onto sample (mm)
resolution: float
fractional dtheta/theta resolution (FWHM)
angle: float, optional
angle of incidence in degrees | [
"Optimise",
"slit",
"settings",
"for",
"a",
"given",
"angular",
"resolution",
"and",
"a",
"given",
"footprint",
".",
"float",
"maximum",
"footprint",
"onto",
"sample",
"(",
"mm",
")",
"resolution",
":",
"float",
"fractional",
"dtheta",
"/",
"theta",
"resolutio... | def slit_optimiser(
footprint,
resolution,
angle=1.0,
L12=2859.5,
L2S=180,
LS3=290.5,
LSD=2500,
verbose=True,
):
if verbose:
print("_____________________________________________")
print("FOOTPRINT calculator - Andrew Nelson 2013")
print("INPUT")
print(... | [
"def",
"slit_optimiser",
"(",
"footprint",
",",
"resolution",
",",
"angle",
"=",
"1.0",
",",
"L12",
"=",
"2859.5",
",",
"L2S",
"=",
"180",
",",
"LS3",
"=",
"290.5",
",",
"LSD",
"=",
"2500",
",",
"verbose",
"=",
"True",
",",
")",
":",
"if",
"verbose... | Optimise slit settings for a given angular resolution, and a given
footprint. | [
"Optimise",
"slit",
"settings",
"for",
"a",
"given",
"angular",
"resolution",
"and",
"a",
"given",
"footprint",
"."
] | [
"\"\"\"\n Optimise slit settings for a given angular resolution, and a given\n footprint.\n\n footprint: float\n maximum footprint onto sample (mm)\n resolution: float\n fractional dtheta/theta resolution (FWHM)\n angle: float, optional\n angle of incidence in degrees\n \"\"\"... | [
{
"param": "footprint",
"type": null
},
{
"param": "resolution",
"type": null
},
{
"param": "angle",
"type": null
},
{
"param": "L12",
"type": null
},
{
"param": "L2S",
"type": null
},
{
"param": "LS3",
"type": null
},
{
"param": "LSD",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "footprint",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resolution",
"type": null,
"docstring": null,
"docstring... |
ecfd20b5525b8d61f843c71715bcea135b586c78 | dcortie/refnx | refnx/reflect/spline.py | [
"BSD-3-Clause"
] | Python | slabs | <not_specific> | def slabs(self, structure=None):
"""
Slab representation of the spline, as an array
Parameters
----------
structure : refnx.reflect.Structure
The Structure hosting this Component
"""
if structure is None:
raise ValueError("Spline.slabs() r... |
Slab representation of the spline, as an array
Parameters
----------
structure : refnx.reflect.Structure
The Structure hosting this Component
| Slab representation of the spline, as an array
Parameters
structure : refnx.reflect.Structure
The Structure hosting this Component | [
"Slab",
"representation",
"of",
"the",
"spline",
"as",
"an",
"array",
"Parameters",
"structure",
":",
"refnx",
".",
"reflect",
".",
"Structure",
"The",
"Structure",
"hosting",
"this",
"Component"
] | def slabs(self, structure=None):
if structure is None:
raise ValueError("Spline.slabs() requires a valid Structure")
num_slabs = np.ceil(float(self.extent) / self.microslab_max_thickness)
slab_thick = float(self.extent / num_slabs)
slabs = np.zeros((int(num_slabs), 5))
... | [
"def",
"slabs",
"(",
"self",
",",
"structure",
"=",
"None",
")",
":",
"if",
"structure",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Spline.slabs() requires a valid Structure\"",
")",
"num_slabs",
"=",
"np",
".",
"ceil",
"(",
"float",
"(",
"self",
".",... | Slab representation of the spline, as an array
Parameters | [
"Slab",
"representation",
"of",
"the",
"spline",
"as",
"an",
"array",
"Parameters"
] | [
"\"\"\"\n Slab representation of the spline, as an array\n\n Parameters\n ----------\n structure : refnx.reflect.Structure\n The Structure hosting this Component\n \"\"\"",
"# give last slab a miniscule roughness so it doesn't get contracted"
] | [
{
"param": "self",
"type": null
},
{
"param": "structure",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "structure",
"type": null,
"docstring": null,
"docstring_token... |
b920f31baac23322f160fd57f6f6cc458da4a8f6 | jabesga/minecraft-guardianbot | server/server.py | [
"MIT"
] | Python | sendMessage | null | def sendMessage(chat_id, text):
"""Bot sends a message to provided chat_id with the provided text"""
response = requests.post(
url='https://api.telegram.org/bot{0}/{1}'.format(BOT_TOKEN, 'sendMessage'),
data={'chat_id': chat_id, 'text': text}
).json() | Bot sends a message to provided chat_id with the provided text | Bot sends a message to provided chat_id with the provided text | [
"Bot",
"sends",
"a",
"message",
"to",
"provided",
"chat_id",
"with",
"the",
"provided",
"text"
] | def sendMessage(chat_id, text):
response = requests.post(
url='https://api.telegram.org/bot{0}/{1}'.format(BOT_TOKEN, 'sendMessage'),
data={'chat_id': chat_id, 'text': text}
).json() | [
"def",
"sendMessage",
"(",
"chat_id",
",",
"text",
")",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
"=",
"'https://api.telegram.org/bot{0}/{1}'",
".",
"format",
"(",
"BOT_TOKEN",
",",
"'sendMessage'",
")",
",",
"data",
"=",
"{",
"'chat_id'",
"... | Bot sends a message to provided chat_id with the provided text | [
"Bot",
"sends",
"a",
"message",
"to",
"provided",
"chat_id",
"with",
"the",
"provided",
"text"
] | [
"\"\"\"Bot sends a message to provided chat_id with the provided text\"\"\""
] | [
{
"param": "chat_id",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chat_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens"... |
dd701c75ddf86180460db9c208ef7588722b69d2 | jabesga/minecraft-guardianbot | bot/bot.py | [
"MIT"
] | Python | sendMessage | null | def sendMessage(self, chat_id, text):
"""Bot sends a message to provided chat_id with the provided text"""
response = requests.post(
url='https://api.telegram.org/bot{0}/{1}'.format(self.token, 'sendMessage'),
data={'chat_id': chat_id, 'text': text}
).json() | Bot sends a message to provided chat_id with the provided text | Bot sends a message to provided chat_id with the provided text | [
"Bot",
"sends",
"a",
"message",
"to",
"provided",
"chat_id",
"with",
"the",
"provided",
"text"
] | def sendMessage(self, chat_id, text):
response = requests.post(
url='https://api.telegram.org/bot{0}/{1}'.format(self.token, 'sendMessage'),
data={'chat_id': chat_id, 'text': text}
).json() | [
"def",
"sendMessage",
"(",
"self",
",",
"chat_id",
",",
"text",
")",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
"=",
"'https://api.telegram.org/bot{0}/{1}'",
".",
"format",
"(",
"self",
".",
"token",
",",
"'sendMessage'",
")",
",",
"data",
... | Bot sends a message to provided chat_id with the provided text | [
"Bot",
"sends",
"a",
"message",
"to",
"provided",
"chat_id",
"with",
"the",
"provided",
"text"
] | [
"\"\"\"Bot sends a message to provided chat_id with the provided text\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "chat_id",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chat_id",
"type": null,
"docstring": null,
"docstring_tokens"... |
dd701c75ddf86180460db9c208ef7588722b69d2 | jabesga/minecraft-guardianbot | bot/bot.py | [
"MIT"
] | Python | checkUpdates | <not_specific> | def checkUpdates(self):
"""Check new messages received by the bot"""
response = requests.post(
url='https://api.telegram.org/bot{0}/{1}'.format(self.token, 'getUpdates'),
data={'offset': self.update_id}
).json()
if response['ok'] == True:
if ... | Check new messages received by the bot | Check new messages received by the bot | [
"Check",
"new",
"messages",
"received",
"by",
"the",
"bot"
] | def checkUpdates(self):
response = requests.post(
url='https://api.telegram.org/bot{0}/{1}'.format(self.token, 'getUpdates'),
data={'offset': self.update_id}
).json()
if response['ok'] == True:
if response['result']:
if self.update_id == None:
... | [
"def",
"checkUpdates",
"(",
"self",
")",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"url",
"=",
"'https://api.telegram.org/bot{0}/{1}'",
".",
"format",
"(",
"self",
".",
"token",
",",
"'getUpdates'",
")",
",",
"data",
"=",
"{",
"'offset'",
":",
"s... | Check new messages received by the bot | [
"Check",
"new",
"messages",
"received",
"by",
"the",
"bot"
] | [
"\"\"\"Check new messages received by the bot\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b4df82ffb269a7b68117d032359cbc8fa2f09c2d | xfhy/x-toolset | lib/gittoc.py | [
"Apache-2.0"
] | Python | detectHeadLines | <not_specific> | def detectHeadLines(f):
'''detact headline and return inserted string.
params:
f: Markdown file
'''
f.seek(0)
insert_str = ""
org_str = ""
last_status = -1
c_status = -1
headline_counter = 0
iscode = False
# 处理目录内容
for line in f.readlines():
# 如果是代码块
... | detact headline and return inserted string.
params:
f: Markdown file
| detact headline and return inserted string.
params:
f: Markdown file | [
"detact",
"headline",
"and",
"return",
"inserted",
"string",
".",
"params",
":",
"f",
":",
"Markdown",
"file"
] | def detectHeadLines(f):
f.seek(0)
insert_str = ""
org_str = ""
last_status = -1
c_status = -1
headline_counter = 0
iscode = False
for line in f.readlines():
if(line[:3] == '```'):
iscode = not iscode
if not iscode:
temp_line = line.strip(' ')
... | [
"def",
"detectHeadLines",
"(",
"f",
")",
":",
"f",
".",
"seek",
"(",
"0",
")",
"insert_str",
"=",
"\"\"",
"org_str",
"=",
"\"\"",
"last_status",
"=",
"-",
"1",
"c_status",
"=",
"-",
"1",
"headline_counter",
"=",
"0",
"iscode",
"=",
"False",
"for",
"l... | detact headline and return inserted string. | [
"detact",
"headline",
"and",
"return",
"inserted",
"string",
"."
] | [
"'''detact headline and return inserted string.\n params:\n f: Markdown file\n '''",
"# 处理目录内容",
"# 如果是代码块",
"# fix code indent bug and fix other indentation bug. 2020/7/3 缩进问题",
"# '## 标题' -> ls[0]:'##' ls[1]:'标题'",
"#header_number_array[c_status] = header_number_array[c_status] + 1",
"# ... | [
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | is_connected | <not_specific> | def is_connected(self):
"""Indicate if the WebSocket connection is open or not.
Returns:
bool: True if WebSocket is connected, False otherwise.
"""
return self.connector and self.connector.state == 'connected' | Indicate if the WebSocket connection is open or not.
Returns:
bool: True if WebSocket is connected, False otherwise.
| Indicate if the WebSocket connection is open or not. | [
"Indicate",
"if",
"the",
"WebSocket",
"connection",
"is",
"open",
"or",
"not",
"."
] | def is_connected(self):
return self.connector and self.connector.state == 'connected' | [
"def",
"is_connected",
"(",
"self",
")",
":",
"return",
"self",
".",
"connector",
"and",
"self",
".",
"connector",
".",
"state",
"==",
"'connected'"
] | Indicate if the WebSocket connection is open or not. | [
"Indicate",
"if",
"the",
"WebSocket",
"connection",
"is",
"open",
"or",
"not",
"."
] | [
"\"\"\"Indicate if the WebSocket connection is open or not.\n\n Returns:\n bool: True if WebSocket is connected, False otherwise.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "True if WebSocket is connected, False otherwise.",
"docstring_tokens": [
"True",
"if",
"WebSocket",
"is",
"connected",
"False",
"otherwise",
"."
],
"type": "bool"
}
],
"raises": [],
"pa... |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | manager | <not_specific> | def manager(self):
"""Get an instance of the event loop manager for this factory."""
if not self._manager:
self._manager = TwistedEventLoopManager()
return self._manager | Get an instance of the event loop manager for this factory. | Get an instance of the event loop manager for this factory. | [
"Get",
"an",
"instance",
"of",
"the",
"event",
"loop",
"manager",
"for",
"this",
"factory",
"."
] | def manager(self):
if not self._manager:
self._manager = TwistedEventLoopManager()
return self._manager | [
"def",
"manager",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_manager",
":",
"self",
".",
"_manager",
"=",
"TwistedEventLoopManager",
"(",
")",
"return",
"self",
".",
"_manager"
] | Get an instance of the event loop manager for this factory. | [
"Get",
"an",
"instance",
"of",
"the",
"event",
"loop",
"manager",
"for",
"this",
"factory",
"."
] | [
"\"\"\"Get an instance of the event loop manager for this factory.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | run | <not_specific> | def run(self):
"""Kick-starts a non-blocking event loop.
This implementation starts the Twisted Reactor
on a separate thread to avoid blocking."""
if reactor.running:
LOGGER.warn('Twisted reactor is already running')
return
self._thread = threading.Thre... | Kick-starts a non-blocking event loop.
This implementation starts the Twisted Reactor
on a separate thread to avoid blocking. | Kick-starts a non-blocking event loop.
This implementation starts the Twisted Reactor
on a separate thread to avoid blocking. | [
"Kick",
"-",
"starts",
"a",
"non",
"-",
"blocking",
"event",
"loop",
".",
"This",
"implementation",
"starts",
"the",
"Twisted",
"Reactor",
"on",
"a",
"separate",
"thread",
"to",
"avoid",
"blocking",
"."
] | def run(self):
if reactor.running:
LOGGER.warn('Twisted reactor is already running')
return
self._thread = threading.Thread(target=reactor.run, args=(False,))
self._thread.daemon = True
self._thread.start() | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"reactor",
".",
"running",
":",
"LOGGER",
".",
"warn",
"(",
"'Twisted reactor is already running'",
")",
"return",
"self",
".",
"_thread",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"reactor",
".",
"run"... | Kick-starts a non-blocking event loop. | [
"Kick",
"-",
"starts",
"a",
"non",
"-",
"blocking",
"event",
"loop",
"."
] | [
"\"\"\"Kick-starts a non-blocking event loop.\n\n This implementation starts the Twisted Reactor\n on a separate thread to avoid blocking.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | run_forever | null | def run_forever(self):
"""Kick-starts the main event loop of the ROS client.
This implementation relies on Twisted Reactors
to control the event loop."""
reactor.run() | Kick-starts the main event loop of the ROS client.
This implementation relies on Twisted Reactors
to control the event loop. | Kick-starts the main event loop of the ROS client.
This implementation relies on Twisted Reactors
to control the event loop. | [
"Kick",
"-",
"starts",
"the",
"main",
"event",
"loop",
"of",
"the",
"ROS",
"client",
".",
"This",
"implementation",
"relies",
"on",
"Twisted",
"Reactors",
"to",
"control",
"the",
"event",
"loop",
"."
] | def run_forever(self):
reactor.run() | [
"def",
"run_forever",
"(",
"self",
")",
":",
"reactor",
".",
"run",
"(",
")"
] | Kick-starts the main event loop of the ROS client. | [
"Kick",
"-",
"starts",
"the",
"main",
"event",
"loop",
"of",
"the",
"ROS",
"client",
"."
] | [
"\"\"\"Kick-starts the main event loop of the ROS client.\n\n This implementation relies on Twisted Reactors\n to control the event loop.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | call_later | null | def call_later(self, delay, callback):
"""Call the given function after a certain period of time has passed.
Args:
delay (:obj:`int`): Number of seconds to wait before invoking the callback.
callback (:obj:`callable`): Callable function to be invoked when the delay has elapsed.
... | Call the given function after a certain period of time has passed.
Args:
delay (:obj:`int`): Number of seconds to wait before invoking the callback.
callback (:obj:`callable`): Callable function to be invoked when the delay has elapsed.
| Call the given function after a certain period of time has passed. | [
"Call",
"the",
"given",
"function",
"after",
"a",
"certain",
"period",
"of",
"time",
"has",
"passed",
"."
] | def call_later(self, delay, callback):
reactor.callLater(delay, callback) | [
"def",
"call_later",
"(",
"self",
",",
"delay",
",",
"callback",
")",
":",
"reactor",
".",
"callLater",
"(",
"delay",
",",
"callback",
")"
] | Call the given function after a certain period of time has passed. | [
"Call",
"the",
"given",
"function",
"after",
"a",
"certain",
"period",
"of",
"time",
"has",
"passed",
"."
] | [
"\"\"\"Call the given function after a certain period of time has passed.\n\n Args:\n delay (:obj:`int`): Number of seconds to wait before invoking the callback.\n callback (:obj:`callable`): Callable function to be invoked when the delay has elapsed.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "delay",
"type": null
},
{
"param": "callback",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delay",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | call_in_thread | null | def call_in_thread(self, callback):
"""Call the given function on a thread.
Args:
callback (:obj:`callable`): Callable function to be invoked in a thread.
"""
reactor.callInThread(callback) | Call the given function on a thread.
Args:
callback (:obj:`callable`): Callable function to be invoked in a thread.
| Call the given function on a thread. | [
"Call",
"the",
"given",
"function",
"on",
"a",
"thread",
"."
] | def call_in_thread(self, callback):
reactor.callInThread(callback) | [
"def",
"call_in_thread",
"(",
"self",
",",
"callback",
")",
":",
"reactor",
".",
"callInThread",
"(",
"callback",
")"
] | Call the given function on a thread. | [
"Call",
"the",
"given",
"function",
"on",
"a",
"thread",
"."
] | [
"\"\"\"Call the given function on a thread.\n\n Args:\n callback (:obj:`callable`): Callable function to be invoked in a thread.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "callback",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "callback",
"type": null,
"docstring": null,
"docstring_tokens... |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | blocking_call_from_thread | <not_specific> | def blocking_call_from_thread(self, callback, timeout):
"""Call the given function from a thread, and wait for the result synchronously
for as long as the timeout will allow.
Args:
callback: Callable function to be invoked from the thread.
timeout (:obj: int): Number of ... | Call the given function from a thread, and wait for the result synchronously
for as long as the timeout will allow.
Args:
callback: Callable function to be invoked from the thread.
timeout (:obj: int): Number of seconds to wait for the response before
raising an ... | Call the given function from a thread, and wait for the result synchronously
for as long as the timeout will allow. | [
"Call",
"the",
"given",
"function",
"from",
"a",
"thread",
"and",
"wait",
"for",
"the",
"result",
"synchronously",
"for",
"as",
"long",
"as",
"the",
"timeout",
"will",
"allow",
"."
] | def blocking_call_from_thread(self, callback, timeout):
result_placeholder = defer.Deferred()
if timeout:
result_placeholder.addTimeout(timeout, reactor, onTimeoutCancel=self.raise_timeout_exception)
return threads.blockingCallFromThread(reactor, callback, result_placeholder) | [
"def",
"blocking_call_from_thread",
"(",
"self",
",",
"callback",
",",
"timeout",
")",
":",
"result_placeholder",
"=",
"defer",
".",
"Deferred",
"(",
")",
"if",
"timeout",
":",
"result_placeholder",
".",
"addTimeout",
"(",
"timeout",
",",
"reactor",
",",
"onTi... | Call the given function from a thread, and wait for the result synchronously
for as long as the timeout will allow. | [
"Call",
"the",
"given",
"function",
"from",
"a",
"thread",
"and",
"wait",
"for",
"the",
"result",
"synchronously",
"for",
"as",
"long",
"as",
"the",
"timeout",
"will",
"allow",
"."
] | [
"\"\"\"Call the given function from a thread, and wait for the result synchronously\n for as long as the timeout will allow.\n\n Args:\n callback: Callable function to be invoked from the thread.\n timeout (:obj: int): Number of seconds to wait for the response before\n ... | [
{
"param": "self",
"type": null
},
{
"param": "callback",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": "The results from the callback, or a timeout exception.",
"docstring_tokens": [
"The",
"results",
"from",
"the",
"callback",
"or",
"a",
"timeout",
"exception",
"."
],
"type": null
... |
4c146cb428e7f7ff47e8babe52c8f55dd3e34c75 | chia-labradorsystems/roslibpy | src/roslibpy/comm/comm_autobahn.py | [
"MIT"
] | Python | terminate | null | def terminate(self):
"""Signals the termination of the main event loop."""
if reactor.running:
reactor.stop()
self._log_observer.stop() | Signals the termination of the main event loop. | Signals the termination of the main event loop. | [
"Signals",
"the",
"termination",
"of",
"the",
"main",
"event",
"loop",
"."
] | def terminate(self):
if reactor.running:
reactor.stop()
self._log_observer.stop() | [
"def",
"terminate",
"(",
"self",
")",
":",
"if",
"reactor",
".",
"running",
":",
"reactor",
".",
"stop",
"(",
")",
"self",
".",
"_log_observer",
".",
"stop",
"(",
")"
] | Signals the termination of the main event loop. | [
"Signals",
"the",
"termination",
"of",
"the",
"main",
"event",
"loop",
"."
] | [
"\"\"\"Signals the termination of the main event loop.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7734a395723604afec3f6d7c5fa67f4b8ccfd1f8 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | packets.py | [
"MIT"
] | Python | __get_gateway_route | <not_specific> | def __get_gateway_route(self):
"""Gets a usable route that points to a gateway from the
routing table. The value 0x0003 is defined at route.h in the
Linux Kernel userspace API."""
for route in self.__net_tables.routing_table:
if int(route['flags']) == 0x0003:
... | Gets a usable route that points to a gateway from the
routing table. The value 0x0003 is defined at route.h in the
Linux Kernel userspace API. | Gets a usable route that points to a gateway from the
routing table. The value 0x0003 is defined at route.h in the
Linux Kernel userspace API. | [
"Gets",
"a",
"usable",
"route",
"that",
"points",
"to",
"a",
"gateway",
"from",
"the",
"routing",
"table",
".",
"The",
"value",
"0x0003",
"is",
"defined",
"at",
"route",
".",
"h",
"in",
"the",
"Linux",
"Kernel",
"userspace",
"API",
"."
] | def __get_gateway_route(self):
for route in self.__net_tables.routing_table:
if int(route['flags']) == 0x0003:
return route
raise SystemExit('[!] Unable to find a usable route to the default '
'gateway. Check network settings and try again or '
... | [
"def",
"__get_gateway_route",
"(",
"self",
")",
":",
"for",
"route",
"in",
"self",
".",
"__net_tables",
".",
"routing_table",
":",
"if",
"int",
"(",
"route",
"[",
"'flags'",
"]",
")",
"==",
"0x0003",
":",
"return",
"route",
"raise",
"SystemExit",
"(",
"'... | Gets a usable route that points to a gateway from the
routing table. | [
"Gets",
"a",
"usable",
"route",
"that",
"points",
"to",
"a",
"gateway",
"from",
"the",
"routing",
"table",
"."
] | [
"\"\"\"Gets a usable route that points to a gateway from the\n routing table. The value 0x0003 is defined at route.h in the\n Linux Kernel userspace API.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7734a395723604afec3f6d7c5fa67f4b8ccfd1f8 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | packets.py | [
"MIT"
] | Python | __set_gateway_ip | str | def __set_gateway_ip(self, gateway_ip: str) -> str:
"""
Sets the gateway's IP address by converting its standard-sized,
native byte order hexadecimal representation stored in the
routing table to a string with the IPv4 address in
dotted-decimal notation.
Ex: From 'FE01A8C... |
Sets the gateway's IP address by converting its standard-sized,
native byte order hexadecimal representation stored in the
routing table to a string with the IPv4 address in
dotted-decimal notation.
Ex: From 'FE01A8C0' to '192.168.1.254'
| Sets the gateway's IP address by converting its standard-sized,
native byte order hexadecimal representation stored in the
routing table to a string with the IPv4 address in
dotted-decimal notation. | [
"Sets",
"the",
"gateway",
"'",
"s",
"IP",
"address",
"by",
"converting",
"its",
"standard",
"-",
"sized",
"native",
"byte",
"order",
"hexadecimal",
"representation",
"stored",
"in",
"the",
"routing",
"table",
"to",
"a",
"string",
"with",
"the",
"IPv4",
"addr... | def __set_gateway_ip(self, gateway_ip: str) -> str:
if gateway_ip is not None:
return gateway_ip
return inet_ntop(AF_INET,
pack("=L", int(self.__gateway_route['gateway'], 16))) | [
"def",
"__set_gateway_ip",
"(",
"self",
",",
"gateway_ip",
":",
"str",
")",
"->",
"str",
":",
"if",
"gateway_ip",
"is",
"not",
"None",
":",
"return",
"gateway_ip",
"return",
"inet_ntop",
"(",
"AF_INET",
",",
"pack",
"(",
"\"=L\"",
",",
"int",
"(",
"self"... | Sets the gateway's IP address by converting its standard-sized,
native byte order hexadecimal representation stored in the
routing table to a string with the IPv4 address in
dotted-decimal notation. | [
"Sets",
"the",
"gateway",
"'",
"s",
"IP",
"address",
"by",
"converting",
"its",
"standard",
"-",
"sized",
"native",
"byte",
"order",
"hexadecimal",
"representation",
"stored",
"in",
"the",
"routing",
"table",
"to",
"a",
"string",
"with",
"the",
"IPv4",
"addr... | [
"\"\"\"\n Sets the gateway's IP address by converting its standard-sized,\n native byte order hexadecimal representation stored in the\n routing table to a string with the IPv4 address in\n dotted-decimal notation.\n Ex: From 'FE01A8C0' to '192.168.1.254'\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "gateway_ip",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gateway_ip",
"type": "str",
"docstring": null,
"docstring_tok... |
7734a395723604afec3f6d7c5fa67f4b8ccfd1f8 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | packets.py | [
"MIT"
] | Python | __set_target_mac | str | def __set_target_mac(self, mac_addr: str) -> str:
"""
Sets the target's MAC address by sending it UDP datagrams with
empty byte strings to random ports contained in the ephemeral
port range (IETF RFC 6335) and then looking up its registered
MAC address in the attacker's ARP table... |
Sets the target's MAC address by sending it UDP datagrams with
empty byte strings to random ports contained in the ephemeral
port range (IETF RFC 6335) and then looking up its registered
MAC address in the attacker's ARP table.
| Sets the target's MAC address by sending it UDP datagrams with
empty byte strings to random ports contained in the ephemeral
port range and then looking up its registered
MAC address in the attacker's ARP table. | [
"Sets",
"the",
"target",
"'",
"s",
"MAC",
"address",
"by",
"sending",
"it",
"UDP",
"datagrams",
"with",
"empty",
"byte",
"strings",
"to",
"random",
"ports",
"contained",
"in",
"the",
"ephemeral",
"port",
"range",
"and",
"then",
"looking",
"up",
"its",
"reg... | def __set_target_mac(self, mac_addr: str) -> str:
if mac_addr is not None:
return mac_addr
with socket(AF_INET, SOCK_DGRAM) as sock:
while True:
for entry in self.__net_tables.arp_table:
if entry['ip_address'] == self.__target_ip:
... | [
"def",
"__set_target_mac",
"(",
"self",
",",
"mac_addr",
":",
"str",
")",
"->",
"str",
":",
"if",
"mac_addr",
"is",
"not",
"None",
":",
"return",
"mac_addr",
"with",
"socket",
"(",
"AF_INET",
",",
"SOCK_DGRAM",
")",
"as",
"sock",
":",
"while",
"True",
... | Sets the target's MAC address by sending it UDP datagrams with
empty byte strings to random ports contained in the ephemeral
port range (IETF RFC 6335) and then looking up its registered
MAC address in the attacker's ARP table. | [
"Sets",
"the",
"target",
"'",
"s",
"MAC",
"address",
"by",
"sending",
"it",
"UDP",
"datagrams",
"with",
"empty",
"byte",
"strings",
"to",
"random",
"ports",
"contained",
"in",
"the",
"ephemeral",
"port",
"range",
"(",
"IETF",
"RFC",
"6335",
")",
"and",
"... | [
"\"\"\"\n Sets the target's MAC address by sending it UDP datagrams with\n empty byte strings to random ports contained in the ephemeral\n port range (IETF RFC 6335) and then looking up its registered\n MAC address in the attacker's ARP table.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mac_addr",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mac_addr",
"type": "str",
"docstring": null,
"docstring_token... |
7734a395723604afec3f6d7c5fa67f4b8ccfd1f8 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | packets.py | [
"MIT"
] | Python | __set_attacker_mac | str | def __set_attacker_mac(self, mac_addr: str) -> str:
"""
Sets the attacker's MAC address to a random IEEE 802 compliant
address if 'disassociate' is set to True or queries the system
for the interface's address by temporarily binding to it.
"""
if mac_addr is not None:
... |
Sets the attacker's MAC address to a random IEEE 802 compliant
address if 'disassociate' is set to True or queries the system
for the interface's address by temporarily binding to it.
| Sets the attacker's MAC address to a random IEEE 802 compliant
address if 'disassociate' is set to True or queries the system
for the interface's address by temporarily binding to it. | [
"Sets",
"the",
"attacker",
"'",
"s",
"MAC",
"address",
"to",
"a",
"random",
"IEEE",
"802",
"compliant",
"address",
"if",
"'",
"disassociate",
"'",
"is",
"set",
"to",
"True",
"or",
"queries",
"the",
"system",
"for",
"the",
"interface",
"'",
"s",
"address"... | def __set_attacker_mac(self, mac_addr: str) -> str:
if mac_addr is not None:
return mac_addr
if self.__disassociate is True:
return self.__randomize_mac_addr()
with socket(AF_PACKET, SOCK_RAW) as sock:
sock.bind((self.interface, 0))
mac_address: by... | [
"def",
"__set_attacker_mac",
"(",
"self",
",",
"mac_addr",
":",
"str",
")",
"->",
"str",
":",
"if",
"mac_addr",
"is",
"not",
"None",
":",
"return",
"mac_addr",
"if",
"self",
".",
"__disassociate",
"is",
"True",
":",
"return",
"self",
".",
"__randomize_mac_... | Sets the attacker's MAC address to a random IEEE 802 compliant
address if 'disassociate' is set to True or queries the system
for the interface's address by temporarily binding to it. | [
"Sets",
"the",
"attacker",
"'",
"s",
"MAC",
"address",
"to",
"a",
"random",
"IEEE",
"802",
"compliant",
"address",
"if",
"'",
"disassociate",
"'",
"is",
"set",
"to",
"True",
"or",
"queries",
"the",
"system",
"for",
"the",
"interface",
"'",
"s",
"address"... | [
"\"\"\"\n Sets the attacker's MAC address to a random IEEE 802 compliant\n address if 'disassociate' is set to True or queries the system\n for the interface's address by temporarily binding to it.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "mac_addr",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mac_addr",
"type": "str",
"docstring": null,
"docstring_token... |
7734a395723604afec3f6d7c5fa67f4b8ccfd1f8 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | packets.py | [
"MIT"
] | Python | __bytes_to_mac_addr | str | def __bytes_to_mac_addr(addr: bytes) -> str:
"""
Converts a byte-string of length 6 bytes to IEEE 802 MAC address.
Ex: From b'\xceP\x9a\xcc\x8c\x9d' to 'ce:50:9a:cc:8c:9d'
"""
return ':'.join(format(octet, '02x') for octet in addr) |
Converts a byte-string of length 6 bytes to IEEE 802 MAC address.
Ex: From b'\xceP\x9a\xcc\x8c\x9d' to 'ce:50:9a:cc:8c:9d'
| Converts a byte-string of length 6 bytes to IEEE 802 MAC address. | [
"Converts",
"a",
"byte",
"-",
"string",
"of",
"length",
"6",
"bytes",
"to",
"IEEE",
"802",
"MAC",
"address",
"."
] | def __bytes_to_mac_addr(addr: bytes) -> str:
return ':'.join(format(octet, '02x') for octet in addr) | [
"def",
"__bytes_to_mac_addr",
"(",
"addr",
":",
"bytes",
")",
"->",
"str",
":",
"return",
"':'",
".",
"join",
"(",
"format",
"(",
"octet",
",",
"'02x'",
")",
"for",
"octet",
"in",
"addr",
")"
] | Converts a byte-string of length 6 bytes to IEEE 802 MAC address. | [
"Converts",
"a",
"byte",
"-",
"string",
"of",
"length",
"6",
"bytes",
"to",
"IEEE",
"802",
"MAC",
"address",
"."
] | [
"\"\"\"\n Converts a byte-string of length 6 bytes to IEEE 802 MAC address.\n Ex: From b'\\xceP\\x9a\\xcc\\x8c\\x9d' to 'ce:50:9a:cc:8c:9d'\n \"\"\""
] | [
{
"param": "addr",
"type": "bytes"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "addr",
"type": "bytes",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cf922acce53167b6e8fc9d525581d4cbfcc2598 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | protocols.py | [
"MIT"
] | Python | hdwr_addr_to_array | <not_specific> | def hdwr_addr_to_array(mac_addr: str):
"""
Converts a IEEE 802 MAC address to c_ubyte array of 6 bytes.
"""
mac_to_bytes = b''.join(bytes.fromhex(octet)
for octet in re.split('[:-]', mac_addr))
return (c_ubyte * 6)(*mac_to_bytes) |
Converts a IEEE 802 MAC address to c_ubyte array of 6 bytes.
| Converts a IEEE 802 MAC address to c_ubyte array of 6 bytes. | [
"Converts",
"a",
"IEEE",
"802",
"MAC",
"address",
"to",
"c_ubyte",
"array",
"of",
"6",
"bytes",
"."
] | def hdwr_addr_to_array(mac_addr: str):
mac_to_bytes = b''.join(bytes.fromhex(octet)
for octet in re.split('[:-]', mac_addr))
return (c_ubyte * 6)(*mac_to_bytes) | [
"def",
"hdwr_addr_to_array",
"(",
"mac_addr",
":",
"str",
")",
":",
"mac_to_bytes",
"=",
"b''",
".",
"join",
"(",
"bytes",
".",
"fromhex",
"(",
"octet",
")",
"for",
"octet",
"in",
"re",
".",
"split",
"(",
"'[:-]'",
",",
"mac_addr",
")",
")",
"return",
... | Converts a IEEE 802 MAC address to c_ubyte array of 6 bytes. | [
"Converts",
"a",
"IEEE",
"802",
"MAC",
"address",
"to",
"c_ubyte",
"array",
"of",
"6",
"bytes",
"."
] | [
"\"\"\"\n Converts a IEEE 802 MAC address to c_ubyte array of 6 bytes.\n \"\"\""
] | [
{
"param": "mac_addr",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mac_addr",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cf922acce53167b6e8fc9d525581d4cbfcc2598 | HectorTa1989/HecPy3-ARP-Cache-Poisoning-Tool | protocols.py | [
"MIT"
] | Python | proto_addr_to_array | <not_specific> | def proto_addr_to_array(proto_addr: str):
"""
Converts an IPv4 address string in dotted-decimal notation to a
c_ubyte array of 4 bytes.
"""
addr_to_bytes = inet_pton(AF_INET, proto_addr)
return (c_ubyte * 4)(*addr_to_bytes) |
Converts an IPv4 address string in dotted-decimal notation to a
c_ubyte array of 4 bytes.
| Converts an IPv4 address string in dotted-decimal notation to a
c_ubyte array of 4 bytes. | [
"Converts",
"an",
"IPv4",
"address",
"string",
"in",
"dotted",
"-",
"decimal",
"notation",
"to",
"a",
"c_ubyte",
"array",
"of",
"4",
"bytes",
"."
] | def proto_addr_to_array(proto_addr: str):
addr_to_bytes = inet_pton(AF_INET, proto_addr)
return (c_ubyte * 4)(*addr_to_bytes) | [
"def",
"proto_addr_to_array",
"(",
"proto_addr",
":",
"str",
")",
":",
"addr_to_bytes",
"=",
"inet_pton",
"(",
"AF_INET",
",",
"proto_addr",
")",
"return",
"(",
"c_ubyte",
"*",
"4",
")",
"(",
"*",
"addr_to_bytes",
")"
] | Converts an IPv4 address string in dotted-decimal notation to a
c_ubyte array of 4 bytes. | [
"Converts",
"an",
"IPv4",
"address",
"string",
"in",
"dotted",
"-",
"decimal",
"notation",
"to",
"a",
"c_ubyte",
"array",
"of",
"4",
"bytes",
"."
] | [
"\"\"\"\n Converts an IPv4 address string in dotted-decimal notation to a\n c_ubyte array of 4 bytes.\n \"\"\""
] | [
{
"param": "proto_addr",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "proto_addr",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3311069070145ca019a5cf1386abbbdfc540001 | kr6k3n/WaveRNN | utils/checkpoints.py | [
"MIT"
] | Python | restore_checkpoint | null | def restore_checkpoint(checkpoint_type: str, paths: Paths, model, optimizer, *,
name=None, create_if_missing=False):
"""Restores from a training session saved to disk.
NOTE: The optimizer's state is placed on the same device as it's model
parameters. Therefore, be sure you have done ... | Restores from a training session saved to disk.
NOTE: The optimizer's state is placed on the same device as it's model
parameters. Therefore, be sure you have done `model.to(device)` before
calling this method.
Args:
paths: Provides information about the different paths to use.
model:... | Restores from a training session saved to disk.
NOTE: The optimizer's state is placed on the same device as it's model
parameters. Therefore, be sure you have done `model.to(device)` before
calling this method. | [
"Restores",
"from",
"a",
"training",
"session",
"saved",
"to",
"disk",
".",
"NOTE",
":",
"The",
"optimizer",
"'",
"s",
"state",
"is",
"placed",
"on",
"the",
"same",
"device",
"as",
"it",
"'",
"s",
"model",
"parameters",
".",
"Therefore",
"be",
"sure",
... | def restore_checkpoint(checkpoint_type: str, paths: Paths, model, optimizer, *,
name=None, create_if_missing=False):
weights_path, optim_path, checkpoint_path = \
get_checkpoint_paths(checkpoint_type, paths)
if name:
path_dict = {
'w': checkpoint_path/f'{name}_... | [
"def",
"restore_checkpoint",
"(",
"checkpoint_type",
":",
"str",
",",
"paths",
":",
"Paths",
",",
"model",
",",
"optimizer",
",",
"*",
",",
"name",
"=",
"None",
",",
"create_if_missing",
"=",
"False",
")",
":",
"weights_path",
",",
"optim_path",
",",
"chec... | Restores from a training session saved to disk. | [
"Restores",
"from",
"a",
"training",
"session",
"saved",
"to",
"disk",
"."
] | [
"\"\"\"Restores from a training session saved to disk.\n\n NOTE: The optimizer's state is placed on the same device as it's model\n parameters. Therefore, be sure you have done `model.to(device)` before\n calling this method.\n\n Args:\n paths: Provides information about the different paths to u... | [
{
"param": "checkpoint_type",
"type": "str"
},
{
"param": "paths",
"type": "Paths"
},
{
"param": "model",
"type": null
},
{
"param": "optimizer",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "create_if_missing",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "checkpoint_type",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paths",
"type": "Paths",
"docstring": "Provides informa... |
6dff47868530f7f8de81a32abeb85766374edb49 | OliverGrace/python-telegram-SpeedCentreTestBot | main.py | [
"MIT"
] | Python | help_command | None | def help_command(update: Update, _: CallbackContext) -> None:
"""Send a message when the command /help is issued."""
sent_message = update.message.reply_text('Help!')
bbot = Bot(token='BOT_TOKEN')
arg = [bbot, update.message.chat_id, sent_message.message_id]
timerx = threading.Timer(10, functio... | Send a message when the command /help is issued. | Send a message when the command /help is issued. | [
"Send",
"a",
"message",
"when",
"the",
"command",
"/",
"help",
"is",
"issued",
"."
] | def help_command(update: Update, _: CallbackContext) -> None:
sent_message = update.message.reply_text('Help!')
bbot = Bot(token='BOT_TOKEN')
arg = [bbot, update.message.chat_id, sent_message.message_id]
timerx = threading.Timer(10, function=timer, args=arg)
timerx.start() | [
"def",
"help_command",
"(",
"update",
":",
"Update",
",",
"_",
":",
"CallbackContext",
")",
"->",
"None",
":",
"sent_message",
"=",
"update",
".",
"message",
".",
"reply_text",
"(",
"'Help!'",
")",
"bbot",
"=",
"Bot",
"(",
"token",
"=",
"'BOT_TOKEN'",
")... | Send a message when the command /help is issued. | [
"Send",
"a",
"message",
"when",
"the",
"command",
"/",
"help",
"is",
"issued",
"."
] | [
"\"\"\"Send a message when the command /help is issued.\"\"\""
] | [
{
"param": "update",
"type": "Update"
},
{
"param": "_",
"type": "CallbackContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "update",
"type": "Update",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_",
"type": "CallbackContext",
"docstring": null,
"docs... |
24ef8c9cd27e8ed091711b968499ea5457efde1c | DistributedClocks/tsviz | deploy_tsviz.py | [
"MIT"
] | Python | minify | <not_specific> | def minify(branch, info):
'''
Minifies all of the js code under js/ using Google's API and
returns the minified resulting js code.
'''
params = [
('compilation_level', 'SIMPLE_OPTIMIZATIONS'),
('output_format', 'text'),
('output_info', info)
]
url = 'https://bitbucket.org/mhnnun... |
Minifies all of the js code under js/ using Google's API and
returns the minified resulting js code.
| Minifies all of the js code under js/ using Google's API and
returns the minified resulting js code. | [
"Minifies",
"all",
"of",
"the",
"js",
"code",
"under",
"js",
"/",
"using",
"Google",
"'",
"s",
"API",
"and",
"returns",
"the",
"minified",
"resulting",
"js",
"code",
"."
] | def minify(branch, info):
params = [
('compilation_level', 'SIMPLE_OPTIMIZATIONS'),
('output_format', 'text'),
('output_info', info)
]
url = 'https://bitbucket.org/mhnnunes/tsviz/raw/' + branch + '/'
for r, d, f in os.walk('local_scripts'):
for f in f:
if f.endswith(".js"... | [
"def",
"minify",
"(",
"branch",
",",
"info",
")",
":",
"params",
"=",
"[",
"(",
"'compilation_level'",
",",
"'SIMPLE_OPTIMIZATIONS'",
")",
",",
"(",
"'output_format'",
",",
"'text'",
")",
",",
"(",
"'output_info'",
",",
"info",
")",
"]",
"url",
"=",
"'ht... | Minifies all of the js code under js/ using Google's API and
returns the minified resulting js code. | [
"Minifies",
"all",
"of",
"the",
"js",
"code",
"under",
"js",
"/",
"using",
"Google",
"'",
"s",
"API",
"and",
"returns",
"the",
"minified",
"resulting",
"js",
"code",
"."
] | [
"'''\n Minifies all of the js code under js/ using Google's API and\n returns the minified resulting js code.\n '''",
"#Include DEPENDENCIES",
"# Traverse all of the files underneath the js/ dir"
] | [
{
"param": "branch",
"type": null
},
{
"param": "info",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "branch",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "info",
"type": null,
"docstring": null,
"docstring_tokens":... |
24ef8c9cd27e8ed091711b968499ea5457efde1c | DistributedClocks/tsviz | deploy_tsviz.py | [
"MIT"
] | Python | main | <not_specific> | def main():
'''
Workhorse method to execute all the of the steps described in the file header.
'''
src_dir = "./"
dist_dir = "../bestchai.bitbucket.org/tsviz/"
print "Deploying to: " + dist_dir
print "from: " + src_dir
# Confirmation message.
if( confirm("Is it okay to remove... |
Workhorse method to execute all the of the steps described in the file header.
| Workhorse method to execute all the of the steps described in the file header. | [
"Workhorse",
"method",
"to",
"execute",
"all",
"the",
"of",
"the",
"steps",
"described",
"in",
"the",
"file",
"header",
"."
] | def main():
src_dir = "./"
dist_dir = "../bestchai.bitbucket.org/tsviz/"
print "Deploying to: " + dist_dir
print "from: " + src_dir
if( confirm("Is it okay to remove the previous deployed version?", False) ):
if (os.path.exists(dist_dir)):
runcmd("rm -rf " + dist_dir + "*")
... | [
"def",
"main",
"(",
")",
":",
"src_dir",
"=",
"\"./\"",
"dist_dir",
"=",
"\"../bestchai.bitbucket.org/tsviz/\"",
"print",
"\"Deploying to: \"",
"+",
"dist_dir",
"print",
"\"from: \"",
"+",
"src_dir",
"if",
"(",
"confirm",
"(",
"\"Is it okay to remove the previous deploy... | Workhorse method to execute all the of the steps described in the file header. | [
"Workhorse",
"method",
"to",
"execute",
"all",
"the",
"of",
"the",
"steps",
"described",
"in",
"the",
"file",
"header",
"."
] | [
"'''\n Workhorse method to execute all the of the steps described in the file header.\n '''",
"# Confirmation message.",
"# Remove previously deployed version of tsviz.",
"# Copy over the source.",
"# Remove js source code since we will be using a minified version (see below).",
"# Compile docs",
... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
01d5173164f4f5134f3766e8729d34387d77533f | KMJ901122/FinRL | KMJcustom/utils.py | [
"MIT"
] | Python | shape | <not_specific> | def shape(a, w, f):
'''
a: number of stocks
w: window size
f: number of features
'''
SHAPE={}
SHAPE['flatten']=(a*w*f, )
SHAPE['awf']=(a, w, f)
SHAPE['waf']=(w, a, f)
SHAPE['wfa']=(w, f, a)
SHAPE['fwa']=(f, w, a)
return SHAPE |
a: number of stocks
w: window size
f: number of features
| number of stocks
w: window size
f: number of features | [
"number",
"of",
"stocks",
"w",
":",
"window",
"size",
"f",
":",
"number",
"of",
"features"
] | def shape(a, w, f):
SHAPE={}
SHAPE['flatten']=(a*w*f, )
SHAPE['awf']=(a, w, f)
SHAPE['waf']=(w, a, f)
SHAPE['wfa']=(w, f, a)
SHAPE['fwa']=(f, w, a)
return SHAPE | [
"def",
"shape",
"(",
"a",
",",
"w",
",",
"f",
")",
":",
"SHAPE",
"=",
"{",
"}",
"SHAPE",
"[",
"'flatten'",
"]",
"=",
"(",
"a",
"*",
"w",
"*",
"f",
",",
")",
"SHAPE",
"[",
"'awf'",
"]",
"=",
"(",
"a",
",",
"w",
",",
"f",
")",
"SHAPE",
"[... | a: number of stocks
w: window size
f: number of features | [
"a",
":",
"number",
"of",
"stocks",
"w",
":",
"window",
"size",
"f",
":",
"number",
"of",
"features"
] | [
"'''\n a: number of stocks\n w: window size\n f: number of features\n '''"
] | [
{
"param": "a",
"type": null
},
{
"param": "w",
"type": null
},
{
"param": "f",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "w",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
30f14d811571aefd686dc7aa93b3b3aa853cc993 | juju-solutions/interface-kafka | provides.py | [
"Apache-2.0"
] | Python | send_zookeepers | null | def send_zookeepers(self, zookeepers):
"""
Forward ZK connection info to clients.
:param list zookeepers: List of ZK entry dicts. Each dict should
contain a ``host``, ``port``, and ``rest_port`` key.
"""
required_keys = {'host', 'port', 'rest_port'}
conv = s... |
Forward ZK connection info to clients.
:param list zookeepers: List of ZK entry dicts. Each dict should
contain a ``host``, ``port``, and ``rest_port`` key.
| Forward ZK connection info to clients. | [
"Forward",
"ZK",
"connection",
"info",
"to",
"clients",
"."
] | def send_zookeepers(self, zookeepers):
required_keys = {'host', 'port', 'rest_port'}
conv = self.conversation()
for zk in zookeepers:
if not isinstance(zk, dict) or required_keys - set(zk.keys()):
raise ValueError('Invalid Zookeeper entry: {}'.format(zk))
conv... | [
"def",
"send_zookeepers",
"(",
"self",
",",
"zookeepers",
")",
":",
"required_keys",
"=",
"{",
"'host'",
",",
"'port'",
",",
"'rest_port'",
"}",
"conv",
"=",
"self",
".",
"conversation",
"(",
")",
"for",
"zk",
"in",
"zookeepers",
":",
"if",
"not",
"isins... | Forward ZK connection info to clients. | [
"Forward",
"ZK",
"connection",
"info",
"to",
"clients",
"."
] | [
"\"\"\"\n Forward ZK connection info to clients.\n\n :param list zookeepers: List of ZK entry dicts. Each dict should\n contain a ``host``, ``port``, and ``rest_port`` key.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "zookeepers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zookeepers",
"type": null,
"docstring": "List of ZK entry dicts. E... |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | ssm_install_cloudwatch_agent | null | def ssm_install_cloudwatch_agent(self):
"""Install and Start CloudWatch Agent via Systems Manager (SSM)"""
# wait for all EC2 instance checks to complete
try:
logger.info(
"Waiting for EC2 instance health checks to complete before "
"installing CloudW... | Install and Start CloudWatch Agent via Systems Manager (SSM) | Install and Start CloudWatch Agent via Systems Manager (SSM) | [
"Install",
"and",
"Start",
"CloudWatch",
"Agent",
"via",
"Systems",
"Manager",
"(",
"SSM",
")"
] | def ssm_install_cloudwatch_agent(self):
try:
logger.info(
"Waiting for EC2 instance health checks to complete before "
"installing CloudWatch Unified Agent. This may take a few "
"minutes...")
waiter = self.ec2_client.get_waiter("instance_s... | [
"def",
"ssm_install_cloudwatch_agent",
"(",
"self",
")",
":",
"try",
":",
"logger",
".",
"info",
"(",
"\"Waiting for EC2 instance health checks to complete before \"",
"\"installing CloudWatch Unified Agent. This may take a few \"",
"\"minutes...\"",
")",
"waiter",
"=",
"self",
... | Install and Start CloudWatch Agent via Systems Manager (SSM) | [
"Install",
"and",
"Start",
"CloudWatch",
"Agent",
"via",
"Systems",
"Manager",
"(",
"SSM",
")"
] | [
"\"\"\"Install and Start CloudWatch Agent via Systems Manager (SSM)\"\"\"",
"# wait for all EC2 instance checks to complete",
"# install the cloudwatch agent on each cluster node",
"# upload cloudwatch agent config to the SSM parameter store",
"# satisfy collectd preconditions before starting cloudwatch age... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | put_cloudwatch_alarm | null | def put_cloudwatch_alarm(self):
""" put cloudwatch metric alarms read from config """
data = self._load_config_file("alarm")
for node_id in self.node_ids:
for item in data:
item_out = copy.deepcopy(item)
self._replace_all_config_variables(
... | put cloudwatch metric alarms read from config | put cloudwatch metric alarms read from config | [
"put",
"cloudwatch",
"metric",
"alarms",
"read",
"from",
"config"
] | def put_cloudwatch_alarm(self):
data = self._load_config_file("alarm")
for node_id in self.node_ids:
for item in data:
item_out = copy.deepcopy(item)
self._replace_all_config_variables(
item_out,
str(node_id),
... | [
"def",
"put_cloudwatch_alarm",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_load_config_file",
"(",
"\"alarm\"",
")",
"for",
"node_id",
"in",
"self",
".",
"node_ids",
":",
"for",
"item",
"in",
"data",
":",
"item_out",
"=",
"copy",
".",
"deepcopy",
... | put cloudwatch metric alarms read from config | [
"put",
"cloudwatch",
"metric",
"alarms",
"read",
"from",
"config"
] | [
"\"\"\" put cloudwatch metric alarms read from config \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | _send_command_to_nodes | <not_specific> | def _send_command_to_nodes(self, document_name, parameters, node_ids):
""" send SSM command to the given nodes """
logger.debug("Sending SSM command to {} node(s). Document name: {}. "
"Parameters: {}.".format(
len(node_ids), document_name, parameters))
... | send SSM command to the given nodes | send SSM command to the given nodes | [
"send",
"SSM",
"command",
"to",
"the",
"given",
"nodes"
] | def _send_command_to_nodes(self, document_name, parameters, node_ids):
logger.debug("Sending SSM command to {} node(s). Document name: {}. "
"Parameters: {}.".format(
len(node_ids), document_name, parameters))
response = self.ssm_client.send_command(
... | [
"def",
"_send_command_to_nodes",
"(",
"self",
",",
"document_name",
",",
"parameters",
",",
"node_ids",
")",
":",
"logger",
".",
"debug",
"(",
"\"Sending SSM command to {} node(s). Document name: {}. \"",
"\"Parameters: {}.\"",
".",
"format",
"(",
"len",
"(",
"node_ids"... | send SSM command to the given nodes | [
"send",
"SSM",
"command",
"to",
"the",
"given",
"nodes"
] | [
"\"\"\" send SSM command to the given nodes \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "document_name",
"type": null
},
{
"param": "parameters",
"type": null
},
{
"param": "node_ids",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "document_name",
"type": null,
"docstring": null,
"docstring_t... |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | _send_command_to_all_nodes | <not_specific> | def _send_command_to_all_nodes(self, document_name, parameters):
""" send SSM command to all nodes """
return self._send_command_to_nodes(
document_name,
parameters,
self.node_ids,
) | send SSM command to all nodes | send SSM command to all nodes | [
"send",
"SSM",
"command",
"to",
"all",
"nodes"
] | def _send_command_to_all_nodes(self, document_name, parameters):
return self._send_command_to_nodes(
document_name,
parameters,
self.node_ids,
) | [
"def",
"_send_command_to_all_nodes",
"(",
"self",
",",
"document_name",
",",
"parameters",
")",
":",
"return",
"self",
".",
"_send_command_to_nodes",
"(",
"document_name",
",",
"parameters",
",",
"self",
".",
"node_ids",
",",
")"
] | send SSM command to all nodes | [
"send",
"SSM",
"command",
"to",
"all",
"nodes"
] | [
"\"\"\" send SSM command to all nodes \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "document_name",
"type": null
},
{
"param": "parameters",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "document_name",
"type": null,
"docstring": null,
"docstring_t... |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | _ssm_command_waiter | null | def _ssm_command_waiter(self, document_name, parameters):
""" wait for SSM command to complete on all cluster nodes """
# This waiter differs from the built-in SSM.Waiter by
# optimistically waiting for the command invocation to
# exist instead of failing immediately, and by resubmittin... | wait for SSM command to complete on all cluster nodes | wait for SSM command to complete on all cluster nodes | [
"wait",
"for",
"SSM",
"command",
"to",
"complete",
"on",
"all",
"cluster",
"nodes"
] | def _ssm_command_waiter(self, document_name, parameters):
response = self._send_command_to_all_nodes(
document_name,
parameters,
)
command_id = response["Command"]["CommandId"]
cloudwatch_config = self.provider_config["cloudwatch"]
agent_retryer_config = c... | [
"def",
"_ssm_command_waiter",
"(",
"self",
",",
"document_name",
",",
"parameters",
")",
":",
"response",
"=",
"self",
".",
"_send_command_to_all_nodes",
"(",
"document_name",
",",
"parameters",
",",
")",
"command_id",
"=",
"response",
"[",
"\"Command\"",
"]",
"... | wait for SSM command to complete on all cluster nodes | [
"wait",
"for",
"SSM",
"command",
"to",
"complete",
"on",
"all",
"cluster",
"nodes"
] | [
"\"\"\" wait for SSM command to complete on all cluster nodes \"\"\"",
"# This waiter differs from the built-in SSM.Waiter by",
"# optimistically waiting for the command invocation to",
"# exist instead of failing immediately, and by resubmitting",
"# any failed command until all retry attempts are exhauste... | [
{
"param": "self",
"type": null
},
{
"param": "document_name",
"type": null
},
{
"param": "parameters",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "document_name",
"type": null,
"docstring": null,
"docstring_t... |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | _replace_config_variables | <not_specific> | def _replace_config_variables(self, string, node_id, cluster_name, region):
"""
replace known config variable occurrences in the input string
does not replace variables with undefined or empty strings
"""
if node_id:
string = string.replace("{instance_id}", node_id)
... |
replace known config variable occurrences in the input string
does not replace variables with undefined or empty strings
| replace known config variable occurrences in the input string
does not replace variables with undefined or empty strings | [
"replace",
"known",
"config",
"variable",
"occurrences",
"in",
"the",
"input",
"string",
"does",
"not",
"replace",
"variables",
"with",
"undefined",
"or",
"empty",
"strings"
] | def _replace_config_variables(self, string, node_id, cluster_name, region):
if node_id:
string = string.replace("{instance_id}", node_id)
if cluster_name:
string = string.replace("{cluster_name}", cluster_name)
if region:
string = string.replace("{region}", re... | [
"def",
"_replace_config_variables",
"(",
"self",
",",
"string",
",",
"node_id",
",",
"cluster_name",
",",
"region",
")",
":",
"if",
"node_id",
":",
"string",
"=",
"string",
".",
"replace",
"(",
"\"{instance_id}\"",
",",
"node_id",
")",
"if",
"cluster_name",
... | replace known config variable occurrences in the input string
does not replace variables with undefined or empty strings | [
"replace",
"known",
"config",
"variable",
"occurrences",
"in",
"the",
"input",
"string",
"does",
"not",
"replace",
"variables",
"with",
"undefined",
"or",
"empty",
"strings"
] | [
"\"\"\"\n replace known config variable occurrences in the input string\n does not replace variables with undefined or empty strings\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "string",
"type": null
},
{
"param": "node_id",
"type": null
},
{
"param": "cluster_name",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": null,
"docstring": null,
"docstring_tokens":... |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | _replace_all_config_variables | <not_specific> | def _replace_all_config_variables(
self,
collection,
node_id,
cluster_name,
region,
):
"""
Replace known config variable occurrences in the input collection.
The input collection must be either a dict or list.
Returns a tup... |
Replace known config variable occurrences in the input collection.
The input collection must be either a dict or list.
Returns a tuple consisting of the output collection and the number of
modified strings in the collection (which is not necessarily equal to
the number of varia... | Replace known config variable occurrences in the input collection.
The input collection must be either a dict or list.
Returns a tuple consisting of the output collection and the number of
modified strings in the collection (which is not necessarily equal to
the number of variables replaced). | [
"Replace",
"known",
"config",
"variable",
"occurrences",
"in",
"the",
"input",
"collection",
".",
"The",
"input",
"collection",
"must",
"be",
"either",
"a",
"dict",
"or",
"list",
".",
"Returns",
"a",
"tuple",
"consisting",
"of",
"the",
"output",
"collection",
... | def _replace_all_config_variables(
self,
collection,
node_id,
cluster_name,
region,
):
modified_value_count = 0
if type(collection) is dict:
for key, value in collection.items():
if type(value) is dict or type(va... | [
"def",
"_replace_all_config_variables",
"(",
"self",
",",
"collection",
",",
"node_id",
",",
"cluster_name",
",",
"region",
",",
")",
":",
"modified_value_count",
"=",
"0",
"if",
"type",
"(",
"collection",
")",
"is",
"dict",
":",
"for",
"key",
",",
"value",
... | Replace known config variable occurrences in the input collection. | [
"Replace",
"known",
"config",
"variable",
"occurrences",
"in",
"the",
"input",
"collection",
"."
] | [
"\"\"\"\n Replace known config variable occurrences in the input collection.\n The input collection must be either a dict or list.\n\n Returns a tuple consisting of the output collection and the number of\n modified strings in the collection (which is not necessarily equal to\n th... | [
{
"param": "self",
"type": null
},
{
"param": "collection",
"type": null
},
{
"param": "node_id",
"type": null
},
{
"param": "cluster_name",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "collection",
"type": null,
"docstring": null,
"docstring_toke... |
801f918c455846b83e5cfa5ee43ea4d1d2a7a926 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | [
"Apache-2.0"
] | Python | cloudwatch_config_exists | <not_specific> | def cloudwatch_config_exists(config, section_name, file_name):
"""check if cloudwatch config file exists"""
cfg = config.get("cloudwatch", {}).get(section_name, {}).get(file_name)
if cfg:
assert os.path.isfile(cfg), \
"Invalid CloudWatch Config File Path: {}".format(... | check if cloudwatch config file exists | check if cloudwatch config file exists | [
"check",
"if",
"cloudwatch",
"config",
"file",
"exists"
] | def cloudwatch_config_exists(config, section_name, file_name):
cfg = config.get("cloudwatch", {}).get(section_name, {}).get(file_name)
if cfg:
assert os.path.isfile(cfg), \
"Invalid CloudWatch Config File Path: {}".format(cfg)
return bool(cfg) | [
"def",
"cloudwatch_config_exists",
"(",
"config",
",",
"section_name",
",",
"file_name",
")",
":",
"cfg",
"=",
"config",
".",
"get",
"(",
"\"cloudwatch\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"section_name",
",",
"{",
"}",
")",
".",
"get",
"(",
"file_... | check if cloudwatch config file exists | [
"check",
"if",
"cloudwatch",
"config",
"file",
"exists"
] | [
"\"\"\"check if cloudwatch config file exists\"\"\""
] | [
{
"param": "config",
"type": null
},
{
"param": "section_name",
"type": null
},
{
"param": "file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "section_name",
"type": null,
"docstring": null,
"docstring_... |
b1cb87cb03151c964448d6f7c3fe9f7daca9ee68 | pdames/amazon-ray | python/ray/autoscaler/_private/aws/config.py | [
"Apache-2.0"
] | Python | _check_ami | <not_specific> | def _check_ami(config):
"""Provide helpful message for missing ImageId for node configuration."""
_set_config_info(head_ami_src="config", workers_ami_src="config")
region = config["provider"]["region"]
default_ami = DEFAULT_AMI.get(region)
if not default_ami:
# If we do not provide a defau... | Provide helpful message for missing ImageId for node configuration. | Provide helpful message for missing ImageId for node configuration. | [
"Provide",
"helpful",
"message",
"for",
"missing",
"ImageId",
"for",
"node",
"configuration",
"."
] | def _check_ami(config):
_set_config_info(head_ami_src="config", workers_ami_src="config")
region = config["provider"]["region"]
default_ami = DEFAULT_AMI.get(region)
if not default_ami:
return
if config["head_node"].get("ImageId", "").lower() == "latest_dlami":
config["head_node"]["I... | [
"def",
"_check_ami",
"(",
"config",
")",
":",
"_set_config_info",
"(",
"head_ami_src",
"=",
"\"config\"",
",",
"workers_ami_src",
"=",
"\"config\"",
")",
"region",
"=",
"config",
"[",
"\"provider\"",
"]",
"[",
"\"region\"",
"]",
"default_ami",
"=",
"DEFAULT_AMI"... | Provide helpful message for missing ImageId for node configuration. | [
"Provide",
"helpful",
"message",
"for",
"missing",
"ImageId",
"for",
"node",
"configuration",
"."
] | [
"\"\"\"Provide helpful message for missing ImageId for node configuration.\"\"\"",
"# If we do not provide a default AMI for the given region, noop."
] | [
{
"param": "config",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7fed69dc979b4f941261d14291db9aa51476c503 | TrialAndErrror/TnE_Assistant | src/Settings.py | [
"MIT"
] | Python | print_custom_intro | null | def print_custom_intro():
"""
Clear Screen and display introductory text.
:return: None
"""
# for windows
if os.name == 'nt':
os.system('cls')
# for mac and linux(here, os.name is 'posix')
else:
os.system('clear')
print('\n'*100)
print('Welcome to Ratty\'s Assis... |
Clear Screen and display introductory text.
:return: None
| Clear Screen and display introductory text. | [
"Clear",
"Screen",
"and",
"display",
"introductory",
"text",
"."
] | def print_custom_intro():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
print('\n'*100)
print('Welcome to Ratty\'s Assistant\n'
'\n'
'You can ask me to play or look up anything!\n'
'\n'
'You can Say:\n'
'\tSearch Maps of A... | [
"def",
"print_custom_intro",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"os",
".",
"system",
"(",
"'cls'",
")",
"else",
":",
"os",
".",
"system",
"(",
"'clear'",
")",
"print",
"(",
"'\\n'",
"*",
"100",
")",
"print",
"(",
"'Welcome t... | Clear Screen and display introductory text. | [
"Clear",
"Screen",
"and",
"display",
"introductory",
"text",
"."
] | [
"\"\"\"\n Clear Screen and display introductory text.\n :return: None\n \"\"\"",
"# for windows",
"# for mac and linux(here, os.name is 'posix')"
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1a2c6b641ddd509978c347407169d199fed9045e | TrialAndErrror/TnE_Assistant | src/Actions/Search.py | [
"MIT"
] | Python | search_web_for | null | def search_web_for(phrase):
"""
Confirm search action;
search content related to param phrase on Google using PyWhatKit.
:param phrase: str
:return: None
"""
speak(f'Let\'s search the web for {phrase}')
pywhatkit.search(phrase) |
Confirm search action;
search content related to param phrase on Google using PyWhatKit.
:param phrase: str
:return: None
| Confirm search action;
search content related to param phrase on Google using PyWhatKit. | [
"Confirm",
"search",
"action",
";",
"search",
"content",
"related",
"to",
"param",
"phrase",
"on",
"Google",
"using",
"PyWhatKit",
"."
] | def search_web_for(phrase):
speak(f'Let\'s search the web for {phrase}')
pywhatkit.search(phrase) | [
"def",
"search_web_for",
"(",
"phrase",
")",
":",
"speak",
"(",
"f'Let\\'s search the web for {phrase}'",
")",
"pywhatkit",
".",
"search",
"(",
"phrase",
")"
] | Confirm search action;
search content related to param phrase on Google using PyWhatKit. | [
"Confirm",
"search",
"action",
";",
"search",
"content",
"related",
"to",
"param",
"phrase",
"on",
"Google",
"using",
"PyWhatKit",
"."
] | [
"\"\"\"\n Confirm search action;\n search content related to param phrase on Google using PyWhatKit.\n\n :param phrase: str\n :return: None\n \"\"\""
] | [
{
"param": "phrase",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "phrase",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
25f923c3dd967638aec5e4df4e35a7b10f6620be | TrialAndErrror/TnE_Assistant | src/Actions/Play.py | [
"MIT"
] | Python | play_youtube_video_for | null | def play_youtube_video_for(phrase):
"""
Confirm play action;
play content related to param phrase on YouTube using PyWhatKit.
:param phrase: str
:param trigger_word: str
:return: None
"""
speak(f'Playing {phrase} on YouTube')
pywhatkit.playonyt(phrase) |
Confirm play action;
play content related to param phrase on YouTube using PyWhatKit.
:param phrase: str
:param trigger_word: str
:return: None
| Confirm play action;
play content related to param phrase on YouTube using PyWhatKit. | [
"Confirm",
"play",
"action",
";",
"play",
"content",
"related",
"to",
"param",
"phrase",
"on",
"YouTube",
"using",
"PyWhatKit",
"."
] | def play_youtube_video_for(phrase):
speak(f'Playing {phrase} on YouTube')
pywhatkit.playonyt(phrase) | [
"def",
"play_youtube_video_for",
"(",
"phrase",
")",
":",
"speak",
"(",
"f'Playing {phrase} on YouTube'",
")",
"pywhatkit",
".",
"playonyt",
"(",
"phrase",
")"
] | Confirm play action;
play content related to param phrase on YouTube using PyWhatKit. | [
"Confirm",
"play",
"action",
";",
"play",
"content",
"related",
"to",
"param",
"phrase",
"on",
"YouTube",
"using",
"PyWhatKit",
"."
] | [
"\"\"\"\n Confirm play action;\n play content related to param phrase on YouTube using PyWhatKit.\n\n :param phrase: str\n :param trigger_word: str\n :return: None\n \"\"\""
] | [
{
"param": "phrase",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "phrase",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
71d8ce9b4beda07cb1798c46ad84b05919859d18 | TrialAndErrror/TnE_Assistant | src/Assistant.py | [
"MIT"
] | Python | run_assistant | null | def run_assistant():
"""
Listen for command;
Check if wake trigger was detected;
If so, perform action in command;
If not, log it and perform action in command anyway.
:return: None
"""
command = listen_for_commands().lower()
"""
Assistant checks the command to see if it has t... |
Listen for command;
Check if wake trigger was detected;
If so, perform action in command;
If not, log it and perform action in command anyway.
:return: None
| Listen for command;
Check if wake trigger was detected.
If so, perform action in command;
If not, log it and perform action in command anyway. | [
"Listen",
"for",
"command",
";",
"Check",
"if",
"wake",
"trigger",
"was",
"detected",
".",
"If",
"so",
"perform",
"action",
"in",
"command",
";",
"If",
"not",
"log",
"it",
"and",
"perform",
"action",
"in",
"command",
"anyway",
"."
] | def run_assistant():
command = listen_for_commands().lower()
wake_word_detected: bool = check_for_wake_word(command)
if wake_word_detected:
command_without_wake_word = cut_wake_word_from_command(command)
perform_action(command_without_wake_word)
else:
if ASSISTANT_SETTINGS.get('R... | [
"def",
"run_assistant",
"(",
")",
":",
"command",
"=",
"listen_for_commands",
"(",
")",
".",
"lower",
"(",
")",
"\"\"\"\n Assistant checks the command to see if it has the wake word in it.\n \"\"\"",
"wake_word_detected",
":",
"bool",
"=",
"check_for_wake_word",
"(",
... | Listen for command;
Check if wake trigger was detected; | [
"Listen",
"for",
"command",
";",
"Check",
"if",
"wake",
"trigger",
"was",
"detected",
";"
] | [
"\"\"\"\n Listen for command;\n Check if wake trigger was detected;\n\n If so, perform action in command;\n If not, log it and perform action in command anyway.\n\n :return: None\n \"\"\"",
"\"\"\"\n Assistant checks the command to see if it has the wake word in it.\n \"\"\"",
"\"\"\"\n ... | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.