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
9604b077e7e8ae4a1faa86f060bd5c24dfed3524
chihming/LibMultiLabel
libmultilabel/data_utils.py
[ "MIT" ]
Python
load_or_build_text_dict
<not_specific>
def load_or_build_text_dict( dataset, vocab_file=None, min_vocab_freq=1, embed_file=None, embed_cache_dir=None, silent=False, normalize_embed=False ): """Build or load the vocabulary from the training dataset or the predefined `vocab_file`. The pretrained embedding can be either from...
Build or load the vocabulary from the training dataset or the predefined `vocab_file`. The pretrained embedding can be either from a self-defined `embed_file` or from one of the vectors defined in torchtext `vectors` (https://pytorch.org/text/0.9.0/vocab.html#torchtext.vocab.Vocab.load_vectors). Args: ...
Build or load the vocabulary from the training dataset or the predefined `vocab_file`. The pretrained embedding can be either from a self-defined `embed_file` or from one of the vectors defined in torchtext `vectors` .
[ "Build", "or", "load", "the", "vocabulary", "from", "the", "training", "dataset", "or", "the", "predefined", "`", "vocab_file", "`", ".", "The", "pretrained", "embedding", "can", "be", "either", "from", "a", "self", "-", "defined", "`", "embed_file", "`", ...
def load_or_build_text_dict( dataset, vocab_file=None, min_vocab_freq=1, embed_file=None, embed_cache_dir=None, silent=False, normalize_embed=False ): if vocab_file: logging.info(f'Load vocab from {vocab_file}') with open(vocab_file, 'r') as fp: vocab_list = [...
[ "def", "load_or_build_text_dict", "(", "dataset", ",", "vocab_file", "=", "None", ",", "min_vocab_freq", "=", "1", ",", "embed_file", "=", "None", ",", "embed_cache_dir", "=", "None", ",", "silent", "=", "False", ",", "normalize_embed", "=", "False", ")", ":...
Build or load the vocabulary from the training dataset or the predefined `vocab_file`.
[ "Build", "or", "load", "the", "vocabulary", "from", "the", "training", "dataset", "or", "the", "predefined", "`", "vocab_file", "`", "." ]
[ "\"\"\"Build or load the vocabulary from the training dataset or the predefined `vocab_file`.\n The pretrained embedding can be either from a self-defined `embed_file` or from one of\n the vectors defined in torchtext `vectors` (https://pytorch.org/text/0.9.0/vocab.html#torchtext.vocab.Vocab.load_vectors).\n\...
[ { "param": "dataset", "type": null }, { "param": "vocab_file", "type": null }, { "param": "min_vocab_freq", "type": null }, { "param": "embed_file", "type": null }, { "param": "embed_cache_dir", "type": null }, { "param": "silent", "type": null }...
{ "returns": [ { "docstring": "A vocab object which maps tokens to indices.", "docstring_tokens": [ "A", "vocab", "object", "which", "maps", "tokens", "to", "indices", "." ], "type": "torchtext.vocab.Vocab" } ], ...
01a9fc11bce4cc03320f56a4dbdb3b5dc2f093c6
chihming/LibMultiLabel
main.py
[ "MIT" ]
Python
check_config
null
def check_config(config): """Check if the configuration has invalid arguments. Args: config (AttributeDict): Config of the experiment from `get_args`. """ if config.model_name == 'XMLCNN' and config.seed is not None: raise ValueError("nn.AdaptiveMaxPool1d doesn't have a deterministic im...
Check if the configuration has invalid arguments. Args: config (AttributeDict): Config of the experiment from `get_args`.
Check if the configuration has invalid arguments.
[ "Check", "if", "the", "configuration", "has", "invalid", "arguments", "." ]
def check_config(config): if config.model_name == 'XMLCNN' and config.seed is not None: raise ValueError("nn.AdaptiveMaxPool1d doesn't have a deterministic implementation but seed is" "specified. Please do not specify seed.")
[ "def", "check_config", "(", "config", ")", ":", "if", "config", ".", "model_name", "==", "'XMLCNN'", "and", "config", ".", "seed", "is", "not", "None", ":", "raise", "ValueError", "(", "\"nn.AdaptiveMaxPool1d doesn't have a deterministic implementation but seed is\"", ...
Check if the configuration has invalid arguments.
[ "Check", "if", "the", "configuration", "has", "invalid", "arguments", "." ]
[ "\"\"\"Check if the configuration has invalid arguments.\n\n Args:\n config (AttributeDict): Config of the experiment from `get_args`.\n \"\"\"" ]
[ { "param": "config", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config", "type": null, "docstring": "Config of the experiment from `get_args`.", "docstring_tokens": [ "Config", "of", "the", "experiment", "from", "`", "get_args", ...
af40d87bd8f81ebadd5bf8ff640041571c0153f4
kkkkkwai/gated-graph-neural-network-samples
ggnn_global_sparse.py
[ "MIT" ]
Python
make_minibatch_iterator
null
def make_minibatch_iterator(self, data: Any, is_training: bool): """Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.""" if is_training: np.random.shuffle(data) # Pack until we cannot fit more graphs in t...
Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.
Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.
[ "Create", "minibatches", "by", "flattening", "adjacency", "matrices", "into", "a", "single", "adjacency", "matrix", "with", "multiple", "disconnected", "components", "." ]
def make_minibatch_iterator(self, data: Any, is_training: bool): if is_training: np.random.shuffle(data) state_dropout_keep_prob = self.params['graph_state_dropout_keep_prob'] if is_training else 1. edge_weights_dropout_keep_prob = self.params['edge_weight_dropout_keep_prob'] if is_t...
[ "def", "make_minibatch_iterator", "(", "self", ",", "data", ":", "Any", ",", "is_training", ":", "bool", ")", ":", "if", "is_training", ":", "np", ".", "random", ".", "shuffle", "(", "data", ")", "state_dropout_keep_prob", "=", "self", ".", "params", "[", ...
Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.
[ "Create", "minibatches", "by", "flattening", "adjacency", "matrices", "into", "a", "single", "adjacency", "matrix", "with", "multiple", "disconnected", "components", "." ]
[ "\"\"\"Create minibatches by flattening adjacency matrices into a single adjacency matrix with\n multiple disconnected components.\"\"\"", "# Pack until we cannot fit more graphs in the batch", "# batch_target_task_mask = []", "# pad the word and type ids", "# batch_node_labels.extend(cur_graph['node...
[ { "param": "self", "type": null }, { "param": "data", "type": "Any" }, { "param": "is_training", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "Any", "docstring": null, "docstring_tokens": ...
76ee4f1108302cd33399289db8df5bebfec52bf6
kkkkkwai/gated-graph-neural-network-samples
ggnn_preprocessed_sparse.py
[ "MIT" ]
Python
make_minibatch_iterator
null
def make_minibatch_iterator(self, data: Any, is_training: bool): """Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.""" if is_training: np.random.shuffle(data) # Pack until we cannot fit more graphs in t...
Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.
Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.
[ "Create", "minibatches", "by", "flattening", "adjacency", "matrices", "into", "a", "single", "adjacency", "matrix", "with", "multiple", "disconnected", "components", "." ]
def make_minibatch_iterator(self, data: Any, is_training: bool): if is_training: np.random.shuffle(data) state_dropout_keep_prob = self.params['graph_state_dropout_keep_prob'] if is_training else 1. edge_weights_dropout_keep_prob = self.params['edge_weight_dropout_keep_prob'] if is_t...
[ "def", "make_minibatch_iterator", "(", "self", ",", "data", ":", "Any", ",", "is_training", ":", "bool", ")", ":", "if", "is_training", ":", "np", ".", "random", ".", "shuffle", "(", "data", ")", "state_dropout_keep_prob", "=", "self", ".", "params", "[", ...
Create minibatches by flattening adjacency matrices into a single adjacency matrix with multiple disconnected components.
[ "Create", "minibatches", "by", "flattening", "adjacency", "matrices", "into", "a", "single", "adjacency", "matrix", "with", "multiple", "disconnected", "components", "." ]
[ "\"\"\"Create minibatches by flattening adjacency matrices into a single adjacency matrix with\n multiple disconnected components.\"\"\"", "# Pack until we cannot fit more graphs in the batch", "# batch_target_task_mask = []", "#pad the word and type ids", "# batch_node_labels.extend(cur_graph['node_...
[ { "param": "self", "type": null }, { "param": "data", "type": "Any" }, { "param": "is_training", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "Any", "docstring": null, "docstring_tokens": ...
939d1f638c638f226fac6b3319dc5a8daef0b0c6
JCLArriaga5/Runge-Kutta4
rk4odes/rk4.py
[ "MIT" ]
Python
str2def
<not_specific>
def str2def(eqn): """ Make function <string> to <def> for format in RK4 iterations. Example ------- >>> fcn = '2 * t - 3 * y + 1' >>> fcn = str2def(fcn) >>> type(fcn) function >>> """ if type(eqn) is not str: raise ValueError('Input must be string' ) def f(t, y...
Make function <string> to <def> for format in RK4 iterations. Example ------- >>> fcn = '2 * t - 3 * y + 1' >>> fcn = str2def(fcn) >>> type(fcn) function >>>
Make function to for format in RK4 iterations. Example
[ "Make", "function", "to", "for", "format", "in", "RK4", "iterations", ".", "Example" ]
def str2def(eqn): if type(eqn) is not str: raise ValueError('Input must be string' ) def f(t, y): chk = list(eqn) for idx in range(len(chk)): if chk[idx] == 't': chk[idx] = '% s' % t elif chk[idx] == 'y': chk[idx] = '% s' % y ...
[ "def", "str2def", "(", "eqn", ")", ":", "if", "type", "(", "eqn", ")", "is", "not", "str", ":", "raise", "ValueError", "(", "'Input must be string'", ")", "def", "f", "(", "t", ",", "y", ")", ":", "\"\"\"\n To evaluate equation with varibles (t, y).\n ...
Make function <string> to <def> for format in RK4 iterations.
[ "Make", "function", "<string", ">", "to", "<def", ">", "for", "format", "in", "RK4", "iterations", "." ]
[ "\"\"\"\n Make function <string> to <def> for format in RK4 iterations.\n\n Example\n -------\n >>> fcn = '2 * t - 3 * y + 1'\n >>> fcn = str2def(fcn)\n >>> type(fcn)\n function\n >>>\n \"\"\"", "\"\"\"\n To evaluate equation with varibles (t, y).\n \"\"\"" ]
[ { "param": "eqn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "eqn", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
939d1f638c638f226fac6b3319dc5a8daef0b0c6
JCLArriaga5/Runge-Kutta4
rk4odes/rk4.py
[ "MIT" ]
Python
solve
<not_specific>
def solve(self, ti, yi, t, h=0.001): """ Solution of the first-order ordinary differential equation Parameters ---------- ti : Value of the initial t yi : Value of the initial y t : Value that you want to evaluate in the equation h : Integration step ...
Solution of the first-order ordinary differential equation Parameters ---------- ti : Value of the initial t yi : Value of the initial y t : Value that you want to evaluate in the equation h : Integration step Return ------ y : Value of ...
Solution of the first-order ordinary differential equation Parameters ti : Value of the initial t yi : Value of the initial y t : Value that you want to evaluate in the equation h : Integration step Return y : Value of "y" for "t" desired
[ "Solution", "of", "the", "first", "-", "order", "ordinary", "differential", "equation", "Parameters", "ti", ":", "Value", "of", "the", "initial", "t", "yi", ":", "Value", "of", "the", "initial", "y", "t", ":", "Value", "that", "you", "want", "to", "evalu...
def solve(self, ti, yi, t, h=0.001): self.empty_vals() vals = list(firstorder.rk4(self.f, ti, yi, t, h)) self.ys = [vals[i][0] for i in range(len(vals))] self.ts = [vals[i][1] for i in range(len(vals))] return self.ys[len(self.ys) - 1]
[ "def", "solve", "(", "self", ",", "ti", ",", "yi", ",", "t", ",", "h", "=", "0.001", ")", ":", "self", ".", "empty_vals", "(", ")", "vals", "=", "list", "(", "firstorder", ".", "rk4", "(", "self", ".", "f", ",", "ti", ",", "yi", ",", "t", "...
Solution of the first-order ordinary differential equation Parameters
[ "Solution", "of", "the", "first", "-", "order", "ordinary", "differential", "equation", "Parameters" ]
[ "\"\"\"\n Solution of the first-order ordinary differential equation\n\n Parameters\n ----------\n ti : Value of the initial t\n yi : Value of the initial y\n t : Value that you want to evaluate in the equation\n h : Integration step\n\n Return\n ------...
[ { "param": "self", "type": null }, { "param": "ti", "type": null }, { "param": "yi", "type": null }, { "param": "t", "type": null }, { "param": "h", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ti", "type": null, "docstring": null, "docstring_tokens": [],...
939d1f638c638f226fac6b3319dc5a8daef0b0c6
JCLArriaga5/Runge-Kutta4
rk4odes/rk4.py
[ "MIT" ]
Python
graph
null
def graph(self, *args, **kwargs): """ Solution Graph with values obtained from each iteration. """ if len(self.ts) == 0 or len(self.ys) == 0: raise ValueError('Need to solve first') plt.title("Solution graph") plt.plot(self.ts, self.ys, *args, **kwargs) ...
Solution Graph with values obtained from each iteration.
Solution Graph with values obtained from each iteration.
[ "Solution", "Graph", "with", "values", "obtained", "from", "each", "iteration", "." ]
def graph(self, *args, **kwargs): if len(self.ts) == 0 or len(self.ys) == 0: raise ValueError('Need to solve first') plt.title("Solution graph") plt.plot(self.ts, self.ys, *args, **kwargs) plt.scatter(self.ts[len(self.ts) - 1], self.ys[len(self.ys) - 1], f...
[ "def", "graph", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "len", "(", "self", ".", "ts", ")", "==", "0", "or", "len", "(", "self", ".", "ys", ")", "==", "0", ":", "raise", "ValueError", "(", "'Need to solve first'", ")",...
Solution Graph with values obtained from each iteration.
[ "Solution", "Graph", "with", "values", "obtained", "from", "each", "iteration", "." ]
[ "\"\"\"\n Solution Graph with values obtained from each iteration.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
939d1f638c638f226fac6b3319dc5a8daef0b0c6
JCLArriaga5/Runge-Kutta4
rk4odes/rk4.py
[ "MIT" ]
Python
empty_vals
null
def empty_vals(self): """ Clear all values of each iteration. """ self.ts = [] self.ys = []
Clear all values of each iteration.
Clear all values of each iteration.
[ "Clear", "all", "values", "of", "each", "iteration", "." ]
def empty_vals(self): self.ts = [] self.ys = []
[ "def", "empty_vals", "(", "self", ")", ":", "self", ".", "ts", "=", "[", "]", "self", ".", "ys", "=", "[", "]" ]
Clear all values of each iteration.
[ "Clear", "all", "values", "of", "each", "iteration", "." ]
[ "\"\"\"\n Clear all values of each iteration.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
939d1f638c638f226fac6b3319dc5a8daef0b0c6
JCLArriaga5/Runge-Kutta4
rk4odes/rk4.py
[ "MIT" ]
Python
solve
<not_specific>
def solve(self, ti, yi, ui, t, h=0.001): """ Solution of the second-order ordinary differential equation Parameters ---------- ti : Value of the initial t yi : Value of the initial y ui : Value of the initial y' t : Value that you want to evaluate in the ...
Solution of the second-order ordinary differential equation Parameters ---------- ti : Value of the initial t yi : Value of the initial y ui : Value of the initial y' t : Value that you want to evaluate in the diff system h : Integration step Re...
Solution of the second-order ordinary differential equation Parameters Returns yi : Value of y for the t desired ui : Value of y' for the t desired
[ "Solution", "of", "the", "second", "-", "order", "ordinary", "differential", "equation", "Parameters", "Returns", "yi", ":", "Value", "of", "y", "for", "the", "t", "desired", "ui", ":", "Value", "of", "y", "'", "for", "the", "t", "desired" ]
def solve(self, ti, yi, ui, t, h=0.001): for _ in np.arange(ti, t, h): m1 = self.g(ui) k1 = self.f(ti, yi, ui) m2 = self.g(ui + k1 * h / 2) k2 = self.f(ti + h / 2, yi + m1 * h / 2, ui + k1 * h / 2) m3 = self.g(ui + k2 * h / 2) k3 = self.f(t...
[ "def", "solve", "(", "self", ",", "ti", ",", "yi", ",", "ui", ",", "t", ",", "h", "=", "0.001", ")", ":", "for", "_", "in", "np", ".", "arange", "(", "ti", ",", "t", ",", "h", ")", ":", "m1", "=", "self", ".", "g", "(", "ui", ")", "k1",...
Solution of the second-order ordinary differential equation Parameters
[ "Solution", "of", "the", "second", "-", "order", "ordinary", "differential", "equation", "Parameters" ]
[ "\"\"\"\n Solution of the second-order ordinary differential equation\n\n Parameters\n ----------\n ti : Value of the initial t\n yi : Value of the initial y\n ui : Value of the initial y'\n t : Value that you want to evaluate in the diff system\n h : Integrat...
[ { "param": "self", "type": null }, { "param": "ti", "type": null }, { "param": "yi", "type": null }, { "param": "ui", "type": null }, { "param": "t", "type": null }, { "param": "h", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ti", "type": null, "docstring": null, "docstring_tokens": [],...
939d1f638c638f226fac6b3319dc5a8daef0b0c6
JCLArriaga5/Runge-Kutta4
rk4odes/rk4.py
[ "MIT" ]
Python
graph
null
def graph(self, *args, **kwargs): """ Solution Graph with values obtained from each iteration. """ plt.title("Graph of functions") plt.plot(self.ts, self.ys, label="$y(t)$", *args, **kwargs) plt.plot(self.ts, self.us, label="$y'(t)$", *args, **kwargs) plt.legend(...
Solution Graph with values obtained from each iteration.
Solution Graph with values obtained from each iteration.
[ "Solution", "Graph", "with", "values", "obtained", "from", "each", "iteration", "." ]
def graph(self, *args, **kwargs): plt.title("Graph of functions") plt.plot(self.ts, self.ys, label="$y(t)$", *args, **kwargs) plt.plot(self.ts, self.us, label="$y'(t)$", *args, **kwargs) plt.legend() plt.grid() plt.xlabel("$ t $") plt.ylabel("$ y \quad | \quad y'$...
[ "def", "graph", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "plt", ".", "title", "(", "\"Graph of functions\"", ")", "plt", ".", "plot", "(", "self", ".", "ts", ",", "self", ".", "ys", ",", "label", "=", "\"$y(t)$\"", ",", "*", ...
Solution Graph with values obtained from each iteration.
[ "Solution", "Graph", "with", "values", "obtained", "from", "each", "iteration", "." ]
[ "\"\"\"\n Solution Graph with values obtained from each iteration.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f6e0f9753bc7e818b543bb088007d996de1aeb9c
JCLArriaga5/Runge-Kutta4
rk4odes/GUI/GUI.py
[ "MIT" ]
Python
solve
null
def solve(self): """ To use the -solve- function of RK4 and solve the equation that was entered in the GUI """ # Initialize Runge-Kutta firstorder ode methd = firstorder(self.eqn.get()) r = methd.solve(np.double(self.ti.get()), np.double(self.yi.get()), ...
To use the -solve- function of RK4 and solve the equation that was entered in the GUI
To use the -solve- function of RK4 and solve the equation that was entered in the GUI
[ "To", "use", "the", "-", "solve", "-", "function", "of", "RK4", "and", "solve", "the", "equation", "that", "was", "entered", "in", "the", "GUI" ]
def solve(self): methd = firstorder(self.eqn.get()) r = methd.solve(np.double(self.ti.get()), np.double(self.yi.get()), np.double(self.t.get()), np.double(self.h.get())) self.ts, self.ys = methd.get_vals() self.computed.set(r)
[ "def", "solve", "(", "self", ")", ":", "methd", "=", "firstorder", "(", "self", ".", "eqn", ".", "get", "(", ")", ")", "r", "=", "methd", ".", "solve", "(", "np", ".", "double", "(", "self", ".", "ti", ".", "get", "(", ")", ")", ",", "np", ...
To use the -solve- function of RK4 and solve the equation that was entered in the GUI
[ "To", "use", "the", "-", "solve", "-", "function", "of", "RK4", "and", "solve", "the", "equation", "that", "was", "entered", "in", "the", "GUI" ]
[ "\"\"\"\n To use the -solve- function of RK4 and solve the equation that was\n entered in the GUI\n \"\"\"", "# Initialize Runge-Kutta firstorder ode", "# Obtain values of solution" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f6e0f9753bc7e818b543bb088007d996de1aeb9c
JCLArriaga5/Runge-Kutta4
rk4odes/GUI/GUI.py
[ "MIT" ]
Python
graph
null
def graph(self): """ Graph values of each iteration of method """ if len(self.ts) == 0 or len(self.ts) == 0: # raise ValueError('You need to press computed first') messagebox.showerror('Error', 'You need to press computed first') else: self.ax...
Graph values of each iteration of method
Graph values of each iteration of method
[ "Graph", "values", "of", "each", "iteration", "of", "method" ]
def graph(self): if len(self.ts) == 0 or len(self.ts) == 0: messagebox.showerror('Error', 'You need to press computed first') else: self.ax.clear() self.ax.set_title('Solution graph') self.ax.scatter(self.ts[len(self.ts) - 1], self.ys[len(self.ys) - 1], ...
[ "def", "graph", "(", "self", ")", ":", "if", "len", "(", "self", ".", "ts", ")", "==", "0", "or", "len", "(", "self", ".", "ts", ")", "==", "0", ":", "messagebox", ".", "showerror", "(", "'Error'", ",", "'You need to press computed first'", ")", "els...
Graph values of each iteration of method
[ "Graph", "values", "of", "each", "iteration", "of", "method" ]
[ "\"\"\"\n Graph values of each iteration of method\n \"\"\"", "# raise ValueError('You need to press computed first')" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
691dbf9ace3568eccd9366364501bce73b648e52
okfde/froide-fax
froide_fax/views.py
[ "MIT" ]
Python
form_valid
<not_specific>
def form_valid(self, form): """If the form is valid, redirect to the supplied URL.""" sig = form.save() if sig: messages.add_message( self.request, messages.SUCCESS, _("Signature has been saved.") ) else: messages.add_message( ...
If the form is valid, redirect to the supplied URL.
If the form is valid, redirect to the supplied URL.
[ "If", "the", "form", "is", "valid", "redirect", "to", "the", "supplied", "URL", "." ]
def form_valid(self, form): sig = form.save() if sig: messages.add_message( self.request, messages.SUCCESS, _("Signature has been saved.") ) else: messages.add_message( self.request, messages.SUCCESS, _("Signature has been remov...
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "sig", "=", "form", ".", "save", "(", ")", "if", "sig", ":", "messages", ".", "add_message", "(", "self", ".", "request", ",", "messages", ".", "SUCCESS", ",", "_", "(", "\"Signature has been sav...
If the form is valid, redirect to the supplied URL.
[ "If", "the", "form", "is", "valid", "redirect", "to", "the", "supplied", "URL", "." ]
[ "\"\"\"If the form is valid, redirect to the supplied URL.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "form", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "form", "type": null, "docstring": null, "docstring_tokens": [...
adc2491f9f5e7ce344978dddf866ce233c6e022a
okfde/froide-fax
froide_fax/fax.py
[ "MIT" ]
Python
patch_requests_only_ipv4
null
def patch_requests_only_ipv4(): """ Patch requests to force use of IPv4 """ original_func = urllib3_cn.allowed_gai_family urllib3_cn.allowed_gai_family = lambda: socket.AF_INET yield urllib3_cn.allowed_gai_family = original_func
Patch requests to force use of IPv4
Patch requests to force use of IPv4
[ "Patch", "requests", "to", "force", "use", "of", "IPv4" ]
def patch_requests_only_ipv4(): original_func = urllib3_cn.allowed_gai_family urllib3_cn.allowed_gai_family = lambda: socket.AF_INET yield urllib3_cn.allowed_gai_family = original_func
[ "def", "patch_requests_only_ipv4", "(", ")", ":", "original_func", "=", "urllib3_cn", ".", "allowed_gai_family", "urllib3_cn", ".", "allowed_gai_family", "=", "lambda", ":", "socket", ".", "AF_INET", "yield", "urllib3_cn", ".", "allowed_gai_family", "=", "original_fun...
Patch requests to force use of IPv4
[ "Patch", "requests", "to", "force", "use", "of", "IPv4" ]
[ "\"\"\"\n Patch requests to force use of IPv4\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
adc2491f9f5e7ce344978dddf866ce233c6e022a
okfde/froide-fax
froide_fax/fax.py
[ "MIT" ]
Python
send_fax_telnyx
<not_specific>
def send_fax_telnyx( to, from_, media_url, connection_id, authorization="", quality="high", ): """this sends a single message through the telnyx fax gateway results / error to be handled by calling instance""" data = { "to": to, "from": from_, "media_url": med...
this sends a single message through the telnyx fax gateway results / error to be handled by calling instance
this sends a single message through the telnyx fax gateway results / error to be handled by calling instance
[ "this", "sends", "a", "single", "message", "through", "the", "telnyx", "fax", "gateway", "results", "/", "error", "to", "be", "handled", "by", "calling", "instance" ]
def send_fax_telnyx( to, from_, media_url, connection_id, authorization="", quality="high", ): data = { "to": to, "from": from_, "media_url": media_url, "connection_id": connection_id, "quality": quality, } headers = { "Authorizatio...
[ "def", "send_fax_telnyx", "(", "to", ",", "from_", ",", "media_url", ",", "connection_id", ",", "authorization", "=", "\"\"", ",", "quality", "=", "\"high\"", ",", ")", ":", "data", "=", "{", "\"to\"", ":", "to", ",", "\"from\"", ":", "from_", ",", "\"...
this sends a single message through the telnyx fax gateway results / error to be handled by calling instance
[ "this", "sends", "a", "single", "message", "through", "the", "telnyx", "fax", "gateway", "results", "/", "error", "to", "be", "handled", "by", "calling", "instance" ]
[ "\"\"\"this sends a single message through the telnyx fax gateway\n results / error to be handled by calling instance\"\"\"", "# this is a misnomer, app_id goes here", "# choice of normal, high, very_high" ]
[ { "param": "to", "type": null }, { "param": "from_", "type": null }, { "param": "media_url", "type": null }, { "param": "connection_id", "type": null }, { "param": "authorization", "type": null }, { "param": "quality", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "to", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "from_", "type": null, "docstring": null, "docstring_tokens": []...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
GET
<not_specific>
def GET(self): """ GETs the information about the rest server and renders it. :return: returns the information """ return "Hemlock RESTful Server."
GETs the information about the rest server and renders it. :return: returns the information
GETs the information about the rest server and renders it.
[ "GETs", "the", "information", "about", "the", "rest", "server", "and", "renders", "it", "." ]
def GET(self): return "Hemlock RESTful Server."
[ "def", "GET", "(", "self", ")", ":", "return", "\"Hemlock RESTful Server.\"" ]
GETs the information about the rest server and renders it.
[ "GETs", "the", "information", "about", "the", "rest", "server", "and", "renders", "it", "." ]
[ "\"\"\"\n GETs the information about the rest server and renders it.\n\n :return: returns the information\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the information", "docstring_tokens": [ "returns", "the", "information" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_to...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
GET
<not_specific>
def GET(self): """ GETs the version of the rest server and renders it. :return: returns the version """ return "0.1.6"
GETs the version of the rest server and renders it. :return: returns the version
GETs the version of the rest server and renders it.
[ "GETs", "the", "version", "of", "the", "rest", "server", "and", "renders", "it", "." ]
def GET(self): return "0.1.6"
[ "def", "GET", "(", "self", ")", ":", "return", "\"0.1.6\"" ]
GETs the version of the rest server and renders it.
[ "GETs", "the", "version", "of", "the", "rest", "server", "and", "renders", "it", "." ]
[ "\"\"\"\n GETs the version of the rest server and renders it.\n\n :return: returns the version\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the version", "docstring_tokens": [ "returns", "the", "version" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
GET
<not_specific>
def GET(self): """ GETs the favicon for http requests. :return: returns the favicon """ f = open("static/favicon.ico", 'rb') web.header("Content-Type","image/x-icon") return f.read()
GETs the favicon for http requests. :return: returns the favicon
GETs the favicon for http requests.
[ "GETs", "the", "favicon", "for", "http", "requests", "." ]
def GET(self): f = open("static/favicon.ico", 'rb') web.header("Content-Type","image/x-icon") return f.read()
[ "def", "GET", "(", "self", ")", ":", "f", "=", "open", "(", "\"static/favicon.ico\"", ",", "'rb'", ")", "web", ".", "header", "(", "\"Content-Type\"", ",", "\"image/x-icon\"", ")", "return", "f", ".", "read", "(", ")" ]
GETs the favicon for http requests.
[ "GETs", "the", "favicon", "for", "http", "requests", "." ]
[ "\"\"\"\n GETs the favicon for http requests.\n\n :return: returns the favicon\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the favicon", "docstring_tokens": [ "returns", "the", "favicon" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
POST
<not_specific>
def POST(self): """ POSTs the authentication for the query and returns the query respond specific to the user credentials provided. :return: returns the results of the query """ try: self.data = ast.literal_eval(self.data) # !! TODO add no_couchba...
POSTs the authentication for the query and returns the query respond specific to the user credentials provided. :return: returns the results of the query
POSTs the authentication for the query and returns the query respond specific to the user credentials provided.
[ "POSTs", "the", "authentication", "for", "the", "query", "and", "returns", "the", "query", "respond", "specific", "to", "the", "user", "credentials", "provided", "." ]
def POST(self): try: self.data = ast.literal_eval(self.data) cmd = "hemlock query-data --user "+self.data['user']+" --query "+self.data['query'] child = pexpect.spawn(cmd) child.expect('Password:') child.sendline(self.data['password']) retu...
[ "def", "POST", "(", "self", ")", ":", "try", ":", "self", ".", "data", "=", "ast", ".", "literal_eval", "(", "self", ".", "data", ")", "cmd", "=", "\"hemlock query-data --user \"", "+", "self", ".", "data", "[", "'user'", "]", "+", "\" --query \"", "+"...
POSTs the authentication for the query and returns the query respond specific to the user credentials provided.
[ "POSTs", "the", "authentication", "for", "the", "query", "and", "returns", "the", "query", "respond", "specific", "to", "the", "user", "credentials", "provided", "." ]
[ "\"\"\"\n POSTs the authentication for the query and returns the query respond\n specific to the user credentials provided.\n\n :return: returns the results of the query\n \"\"\"", "# !! TODO add no_couchbase flag" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the results of the query", "docstring_tokens": [ "returns", "the", "results", "of", "the", "query" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type":...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
GET
<not_specific>
def GET(self): """ GETs the schemas of all data that is stored in Hemlock. :return: returns the fields in all schemas stored in Hemlock """ # !! TODO placeholder true = True false = False null = None try: mapping = urllib2.urlopen("htt...
GETs the schemas of all data that is stored in Hemlock. :return: returns the fields in all schemas stored in Hemlock
GETs the schemas of all data that is stored in Hemlock.
[ "GETs", "the", "schemas", "of", "all", "data", "that", "is", "stored", "in", "Hemlock", "." ]
def GET(self): true = True false = False null = None try: mapping = urllib2.urlopen("http://localhost:9200/_mapping").read() mapping = json.loads(mapping) return sorted(mapping["hemlock"]["couchbaseDocument"]["properties"]["doc"]["properties"].keys()) ...
[ "def", "GET", "(", "self", ")", ":", "true", "=", "True", "false", "=", "False", "null", "=", "None", "try", ":", "mapping", "=", "urllib2", ".", "urlopen", "(", "\"http://localhost:9200/_mapping\"", ")", ".", "read", "(", ")", "mapping", "=", "json", ...
GETs the schemas of all data that is stored in Hemlock.
[ "GETs", "the", "schemas", "of", "all", "data", "that", "is", "stored", "in", "Hemlock", "." ]
[ "\"\"\"\n GETs the schemas of all data that is stored in Hemlock.\n\n :return: returns the fields in all schemas stored in Hemlock\n \"\"\"", "# !! TODO placeholder" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the fields in all schemas stored in Hemlock", "docstring_tokens": [ "returns", "the", "fields", "in", "all", "schemas", "stored", "in", "Hemlock" ], "type": null } ], "rai...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
POST
<not_specific>
def POST(self): """ POSTs the create actions of the API. :return: returns the result of the action """ cmd = "" try: self.data = ast.literal_eval(self.data) if "role" in self.fullpath: cmd = "hemlock role-create --name "+self.data[...
POSTs the create actions of the API. :return: returns the result of the action
POSTs the create actions of the API.
[ "POSTs", "the", "create", "actions", "of", "the", "API", "." ]
def POST(self): cmd = "" try: self.data = ast.literal_eval(self.data) if "role" in self.fullpath: cmd = "hemlock role-create --name "+self.data['name'] return os.popen(cmd).read() elif "schedule_server" in self.fullpath: ...
[ "def", "POST", "(", "self", ")", ":", "cmd", "=", "\"\"", "try", ":", "self", ".", "data", "=", "ast", ".", "literal_eval", "(", "self", ".", "data", ")", "if", "\"role\"", "in", "self", ".", "fullpath", ":", "cmd", "=", "\"hemlock role-create --name \...
POSTs the create actions of the API.
[ "POSTs", "the", "create", "actions", "of", "the", "API", "." ]
[ "\"\"\"\n POSTs the create actions of the API.\n\n :return: returns the result of the action\n \"\"\"", "# !! TODO add no_coucnhase flag" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the result of the action", "docstring_tokens": [ "returns", "the", "result", "of", "the", "action" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type":...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
GET
<not_specific>
def GET(self, uuid): """ Performs the get actions of the API. :param uuid: the uuid of the item to get :return: returns the result of the action """ cmd = "" try: if "role" in self.fullpath: cmd = "hemlock role-get --uuid "+uuid ...
Performs the get actions of the API. :param uuid: the uuid of the item to get :return: returns the result of the action
Performs the get actions of the API.
[ "Performs", "the", "get", "actions", "of", "the", "API", "." ]
def GET(self, uuid): cmd = "" try: if "role" in self.fullpath: cmd = "hemlock role-get --uuid "+uuid elif "schedule_server" in self.fullpath: cmd = "hemlock schedule-server-get --uuid "+uuid elif "system" in self.fullpath: ...
[ "def", "GET", "(", "self", ",", "uuid", ")", ":", "cmd", "=", "\"\"", "try", ":", "if", "\"role\"", "in", "self", ".", "fullpath", ":", "cmd", "=", "\"hemlock role-get --uuid \"", "+", "uuid", "elif", "\"schedule_server\"", "in", "self", ".", "fullpath", ...
Performs the get actions of the API.
[ "Performs", "the", "get", "actions", "of", "the", "API", "." ]
[ "\"\"\"\n Performs the get actions of the API.\n\n :param uuid: the uuid of the item to get\n :return: returns the result of the action\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "uuid", "type": null } ]
{ "returns": [ { "docstring": "returns the result of the action", "docstring_tokens": [ "returns", "the", "result", "of", "the", "action" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type":...
4c9765d293524b181b615a849021e1bbbb289eef
Lab41/Hemlock-REST
hemlock_rest/hemlock_rest.py
[ "Apache-2.0" ]
Python
POST
<not_specific>
def POST(self): """ Performs the register action of the API. :return: returns the result of the action """ cmd = "" try: self.data = ast.literal_eval(self.data) if "local" in self.fullpath: cmd = "hemlock register-local-system --na...
Performs the register action of the API. :return: returns the result of the action
Performs the register action of the API.
[ "Performs", "the", "register", "action", "of", "the", "API", "." ]
def POST(self): cmd = "" try: self.data = ast.literal_eval(self.data) if "local" in self.fullpath: cmd = "hemlock register-local-system --name "+self.data['name']+" --data_type "+self.data['data_type']+" --description "+self.data['description']+" --tenant_id "+sel...
[ "def", "POST", "(", "self", ")", ":", "cmd", "=", "\"\"", "try", ":", "self", ".", "data", "=", "ast", ".", "literal_eval", "(", "self", ".", "data", ")", "if", "\"local\"", "in", "self", ".", "fullpath", ":", "cmd", "=", "\"hemlock register-local-syst...
Performs the register action of the API.
[ "Performs", "the", "register", "action", "of", "the", "API", "." ]
[ "\"\"\"\n Performs the register action of the API.\n\n :return: returns the result of the action\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "returns the result of the action", "docstring_tokens": [ "returns", "the", "result", "of", "the", "action" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type":...
215ecb498c9f5806b929a2b901e5f42c4622365a
mcferrenm/musicinformationretrieval.com
realtime_spectrogram.py
[ "MIT" ]
Python
generate_string_from_audio
<not_specific>
def generate_string_from_audio(audio_data): """ This function takes one audio buffer as a numpy array and returns a string to be printed to the terminal. """ # Compute real FFT. x_fft = numpy.fft.rfft(audio_data, n=N_FFT) # Compute mel spectrum. melspectrum = M.dot(abs(x_fft)) # In...
This function takes one audio buffer as a numpy array and returns a string to be printed to the terminal.
This function takes one audio buffer as a numpy array and returns a string to be printed to the terminal.
[ "This", "function", "takes", "one", "audio", "buffer", "as", "a", "numpy", "array", "and", "returns", "a", "string", "to", "be", "printed", "to", "the", "terminal", "." ]
def generate_string_from_audio(audio_data): x_fft = numpy.fft.rfft(audio_data, n=N_FFT) melspectrum = M.dot(abs(x_fft)) char_list = [' ']*SCREEN_WIDTH for i in range(SCREEN_WIDTH): if melspectrum[i] > ENERGY_THRESHOLD: char_list[i] = '*' elif i % 30 == 29: char_li...
[ "def", "generate_string_from_audio", "(", "audio_data", ")", ":", "x_fft", "=", "numpy", ".", "fft", ".", "rfft", "(", "audio_data", ",", "n", "=", "N_FFT", ")", "melspectrum", "=", "M", ".", "dot", "(", "abs", "(", "x_fft", ")", ")", "char_list", "=",...
This function takes one audio buffer as a numpy array and returns a string to be printed to the terminal.
[ "This", "function", "takes", "one", "audio", "buffer", "as", "a", "numpy", "array", "and", "returns", "a", "string", "to", "be", "printed", "to", "the", "terminal", "." ]
[ "\"\"\"\n This function takes one audio buffer as a numpy array and returns a\n string to be printed to the terminal.\n \"\"\"", "# Compute real FFT.", "# Compute mel spectrum.", "# Initialize output characters to display.", "# If there is energy in this frequency bin, display an asterisk.", "# D...
[ { "param": "audio_data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "audio_data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6b36d335c59ae38ddfdf7e1ec752bbb57919b2b1
mcferrenm/musicinformationretrieval.com
crossValidationTemplate.py
[ "MIT" ]
Python
crossValidateKNN
<not_specific>
def crossValidateKNN(features, labels): """ This code is provided as a template for cross-validation of KNN classification. Pass into the variables "features", "labels" your own data. As well, you can replace the code in the "BUILD" and "EVALUATE" sections to be useful with other types of Classifi...
This code is provided as a template for cross-validation of KNN classification. Pass into the variables "features", "labels" your own data. As well, you can replace the code in the "BUILD" and "EVALUATE" sections to be useful with other types of Classifiers.
This code is provided as a template for cross-validation of KNN classification. Pass into the variables "features", "labels" your own data. As well, you can replace the code in the "BUILD" and "EVALUATE" sections to be useful with other types of Classifiers.
[ "This", "code", "is", "provided", "as", "a", "template", "for", "cross", "-", "validation", "of", "KNN", "classification", ".", "Pass", "into", "the", "variables", "\"", "features", "\"", "\"", "labels", "\"", "your", "own", "data", ".", "As", "well", "y...
def crossValidateKNN(features, labels): CROSS VALIDATION The features array is arranged as rows of instances, columns of features in our training set. numInstances, numFeatures = features.shape numFolds = min(10, numInstances) how many cross-validation folds do you want - (default=10) divide te...
[ "def", "crossValidateKNN", "(", "features", ",", "labels", ")", ":", "numInstances", ",", "numFeatures", "=", "features", ".", "shape", "numFolds", "=", "min", "(", "10", ",", "numInstances", ")", "indices", "=", "cross_validation", ".", "KFold", "(", "numIn...
This code is provided as a template for cross-validation of KNN classification.
[ "This", "code", "is", "provided", "as", "a", "template", "for", "cross", "-", "validation", "of", "KNN", "classification", "." ]
[ "\"\"\"\n This code is provided as a template for cross-validation of KNN classification.\n Pass into the variables \"features\", \"labels\" your own data. \n\n As well, you can replace the code in the \"BUILD\" and \"EVALUATE\" sections\n to be useful with other types of Classifiers.\n \"\"\"", "#...
[ { "param": "features", "type": null }, { "param": "labels", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "features", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "labels", "type": null, "docstring": null, "docstring_toke...
6b36d335c59ae38ddfdf7e1ec752bbb57919b2b1
mcferrenm/musicinformationretrieval.com
crossValidationTemplate.py
[ "MIT" ]
Python
spectral_features
<not_specific>
def spectral_features(filelist): """ Given a list of files, retrieve them, analyse the first 100mS of each file and return a feature table. """ number_of_files = len(filelist) number_of_features = 5 features = np.zeros([number_of_files, number_of_features]) sample_rate = 44100 for f...
Given a list of files, retrieve them, analyse the first 100mS of each file and return a feature table.
Given a list of files, retrieve them, analyse the first 100mS of each file and return a feature table.
[ "Given", "a", "list", "of", "files", "retrieve", "them", "analyse", "the", "first", "100mS", "of", "each", "file", "and", "return", "a", "feature", "table", "." ]
def spectral_features(filelist): number_of_files = len(filelist) number_of_features = 5 features = np.zeros([number_of_files, number_of_features]) sample_rate = 44100 for file_index, url in enumerate(filelist): print url urllib.urlretrieve(url, filename='/tmp/localfile.wav') ...
[ "def", "spectral_features", "(", "filelist", ")", ":", "number_of_files", "=", "len", "(", "filelist", ")", "number_of_features", "=", "5", "features", "=", "np", ".", "zeros", "(", "[", "number_of_files", ",", "number_of_features", "]", ")", "sample_rate", "=...
Given a list of files, retrieve them, analyse the first 100mS of each file and return a feature table.
[ "Given", "a", "list", "of", "files", "retrieve", "them", "analyse", "the", "first", "100mS", "of", "each", "file", "and", "return", "a", "feature", "table", "." ]
[ "\"\"\"\n Given a list of files, retrieve them, analyse the first 100mS of each file and return\n a feature table.\n \"\"\"", "# we need to window the frame to avoid FFT artifacts.", "# 100ms", "# Only do the first frame for now.", "# TODO we should generate values for the entire file, probably by ...
[ { "param": "filelist", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filelist", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
641657f97e63667f2464bbdfa363e25898cd18ae
mcferrenm/musicinformationretrieval.com
stanford_mir.py
[ "MIT" ]
Python
download_samples
<not_specific>
def download_samples(collection='drum_samples_train', download=True): """Download ten kick drum samples and ten snare drum samples. `collection`: output directory containing the twenty drum samples Returns: `kick_filepaths`: list of kick drum filepaths `snare_filepaths`: list of snar...
Download ten kick drum samples and ten snare drum samples. `collection`: output directory containing the twenty drum samples Returns: `kick_filepaths`: list of kick drum filepaths `snare_filepaths`: list of snare drum filepaths
Download ten kick drum samples and ten snare drum samples. `collection`: output directory containing the twenty drum samples
[ "Download", "ten", "kick", "drum", "samples", "and", "ten", "snare", "drum", "samples", ".", "`", "collection", "`", ":", "output", "directory", "containing", "the", "twenty", "drum", "samples" ]
def download_samples(collection='drum_samples_train', download=True): try: os.makedirs(collection) except OSError as exception: if exception.errno != errno.EEXIST: raise if collection == 'drum_samples_train': if download: for drum_type in ['kick', 'snare']: ...
[ "def", "download_samples", "(", "collection", "=", "'drum_samples_train'", ",", "download", "=", "True", ")", ":", "try", ":", "os", ".", "makedirs", "(", "collection", ")", "except", "OSError", "as", "exception", ":", "if", "exception", ".", "errno", "!=", ...
Download ten kick drum samples and ten snare drum samples.
[ "Download", "ten", "kick", "drum", "samples", "and", "ten", "snare", "drum", "samples", "." ]
[ "\"\"\"Download ten kick drum samples and ten snare drum samples.\n\n `collection`: output directory containing the twenty drum samples\n\n Returns:\n\n `kick_filepaths`: list of kick drum filepaths\n\n `snare_filepaths`: list of snare drum filepaths\n \"\"\"" ]
[ { "param": "collection", "type": null }, { "param": "download", "type": null } ]
{ "returns": [ { "docstring": "list of kick drum filepaths\n`snare_filepaths`: list of snare drum filepaths", "docstring_tokens": [ "list", "of", "kick", "drum", "filepaths", "`", "snare_filepaths", "`", ":", "list", ...
2133d1524e70eb5d35d9f818cc83ddbea660e11f
crusaderky/validators
fuzzyfields/strings.py
[ "Apache-2.0" ]
Python
validate
str
def validate(self, value: Any) -> str: """Validate input string and convert it to uppercase """ if not isinstance(value, str): raise FieldTypeError(self.name, value, 'string') uvalue = value.upper() if not self._re.match(uvalue): raise MalformedFieldError(...
Validate input string and convert it to uppercase
Validate input string and convert it to uppercase
[ "Validate", "input", "string", "and", "convert", "it", "to", "uppercase" ]
def validate(self, value: Any) -> str: if not isinstance(value, str): raise FieldTypeError(self.name, value, 'string') uvalue = value.upper() if not self._re.match(uvalue): raise MalformedFieldError(self.name, value, self.sphinxdoc) return uvalue
[ "def", "validate", "(", "self", ",", "value", ":", "Any", ")", "->", "str", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "FieldTypeError", "(", "self", ".", "name", ",", "value", ",", "'string'", ")", "uvalue", "=", ...
Validate input string and convert it to uppercase
[ "Validate", "input", "string", "and", "convert", "it", "to", "uppercase" ]
[ "\"\"\"Validate input string and convert it to uppercase\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "Any", "docstring": null, "docstring_tokens":...
bb97b1c0be30e44c6338588d38d7d6e9ad701092
crusaderky/validators
fuzzyfields/tests/__init__.py
[ "Apache-2.0" ]
Python
_import_or_skip
<not_specific>
def _import_or_skip(modname, minversion=None): """Build skip markers for a optional module :param str modname: Name of the optional module :param str minversion: Minimum required version :return: Tuple of has_module (bool) True if the module is available and...
Build skip markers for a optional module :param str modname: Name of the optional module :param str minversion: Minimum required version :return: Tuple of has_module (bool) True if the module is available and >= minversion requires_module (decorator) ...
Build skip markers for a optional module
[ "Build", "skip", "markers", "for", "a", "optional", "module" ]
def _import_or_skip(modname, minversion=None): reason = 'requires %s' % modname if minversion: reason += '>=%s' % minversion try: mod = importlib.import_module(modname) has = True except ImportError: has = False if (has and minversion and LooseVersion(mod....
[ "def", "_import_or_skip", "(", "modname", ",", "minversion", "=", "None", ")", ":", "reason", "=", "'requires %s'", "%", "modname", "if", "minversion", ":", "reason", "+=", "'>=%s'", "%", "minversion", "try", ":", "mod", "=", "importlib", ".", "import_module...
Build skip markers for a optional module
[ "Build", "skip", "markers", "for", "a", "optional", "module" ]
[ "\"\"\"Build skip markers for a optional module\n\n :param str modname:\n Name of the optional module\n :param str minversion:\n Minimum required version\n :return:\n Tuple of\n\n has_module (bool)\n True if the module is available and >= minversion\n requires_...
[ { "param": "modname", "type": null }, { "param": "minversion", "type": null } ]
{ "returns": [ { "docstring": "Tuple of\nhas_module (bool)\nTrue if the module is available and >= minversion\nrequires_module (decorator)\nTests decorated with it will only run if the module is available\nand >= minversion", "docstring_tokens": [ "Tuple", "of", "has_module", ...
da9a64e68a6c38558153dc47f88e5dfc953985d2
crusaderky/validators
fuzzyfields/tools.py
[ "Apache-2.0" ]
Python
isnull
bool
def isnull(x) -> bool: """Reimplementation of :func:`pandas.isnull`, with the following differences: - doesn't require numpy/pandas - scalar only - guaranteed to return a single bool - supports decimal.Decimal """ if isinstance(x, (list, numpy.ndarray)): ...
Reimplementation of :func:`pandas.isnull`, with the following differences: - doesn't require numpy/pandas - scalar only - guaranteed to return a single bool - supports decimal.Decimal
Reimplementation of :func:`pandas.isnull`, with the following differences. doesn't require numpy/pandas scalar only guaranteed to return a single bool supports decimal.Decimal
[ "Reimplementation", "of", ":", "func", ":", "`", "pandas", ".", "isnull", "`", "with", "the", "following", "differences", ".", "doesn", "'", "t", "require", "numpy", "/", "pandas", "scalar", "only", "guaranteed", "to", "return", "a", "single", "bool", "sup...
def isnull(x) -> bool: if isinstance(x, (list, numpy.ndarray)): return False if isinstance(x, (float, decimal.Decimal)): return math.isnan(x) return pandas.isnull(x)
[ "def", "isnull", "(", "x", ")", "->", "bool", ":", "if", "isinstance", "(", "x", ",", "(", "list", ",", "numpy", ".", "ndarray", ")", ")", ":", "return", "False", "if", "isinstance", "(", "x", ",", "(", "float", ",", "decimal", ".", "Decimal", ")...
Reimplementation of :func:`pandas.isnull`, with the following differences:
[ "Reimplementation", "of", ":", "func", ":", "`", "pandas", ".", "isnull", "`", "with", "the", "following", "differences", ":" ]
[ "\"\"\"Reimplementation of :func:`pandas.isnull`, with the following\n differences:\n\n - doesn't require numpy/pandas\n - scalar only\n - guaranteed to return a single bool\n - supports decimal.Decimal\n \"\"\"" ]
[ { "param": "x", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c85b54cb1230cd357c4b28b0b215a22063d8f6fa
crusaderky/validators
fuzzyfields/numbers.py
[ "Apache-2.0" ]
Python
validate
Union[float, int, decimal.Decimal, None]
def validate(self, value: Any) -> Union[float, int, decimal.Decimal, None]: """Convert a number or a string representation of a number to a validated number. :param value: string representing a number, possibly with thousands separator or in accounting negative format, e...
Convert a number or a string representation of a number to a validated number. :param value: string representing a number, possibly with thousands separator or in accounting negative format, e.g. (5,000.200) ==> -5000.2, or any number-like object :rtype: ...
Convert a number or a string representation of a number to a validated number. :param value: string representing a number, possibly with thousands separator or in accounting negative format, e.g.
[ "Convert", "a", "number", "or", "a", "string", "representation", "of", "a", "number", "to", "a", "validated", "number", ".", ":", "param", "value", ":", "string", "representing", "a", "number", "possibly", "with", "thousands", "separator", "or", "in", "accou...
def validate(self, value: Any) -> Union[float, int, decimal.Decimal, None]: if isinstance(value, str): value = value.replace(',', '') if value.startswith('(') and value.endswith(')'): value = '-' + value[1:-1] elif value.startswith('- ') and value.endswith(' -...
[ "def", "validate", "(", "self", ",", "value", ":", "Any", ")", "->", "Union", "[", "float", ",", "int", ",", "decimal", ".", "Decimal", ",", "None", "]", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "value", "=", "value", ".", "re...
Convert a number or a string representation of a number to a validated number.
[ "Convert", "a", "number", "or", "a", "string", "representation", "of", "a", "number", "to", "a", "validated", "number", "." ]
[ "\"\"\"Convert a number or a string representation of a number to a\n validated number.\n\n :param value:\n string representing a number, possibly with thousands separator\n or in accounting negative format, e.g. (5,000.200) ==> -5000.2,\n or any number-like object\n ...
[ { "param": "self", "type": null }, { "param": "value", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "Any", "docstring": null, "docstring_tokens":...
c85b54cb1230cd357c4b28b0b215a22063d8f6fa
crusaderky/validators
fuzzyfields/numbers.py
[ "Apache-2.0" ]
Python
domain_str
str
def domain_str(self) -> str: """String representation of the allowed domain, e.g. "]-1, 1] non-zero" """ lbracket = '[' if self.allow_min else ']' rbracket = ']' if self.allow_max else '[' msg = f'{lbracket}{self.min_value}, {self.max_value}{rbracket}' if not self.allow_z...
String representation of the allowed domain, e.g. "]-1, 1] non-zero"
String representation of the allowed domain, e.g.
[ "String", "representation", "of", "the", "allowed", "domain", "e", ".", "g", "." ]
def domain_str(self) -> str: lbracket = '[' if self.allow_min else ']' rbracket = ']' if self.allow_max else '[' msg = f'{lbracket}{self.min_value}, {self.max_value}{rbracket}' if not self.allow_zero: msg += ' non-zero' return msg
[ "def", "domain_str", "(", "self", ")", "->", "str", ":", "lbracket", "=", "'['", "if", "self", ".", "allow_min", "else", "']'", "rbracket", "=", "']'", "if", "self", ".", "allow_max", "else", "'['", "msg", "=", "f'{lbracket}{self.min_value}, {self.max_value}{r...
String representation of the allowed domain, e.g.
[ "String", "representation", "of", "the", "allowed", "domain", "e", ".", "g", "." ]
[ "\"\"\"String representation of the allowed domain, e.g. \"]-1, 1] non-zero\"\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c85b54cb1230cd357c4b28b0b215a22063d8f6fa
crusaderky/validators
fuzzyfields/numbers.py
[ "Apache-2.0" ]
Python
_num_converter
float
def _num_converter(self, value: Any) -> float: """Convert string, int, or other to float """ try: return float(value) except TypeError: raise FieldTypeError(self.name, value, "number") except ValueError: raise MalformedFieldError(self.name, val...
Convert string, int, or other to float
Convert string, int, or other to float
[ "Convert", "string", "int", "or", "other", "to", "float" ]
def _num_converter(self, value: Any) -> float: try: return float(value) except TypeError: raise FieldTypeError(self.name, value, "number") except ValueError: raise MalformedFieldError(self.name, value, "number")
[ "def", "_num_converter", "(", "self", ",", "value", ":", "Any", ")", "->", "float", ":", "try", ":", "return", "float", "(", "value", ")", "except", "TypeError", ":", "raise", "FieldTypeError", "(", "self", ".", "name", ",", "value", ",", "\"number\"", ...
Convert string, int, or other to float
[ "Convert", "string", "int", "or", "other", "to", "float" ]
[ "\"\"\"Convert string, int, or other to float\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "Any", "docstring": null, "docstring_tokens":...
c85b54cb1230cd357c4b28b0b215a22063d8f6fa
crusaderky/validators
fuzzyfields/numbers.py
[ "Apache-2.0" ]
Python
_num_converter
decimal.Decimal
def _num_converter(self, value: Any) -> decimal.Decimal: """Convert string, float, or int to decimal.Decimal """ # Performance shortcut if isinstance(value, decimal.Decimal): return value orig_value = value # Remove leading zeros after comma, as they confuse ...
Convert string, float, or int to decimal.Decimal
Convert string, float, or int to decimal.Decimal
[ "Convert", "string", "float", "or", "int", "to", "decimal", ".", "Decimal" ]
def _num_converter(self, value: Any) -> decimal.Decimal: if isinstance(value, decimal.Decimal): return value orig_value = value if isinstance(value, str): value = value.upper() if 'E' in value: mantissa, _, exponent = value.partition('E') ...
[ "def", "_num_converter", "(", "self", ",", "value", ":", "Any", ")", "->", "decimal", ".", "Decimal", ":", "if", "isinstance", "(", "value", ",", "decimal", ".", "Decimal", ")", ":", "return", "value", "orig_value", "=", "value", "if", "isinstance", "(",...
Convert string, float, or int to decimal.Decimal
[ "Convert", "string", "float", "or", "int", "to", "decimal", ".", "Decimal" ]
[ "\"\"\"Convert string, float, or int to decimal.Decimal\n \"\"\"", "# Performance shortcut", "# Remove leading zeros after comma, as they confuse Decimal", "# e.g. Decimal('0.0000000000') -> Decimal(\"0E-10\")", "# Do not accidentally drop leading zeros in the exponent.", "# Scientific notation", ...
[ { "param": "self", "type": null }, { "param": "value", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "Any", "docstring": null, "docstring_tokens":...
c85b54cb1230cd357c4b28b0b215a22063d8f6fa
crusaderky/validators
fuzzyfields/numbers.py
[ "Apache-2.0" ]
Python
_num_converter
Union[float, None]
def _num_converter(self, value: Any) -> Union[float, None]: """Convert string, int, or other to float """ try: if isinstance(value, str) and value[-1] == '%': value = value[:-1].strip() if value in NA_VALUES: return None ...
Convert string, int, or other to float
Convert string, int, or other to float
[ "Convert", "string", "int", "or", "other", "to", "float" ]
def _num_converter(self, value: Any) -> Union[float, None]: try: if isinstance(value, str) and value[-1] == '%': value = value[:-1].strip() if value in NA_VALUES: return None return float(value) / 100 return float(value)...
[ "def", "_num_converter", "(", "self", ",", "value", ":", "Any", ")", "->", "Union", "[", "float", ",", "None", "]", ":", "try", ":", "if", "isinstance", "(", "value", ",", "str", ")", "and", "value", "[", "-", "1", "]", "==", "'%'", ":", "value",...
Convert string, int, or other to float
[ "Convert", "string", "int", "or", "other", "to", "float" ]
[ "\"\"\"Convert string, int, or other to float\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "Any", "docstring": null, "docstring_tokens":...
b411268a6d3efa65c50f7cb2209a2b8986e42cf5
crusaderky/validators
fuzzyfields/domain.py
[ "Apache-2.0" ]
Python
_parse_choices
None
def _parse_choices(self) -> None: """Parse choices and update several cache fields. This needs to be invoked after every time choices changes. """ self._has_numeric_choices = False self._choices_map = {} for v in self.choices: k = v if isinstance(...
Parse choices and update several cache fields. This needs to be invoked after every time choices changes.
Parse choices and update several cache fields. This needs to be invoked after every time choices changes.
[ "Parse", "choices", "and", "update", "several", "cache", "fields", ".", "This", "needs", "to", "be", "invoked", "after", "every", "time", "choices", "changes", "." ]
def _parse_choices(self) -> None: self._has_numeric_choices = False self._choices_map = {} for v in self.choices: k = v if isinstance(v, str) and not self.case_sensitive: k = v.lower() elif isinstance(v, (int, float, complex)): ...
[ "def", "_parse_choices", "(", "self", ")", "->", "None", ":", "self", ".", "_has_numeric_choices", "=", "False", "self", ".", "_choices_map", "=", "{", "}", "for", "v", "in", "self", ".", "choices", ":", "k", "=", "v", "if", "isinstance", "(", "v", "...
Parse choices and update several cache fields.
[ "Parse", "choices", "and", "update", "several", "cache", "fields", "." ]
[ "\"\"\"Parse choices and update several cache fields.\n This needs to be invoked after every time choices changes.\n \"\"\"", "# Build sorted list of choices, used for string representations", "# choices is a mix of incomparable types, e.g. (1, '2')" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e3aee91bf846373ff90fbf842e71104d76387e03
crusaderky/validators
fuzzyfields/dictreader.py
[ "Apache-2.0" ]
Python
line_num
int
def line_num(self) -> int: """Return line number of underlying file. :raises AttributeError: if the underlying iterator is not a :func:`csv.reader`, :class:`csv.DictReader`, or another duck-type compatible class """ return self.iterable.line_num
Return line number of underlying file. :raises AttributeError: if the underlying iterator is not a :func:`csv.reader`, :class:`csv.DictReader`, or another duck-type compatible class
Return line number of underlying file.
[ "Return", "line", "number", "of", "underlying", "file", "." ]
def line_num(self) -> int: return self.iterable.line_num
[ "def", "line_num", "(", "self", ")", "->", "int", ":", "return", "self", ".", "iterable", ".", "line_num" ]
Return line number of underlying file.
[ "Return", "line", "number", "of", "underlying", "file", "." ]
[ "\"\"\"Return line number of underlying file.\n\n :raises AttributeError:\n if the underlying iterator is not a :func:`csv.reader`,\n :class:`csv.DictReader`, or another duck-type compatible class\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "if the underlying iterator is not a :func:`csv.reader`,\n:class:`csv.DictReader`, or another duck-type compatible class", "docstring_tokens": [ "if", "the", "underlying", "iterator", "is", "not", "a"...
e3aee91bf846373ff90fbf842e71104d76387e03
crusaderky/validators
fuzzyfields/dictreader.py
[ "Apache-2.0" ]
Python
preprocess_row
Dict[str, Any]
def preprocess_row(self, row: Any) -> Dict[str, Any]: """Give child classes an opportunity to pre-process every row before feeding it to the FuzzyFields. This allows handling special cases. You must use this method to manipulate the row if the underlying iterator does not natively yield...
Give child classes an opportunity to pre-process every row before feeding it to the FuzzyFields. This allows handling special cases. You must use this method to manipulate the row if the underlying iterator does not natively yields dicts, e.g. a :func:`csv.reader` object. :para...
Give child classes an opportunity to pre-process every row before feeding it to the FuzzyFields. This allows handling special cases. You must use this method to manipulate the row if the underlying iterator does not natively yields dicts, e.g.
[ "Give", "child", "classes", "an", "opportunity", "to", "pre", "-", "process", "every", "row", "before", "feeding", "it", "to", "the", "FuzzyFields", ".", "This", "allows", "handling", "special", "cases", ".", "You", "must", "use", "this", "method", "to", "...
def preprocess_row(self, row: Any) -> Dict[str, Any]: return row
[ "def", "preprocess_row", "(", "self", ",", "row", ":", "Any", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "row" ]
Give child classes an opportunity to pre-process every row before feeding it to the FuzzyFields.
[ "Give", "child", "classes", "an", "opportunity", "to", "pre", "-", "process", "every", "row", "before", "feeding", "it", "to", "the", "FuzzyFields", "." ]
[ "\"\"\"Give child classes an opportunity to pre-process every row before\n feeding it to the FuzzyFields. This allows handling special cases.\n\n You must use this method to manipulate the row if the underlying\n iterator does not natively yields dicts, e.g. a :func:`csv.reader`\n object...
[ { "param": "self", "type": null }, { "param": "row", "type": "Any" } ]
{ "returns": [ { "docstring": "modified row, or None if the row should be skipped", "docstring_tokens": [ "modified", "row", "or", "None", "if", "the", "row", "should", "be", "skipped" ], "type": null } ]...
e3aee91bf846373ff90fbf842e71104d76387e03
crusaderky/validators
fuzzyfields/dictreader.py
[ "Apache-2.0" ]
Python
postprocess_row
Dict[str, Any]
def postprocess_row(self, row: Dict[str, Any]) -> Dict[str, Any]: """Give child classes an opportunity to post-process every row after it's been parsed by the FuzzyFields. This allows handling special cases and performing cross-field validation. :param row: The row as compos...
Give child classes an opportunity to post-process every row after it's been parsed by the FuzzyFields. This allows handling special cases and performing cross-field validation. :param row: The row as composed by the fields, after name mapping :return: Modified ro...
Give child classes an opportunity to post-process every row after it's been parsed by the FuzzyFields. This allows handling special cases and performing cross-field validation.
[ "Give", "child", "classes", "an", "opportunity", "to", "post", "-", "process", "every", "row", "after", "it", "'", "s", "been", "parsed", "by", "the", "FuzzyFields", ".", "This", "allows", "handling", "special", "cases", "and", "performing", "cross", "-", ...
def postprocess_row(self, row: Dict[str, Any]) -> Dict[str, Any]: return row
[ "def", "postprocess_row", "(", "self", ",", "row", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "row" ]
Give child classes an opportunity to post-process every row after it's been parsed by the FuzzyFields.
[ "Give", "child", "classes", "an", "opportunity", "to", "post", "-", "process", "every", "row", "after", "it", "'", "s", "been", "parsed", "by", "the", "FuzzyFields", "." ]
[ "\"\"\"Give child classes an opportunity to post-process every row after\n it's been parsed by the FuzzyFields. This allows handling special\n cases and performing cross-field validation.\n\n :param row:\n The row as composed by the fields, after name mapping\n :return:\n ...
[ { "param": "self", "type": null }, { "param": "row", "type": "Dict[str, Any]" } ]
{ "returns": [ { "docstring": "Modified row, or None if the row should be skipped", "docstring_tokens": [ "Modified", "row", "or", "None", "if", "the", "row", "should", "be", "skipped" ], "type": null } ]...
80ea1b75f1883c6bf0c4eaae391cda12f24c5732
crusaderky/validators
fuzzyfields/fuzzyfield.py
[ "Apache-2.0" ]
Python
preprocess
Any
def preprocess(value: Any) -> Any: """Perform initial cleanup of a raw input value. This method is automatically invoked before :meth:`FuzzyField.validate`. :param value: raw input value :returns: the argument, stripped of leading and trailing whitespace ...
Perform initial cleanup of a raw input value. This method is automatically invoked before :meth:`FuzzyField.validate`. :param value: raw input value :returns: the argument, stripped of leading and trailing whitespace and carriage returns if it is a string. ...
Perform initial cleanup of a raw input value. This method is automatically invoked before :meth:`FuzzyField.validate`.
[ "Perform", "initial", "cleanup", "of", "a", "raw", "input", "value", ".", "This", "method", "is", "automatically", "invoked", "before", ":", "meth", ":", "`", "FuzzyField", ".", "validate", "`", "." ]
def preprocess(value: Any) -> Any: if isinstance(value, str): value = value.strip() if value in NA_VALUES: return None elif isnull(value): return None return value
[ "def", "preprocess", "(", "value", ":", "Any", ")", "->", "Any", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "value", "=", "value", ".", "strip", "(", ")", "if", "value", "in", "NA_VALUES", ":", "return", "None", "elif", "isnull", ...
Perform initial cleanup of a raw input value.
[ "Perform", "initial", "cleanup", "of", "a", "raw", "input", "value", "." ]
[ "\"\"\"Perform initial cleanup of a raw input value. This method is\n automatically invoked before :meth:`FuzzyField.validate`.\n\n :param value:\n raw input value\n :returns:\n the argument, stripped of leading and trailing whitespace\n and carriage returns if ...
[ { "param": "value", "type": "Any" } ]
{ "returns": [ { "docstring": "the argument, stripped of leading and trailing whitespace\nand carriage returns if it is a string.\nIf the argument is null, return None.\nOtherwise return the argument unaltered.", "docstring_tokens": [ "the", "argument", "stripped", "of"...
80ea1b75f1883c6bf0c4eaae391cda12f24c5732
crusaderky/validators
fuzzyfields/fuzzyfield.py
[ "Apache-2.0" ]
Python
postprocess
Any
def postprocess(self, value: Any) -> Any: """Post-process the value after validating it and before storing it. This method is invoked after :meth:`FuzzyField.validate` and tests the ``required`` and ``unique`` flags. :raises MissingFieldError: if self.required is True and va...
Post-process the value after validating it and before storing it. This method is invoked after :meth:`FuzzyField.validate` and tests the ``required`` and ``unique`` flags. :raises MissingFieldError: if self.required is True and value is None :raises DuplicateError: ...
Post-process the value after validating it and before storing it.
[ "Post", "-", "process", "the", "value", "after", "validating", "it", "and", "before", "storing", "it", "." ]
def postprocess(self, value: Any) -> Any: if value is None: if self.required: raise MissingFieldError(self.name) return self.default if self.unique: if value is None: return value try: if value in self.seen_v...
[ "def", "postprocess", "(", "self", ",", "value", ":", "Any", ")", "->", "Any", ":", "if", "value", "is", "None", ":", "if", "self", ".", "required", ":", "raise", "MissingFieldError", "(", "self", ".", "name", ")", "return", "self", ".", "default", "...
Post-process the value after validating it and before storing it.
[ "Post", "-", "process", "the", "value", "after", "validating", "it", "and", "before", "storing", "it", "." ]
[ "\"\"\"Post-process the value after validating it and before storing it.\n This method is invoked after :meth:`FuzzyField.validate` and\n tests the ``required`` and ``unique`` flags.\n\n :raises MissingFieldError:\n if self.required is True and value is None\n :raises Duplicat...
[ { "param": "self", "type": null }, { "param": "value", "type": "Any" } ]
{ "returns": [], "raises": [ { "docstring": "if self.required is True and value is None", "docstring_tokens": [ "if", "self", ".", "required", "is", "True", "and", "value", "is", "None" ], "type": "MissingFie...
80ea1b75f1883c6bf0c4eaae391cda12f24c5732
crusaderky/validators
fuzzyfields/fuzzyfield.py
[ "Apache-2.0" ]
Python
copy
<not_specific>
def copy(self): """Shallow copy of self. The seen_values set is recreated as an empty set. """ res = object.__new__(type(self)) res.__dict__.update(self.__dict__) if res.unique: res.seen_values = set() return res
Shallow copy of self. The seen_values set is recreated as an empty set.
Shallow copy of self. The seen_values set is recreated as an empty set.
[ "Shallow", "copy", "of", "self", ".", "The", "seen_values", "set", "is", "recreated", "as", "an", "empty", "set", "." ]
def copy(self): res = object.__new__(type(self)) res.__dict__.update(self.__dict__) if res.unique: res.seen_values = set() return res
[ "def", "copy", "(", "self", ")", ":", "res", "=", "object", ".", "__new__", "(", "type", "(", "self", ")", ")", "res", ".", "__dict__", ".", "update", "(", "self", ".", "__dict__", ")", "if", "res", ".", "unique", ":", "res", ".", "seen_values", ...
Shallow copy of self.
[ "Shallow", "copy", "of", "self", "." ]
[ "\"\"\"Shallow copy of self. The seen_values set is recreated as an\n empty set.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
80ea1b75f1883c6bf0c4eaae391cda12f24c5732
crusaderky/validators
fuzzyfields/fuzzyfield.py
[ "Apache-2.0" ]
Python
sphinxdoc
str
def sphinxdoc(self) -> str: """Virtual property - to be overridden. Automated documentation that will appear in Sphinx. It should not include the name, owner, required, default, unique, or description attributes. """ raise NotImplementedError()
Virtual property - to be overridden. Automated documentation that will appear in Sphinx. It should not include the name, owner, required, default, unique, or description attributes.
Virtual property - to be overridden. Automated documentation that will appear in Sphinx. It should not include the name, owner, required, default, unique, or description attributes.
[ "Virtual", "property", "-", "to", "be", "overridden", ".", "Automated", "documentation", "that", "will", "appear", "in", "Sphinx", ".", "It", "should", "not", "include", "the", "name", "owner", "required", "default", "unique", "or", "description", "attributes", ...
def sphinxdoc(self) -> str: raise NotImplementedError()
[ "def", "sphinxdoc", "(", "self", ")", "->", "str", ":", "raise", "NotImplementedError", "(", ")" ]
Virtual property - to be overridden.
[ "Virtual", "property", "-", "to", "be", "overridden", "." ]
[ "\"\"\"Virtual property - to be overridden.\n Automated documentation that will appear in Sphinx.\n It should not include the name, owner, required, default, unique, or\n description attributes.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c5351d48ad219313401caf0985e4697e8efaaffc
crusaderky/validators
fuzzyfields/datetime.py
[ "Apache-2.0" ]
Python
_parse_outofbounds
<not_specific>
def _parse_outofbounds(self, value): """Deal with dates out of the range supported by pandas.Timestamp :param str value: YYYY-MM-DD hh:mm:ss :returns: parsed value depending on self.output """ import numpy import pandas if self.output == ...
Deal with dates out of the range supported by pandas.Timestamp :param str value: YYYY-MM-DD hh:mm:ss :returns: parsed value depending on self.output
Deal with dates out of the range supported by pandas.Timestamp
[ "Deal", "with", "dates", "out", "of", "the", "range", "supported", "by", "pandas", ".", "Timestamp" ]
def _parse_outofbounds(self, value): import numpy import pandas if self.output == 'pandas': if value < '1677-09-22': new_value = '1677-09-22' elif value > '2262-04-11': new_value = '2262-04-11' else: assert False...
[ "def", "_parse_outofbounds", "(", "self", ",", "value", ")", ":", "import", "numpy", "import", "pandas", "if", "self", ".", "output", "==", "'pandas'", ":", "if", "value", "<", "'1677-09-22'", ":", "new_value", "=", "'1677-09-22'", "elif", "value", ">", "'...
Deal with dates out of the range supported by pandas.Timestamp
[ "Deal", "with", "dates", "out", "of", "the", "range", "supported", "by", "pandas", ".", "Timestamp" ]
[ "\"\"\"Deal with dates out of the range supported by pandas.Timestamp\n\n :param str value:\n YYYY-MM-DD hh:mm:ss\n :returns:\n parsed value depending on self.output\n \"\"\"", "# Force to either Timestamp.min or Timestamp.max as of 00:00:00", "# to avoid confusing pro...
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [ { "docstring": "parsed value depending on self.output", "docstring_tokens": [ "parsed", "value", "depending", "on", "self", ".", "output" ], "type": null } ], "raises": [], "params": [ { "identifier"...
b6347a476f6bb4f6ea3cd2d307ad70cf4b8d24d3
PetritIgrishtaj/new_NIH
modules/loss.py
[ "MIT" ]
Python
hamming_loss
Tensor
def hamming_loss(c: Tensor, y: Tensor, threshold=0.8) -> Tensor: """ compute the hamming loss (refer to the origin paper) :param c: size: batch_size * n_labels, output of NN :param y: size: batch_size * n_labels, target :return: Scalar """ assert 0 <= threshold <= 1, "threshold should be bet...
compute the hamming loss (refer to the origin paper) :param c: size: batch_size * n_labels, output of NN :param y: size: batch_size * n_labels, target :return: Scalar
compute the hamming loss (refer to the origin paper)
[ "compute", "the", "hamming", "loss", "(", "refer", "to", "the", "origin", "paper", ")" ]
def hamming_loss(c: Tensor, y: Tensor, threshold=0.8) -> Tensor: assert 0 <= threshold <= 1, "threshold should be between 0 and 1" p, q = c.size() return 1.0 / (p * q) * (((c > threshold).int() - y) != 0).float().sum()
[ "def", "hamming_loss", "(", "c", ":", "Tensor", ",", "y", ":", "Tensor", ",", "threshold", "=", "0.8", ")", "->", "Tensor", ":", "assert", "0", "<=", "threshold", "<=", "1", ",", "\"threshold should be between 0 and 1\"", "p", ",", "q", "=", "c", ".", ...
compute the hamming loss (refer to the origin paper)
[ "compute", "the", "hamming", "loss", "(", "refer", "to", "the", "origin", "paper", ")" ]
[ "\"\"\"\n compute the hamming loss (refer to the origin paper)\n :param c: size: batch_size * n_labels, output of NN\n :param y: size: batch_size * n_labels, target\n :return: Scalar\n \"\"\"" ]
[ { "param": "c", "type": "Tensor" }, { "param": "y", "type": "Tensor" }, { "param": "threshold", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "c", "type": "Tensor", "docstring": "batch_size * n_labels, output of NN", "docstring_tokens": [ "batch_size...
b6347a476f6bb4f6ea3cd2d307ad70cf4b8d24d3
PetritIgrishtaj/new_NIH
modules/loss.py
[ "MIT" ]
Python
one_errors
Tensor
def one_errors(c: Tensor, y: Tensor) -> Tensor: """ compute the one-error function """ p, _ = c.size() return (y[0, torch.argmax(c, dim=1)] != 1).float().sum() / p
compute the one-error function
compute the one-error function
[ "compute", "the", "one", "-", "error", "function" ]
def one_errors(c: Tensor, y: Tensor) -> Tensor: p, _ = c.size() return (y[0, torch.argmax(c, dim=1)] != 1).float().sum() / p
[ "def", "one_errors", "(", "c", ":", "Tensor", ",", "y", ":", "Tensor", ")", "->", "Tensor", ":", "p", ",", "_", "=", "c", ".", "size", "(", ")", "return", "(", "y", "[", "0", ",", "torch", ".", "argmax", "(", "c", ",", "dim", "=", "1", ")",...
compute the one-error function
[ "compute", "the", "one", "-", "error", "function" ]
[ "\"\"\"\n compute the one-error function\n \"\"\"" ]
[ { "param": "c", "type": "Tensor" }, { "param": "y", "type": "Tensor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": "Tensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": "Tensor", "docstring": null, "docstring_tokens":...
0892fb171ab8840701a70a640ce6b876fb88cc32
PetritIgrishtaj/new_NIH
modules/collate.py
[ "MIT" ]
Python
cf
<not_specific>
def cf(batch): r"""Puts each data field into a tensor with outer dimension batch size""" elem = batch[0] elem_type = type(elem) if isinstance(elem, torch.Tensor): out = None if torch.utils.data.get_worker_info() is not None: # If we're in a background process, concatenate di...
r"""Puts each data field into a tensor with outer dimension batch size
r"""Puts each data field into a tensor with outer dimension batch size
[ "r", "\"", "\"", "\"", "Puts", "each", "data", "field", "into", "a", "tensor", "with", "outer", "dimension", "batch", "size" ]
def cf(batch): elem = batch[0] elem_type = type(elem) if isinstance(elem, torch.Tensor): out = None if torch.utils.data.get_worker_info() is not None: numel = sum([x.numel() for x in batch]) storage = elem.storage()._new_shared(numel) out = elem.new(storag...
[ "def", "cf", "(", "batch", ")", ":", "elem", "=", "batch", "[", "0", "]", "elem_type", "=", "type", "(", "elem", ")", "if", "isinstance", "(", "elem", ",", "torch", ".", "Tensor", ")", ":", "out", "=", "None", "if", "torch", ".", "utils", ".", ...
r"""Puts each data field into a tensor with outer dimension batch size
[ "r", "\"", "\"", "\"", "Puts", "each", "data", "field", "into", "a", "tensor", "with", "outer", "dimension", "batch", "size" ]
[ "r\"\"\"Puts each data field into a tensor with outer dimension batch size\"\"\"", "# If we're in a background process, concatenate directly into a", "# shared memory tensor to avoid an extra copy", "# array of string classes and object", "# return cf([torch.as_tensor(b) for b in batch])", "# scalars", ...
[ { "param": "batch", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "batch", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
095298095129b7e953a5eabb27017e452feb3459
PetritIgrishtaj/new_NIH
modules/dataset.py
[ "MIT" ]
Python
_kfold_split
List[List[bool]]
def _kfold_split(self, folds: int, seed: int = 0) -> List[List[bool]]: ''' Performs a k-fold split of self._data_train. A boolean filter list must be created for each split. A list of all these filters must be returned. I.e., [[True, True, False, False], ...
Performs a k-fold split of self._data_train. A boolean filter list must be created for each split. A list of all these filters must be returned. I.e., [[True, True, False, False], [False, False, True, True]] For a 2-fold split of a dataset of size 4 ...
Performs a k-fold split of self._data_train. A boolean filter list must be created for each split. A list of all these filters must be returned. I.e., [[True, True, False, False], [False, False, True, True]] For a 2-fold split of a dataset of size 4 The return value must be a list of :param:folds lists. Where each lis...
[ "Performs", "a", "k", "-", "fold", "split", "of", "self", ".", "_data_train", ".", "A", "boolean", "filter", "list", "must", "be", "created", "for", "each", "split", ".", "A", "list", "of", "all", "these", "filters", "must", "be", "returned", ".", "I",...
def _kfold_split(self, folds: int, seed: int = 0) -> List[List[bool]]: items_per_fold = int(len(self._data_train)/folds) items_used = [False]*len(self._data_train) _filters = [[False]*len(self._data_train) for x in range(folds)] group_iterator = self._data_train.groupby(['patient'], as_i...
[ "def", "_kfold_split", "(", "self", ",", "folds", ":", "int", ",", "seed", ":", "int", "=", "0", ")", "->", "List", "[", "List", "[", "bool", "]", "]", ":", "items_per_fold", "=", "int", "(", "len", "(", "self", ".", "_data_train", ")", "/", "fol...
Performs a k-fold split of self._data_train.
[ "Performs", "a", "k", "-", "fold", "split", "of", "self", ".", "_data_train", "." ]
[ "'''\n Performs a k-fold split of self._data_train.\n A boolean filter list must be created for each split.\n A list of all these filters must be returned.\n I.e.,\n [[True, True, False, False],\n [False, False, True, True]]\n For a 2-fold split of a dataset...
[ { "param": "self", "type": null }, { "param": "folds", "type": "int" }, { "param": "seed", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "folds", "type": "int", "docstring": null, "docstring_tokens":...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
define_parameters
null
def define_parameters(self): """ Define the CLI arguments accepted by this plugin app. """ # The space of input parameters is very straightforward # 1. The IP:port of the pfdcm service # 2. A 'msg' type string / dictionary to send to the service. # PACS sett...
Define the CLI arguments accepted by this plugin app.
Define the CLI arguments accepted by this plugin app.
[ "Define", "the", "CLI", "arguments", "accepted", "by", "this", "plugin", "app", "." ]
def define_parameters(self): self.add_argument( '--pfdcm', dest = 'str_pfdcm', type = str, default = '', optional = True, help = 'The PACS Q/R intermediary service IP:port.') self.add_argument( ...
[ "def", "define_parameters", "(", "self", ")", ":", "self", ".", "add_argument", "(", "'--pfdcm'", ",", "dest", "=", "'str_pfdcm'", ",", "type", "=", "str", ",", "default", "=", "''", ",", "optional", "=", "True", ",", "help", "=", "'The PACS Q/R intermedia...
Define the CLI arguments accepted by this plugin app.
[ "Define", "the", "CLI", "arguments", "accepted", "by", "this", "plugin", "app", "." ]
[ "\"\"\"\n Define the CLI arguments accepted by this plugin app.\n \"\"\"", "# The space of input parameters is very straightforward", "# 1. The IP:port of the pfdcm service", "# 2. A 'msg' type string / dictionary to send to the service.", "# PACS settings" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
df_print
<not_specific>
def df_print(self, adict): """ Return a nicely formatted string representation of a dictionary """ return self.pp.pformat(adict).strip()
Return a nicely formatted string representation of a dictionary
Return a nicely formatted string representation of a dictionary
[ "Return", "a", "nicely", "formatted", "string", "representation", "of", "a", "dictionary" ]
def df_print(self, adict): return self.pp.pformat(adict).strip()
[ "def", "df_print", "(", "self", ",", "adict", ")", ":", "return", "self", ".", "pp", ".", "pformat", "(", "adict", ")", ".", "strip", "(", ")" ]
Return a nicely formatted string representation of a dictionary
[ "Return", "a", "nicely", "formatted", "string", "representation", "of", "a", "dictionary" ]
[ "\"\"\"\n Return a nicely formatted string representation of a dictionary\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "adict", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "adict", "type": null, "docstring": null, "docstring_tokens": ...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
man_get
<not_specific>
def man_get(self): """ return a simple man/usage paragraph. """ d_ret = { "man": str_name + str_synposis + str_description + str_results + str_args, "synopsis": str_synposis, "description": str_description, "results": str_result...
return a simple man/usage paragraph.
return a simple man/usage paragraph.
[ "return", "a", "simple", "man", "/", "usage", "paragraph", "." ]
def man_get(self): d_ret = { "man": str_name + str_synposis + str_description + str_results + str_args, "synopsis": str_synposis, "description": str_description, "results": str_results, "args": str_args, "overview": """ ...
[ "def", "man_get", "(", "self", ")", ":", "d_ret", "=", "{", "\"man\"", ":", "str_name", "+", "str_synposis", "+", "str_description", "+", "str_results", "+", "str_args", ",", "\"synopsis\"", ":", "str_synposis", ",", "\"description\"", ":", "str_description", ...
return a simple man/usage paragraph.
[ "return", "a", "simple", "man", "/", "usage", "paragraph", "." ]
[ "\"\"\"\n return a simple man/usage paragraph.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
manPage_checkAndShow
<not_specific>
def manPage_checkAndShow(self, options): """ Check if the user wants inline help. If so, present requested help Return a bool based on check. """ ret = False if len(options.str_man): ret = True d_man = self.man_get() if options.str_ma...
Check if the user wants inline help. If so, present requested help Return a bool based on check.
Check if the user wants inline help. If so, present requested help Return a bool based on check.
[ "Check", "if", "the", "user", "wants", "inline", "help", ".", "If", "so", "present", "requested", "help", "Return", "a", "bool", "based", "on", "check", "." ]
def manPage_checkAndShow(self, options): ret = False if len(options.str_man): ret = True d_man = self.man_get() if options.str_man in d_man: str_help = d_man[options.str_man] print(str_help) if options.str_man == 'entries...
[ "def", "manPage_checkAndShow", "(", "self", ",", "options", ")", ":", "ret", "=", "False", "if", "len", "(", "options", ".", "str_man", ")", ":", "ret", "=", "True", "d_man", "=", "self", ".", "man_get", "(", ")", "if", "options", ".", "str_man", "in...
Check if the user wants inline help.
[ "Check", "if", "the", "user", "wants", "inline", "help", "." ]
[ "\"\"\"\n Check if the user wants inline help. If so, present requested help\n\n Return a bool based on check.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
queryTable_read
null
def queryTable_read(self, *args, **kwargs): """ Read a JSON formatted query table generated by 'pacsquery'. """ d_results = {} options = None for k,v in kwargs.items(): if k == 'priorHitsTable': self.str_priorHitsTable = v if len(self...
Read a JSON formatted query table generated by 'pacsquery'.
Read a JSON formatted query table generated by 'pacsquery'.
[ "Read", "a", "JSON", "formatted", "query", "table", "generated", "by", "'", "pacsquery", "'", "." ]
def queryTable_read(self, *args, **kwargs): d_results = {} options = None for k,v in kwargs.items(): if k == 'priorHitsTable': self.str_priorHitsTable = v if len(self.str_priorHitsTable): str_FQresultFile = os.path.join(self.str_inputDir, self.s...
[ "def", "queryTable_read", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "d_results", "=", "{", "}", "options", "=", "None", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "==", "'priorHitsTable'", ":",...
Read a JSON formatted query table generated by 'pacsquery'.
[ "Read", "a", "JSON", "formatted", "query", "table", "generated", "by", "'", "pacsquery", "'", "." ]
[ "\"\"\"\n Read a JSON formatted query table generated by 'pacsquery'.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
dataReport_process
null
def dataReport_process(self, *args, **kwargs): """ Process data report based on the return from the query. """ d_results = {} for k,v in kwargs.items(): if k == 'resultFile': self.str_resultFile = v if k == 'results': d_results ...
Process data report based on the return from the query.
Process data report based on the return from the query.
[ "Process", "data", "report", "based", "on", "the", "return", "from", "the", "query", "." ]
def dataReport_process(self, *args, **kwargs): d_results = {} for k,v in kwargs.items(): if k == 'resultFile': self.str_resultFile = v if k == 'results': d_results = v if len(self.str_resultFile): str_FQresultFile = os.path.jo...
[ "def", "dataReport_process", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "d_results", "=", "{", "}", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "==", "'resultFile'", ":", "self", ".", "str_result...
Process data report based on the return from the query.
[ "Process", "data", "report", "based", "on", "the", "return", "from", "the", "query", "." ]
[ "\"\"\"\n Process data report based on the return from the query.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
ageCalc
<not_specific>
def ageCalc(self, astr_birthDate, astr_scanDate): """ Calculate and return the age based on the difference between the scan data and birthdate """ str_age = "" birthY, birthM, birthD = int(astr_birthDate[0:4]), int(astr_birthDate[4:6]), int(astr_birthDate...
Calculate and return the age based on the difference between the scan data and birthdate
Calculate and return the age based on the difference between the scan data and birthdate
[ "Calculate", "and", "return", "the", "age", "based", "on", "the", "difference", "between", "the", "scan", "data", "and", "birthdate" ]
def ageCalc(self, astr_birthDate, astr_scanDate): str_age = "" birthY, birthM, birthD = int(astr_birthDate[0:4]), int(astr_birthDate[4:6]), int(astr_birthDate[6:8]) scanY, scanM, scanD = int(astr_scanDate[0:4]), int(astr_scanDate[4:6]), int(astr_scanDate[6:8]) birthD...
[ "def", "ageCalc", "(", "self", ",", "astr_birthDate", ",", "astr_scanDate", ")", ":", "str_age", "=", "\"\"", "birthY", ",", "birthM", ",", "birthD", "=", "int", "(", "astr_birthDate", "[", "0", ":", "4", "]", ")", ",", "int", "(", "astr_birthDate", "[...
Calculate and return the age based on the difference between the scan data and birthdate
[ "Calculate", "and", "return", "the", "age", "based", "on", "the", "difference", "between", "the", "scan", "data", "and", "birthdate" ]
[ "\"\"\"\n Calculate and return the age based on the difference between the\n scan data and birthdate\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "astr_birthDate", "type": null }, { "param": "astr_scanDate", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "astr_birthDate", "type": null, "docstring": null, "docstring_...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
entry_reprocessForKey
<not_specific>
def entry_reprocessForKey(self, *args, **kwargs): """ Reprocess a key/entry for special handling """ str_ret = "notReprocessed" d_entry = {} str_key = "" for k,v in kwargs.items(): if k == 'entry': d_entry = v if k == 'k...
Reprocess a key/entry for special handling
Reprocess a key/entry for special handling
[ "Reprocess", "a", "key", "/", "entry", "for", "special", "handling" ]
def entry_reprocessForKey(self, *args, **kwargs): str_ret = "notReprocessed" d_entry = {} str_key = "" for k,v in kwargs.items(): if k == 'entry': d_entry = v if k == 'key': str_key = v if str_key == 'PatientAge': st...
[ "def", "entry_reprocessForKey", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "str_ret", "=", "\"notReprocessed\"", "d_entry", "=", "{", "}", "str_key", "=", "\"\"", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "...
Reprocess a key/entry for special handling
[ "Reprocess", "a", "key", "/", "entry", "for", "special", "handling" ]
[ "\"\"\"\n Reprocess a key/entry for special handling\n \"\"\"", "# Here, we calculate the PatientAge from the difference", "# between the ScanDate and the PatientBirthDate" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
summaryReport_process
null
def summaryReport_process(self, *args, **kwargs): """ Generate a summary report based on CLI specs """ l_dataStudy = [] l_dataSeries = [] # self.str_seriesSummaryKeys = '' # self.str_studySummaryKeys = '' for k,v in kwarg...
Generate a summary report based on CLI specs
Generate a summary report based on CLI specs
[ "Generate", "a", "summary", "report", "based", "on", "CLI", "specs" ]
def summaryReport_process(self, *args, **kwargs): l_dataStudy = [] l_dataSeries = [] for k,v in kwargs.items(): if k == 'dataStudy': l_dataStudy = v if k == 'dataSeries': l_dataSeries = v ...
[ "def", "summaryReport_process", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "l_dataStudy", "=", "[", "]", "l_dataSeries", "=", "[", "]", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", "k", "==", "'dataStu...
Generate a summary report based on CLI specs
[ "Generate", "a", "summary", "report", "based", "on", "CLI", "specs" ]
[ "\"\"\"\n Generate a summary report based on CLI specs\n \"\"\"", "# self.str_seriesSummaryKeys = ''", "# self.str_studySummaryKeys = ''", "# if k == 'seriesSummaryKeys': self.str_seriesSummaryKeys = v", "# if k == 'seriesSummaryFile': self.str_seriesSummaryFile = v", "# if k == '...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
directMessage_checkAndConstruct
<not_specific>
def directMessage_checkAndConstruct(self, options): """ Checks if user specified a direct message to the 'pfdcm' service, and if so, construct the message. Return True/False accordingly """ ret = False if len(options.str_msg): ret = True ...
Checks if user specified a direct message to the 'pfdcm' service, and if so, construct the message. Return True/False accordingly
Checks if user specified a direct message to the 'pfdcm' service, and if so, construct the message. Return True/False accordingly
[ "Checks", "if", "user", "specified", "a", "direct", "message", "to", "the", "'", "pfdcm", "'", "service", "and", "if", "so", "construct", "the", "message", ".", "Return", "True", "/", "False", "accordingly" ]
def directMessage_checkAndConstruct(self, options): ret = False if len(options.str_msg): ret = True self.str_msg = options.str_msg try: self.d_msg = json.loads(self.str_msg) self.l_dmsg.append(self.d_msg) sel...
[ "def", "directMessage_checkAndConstruct", "(", "self", ",", "options", ")", ":", "ret", "=", "False", "if", "len", "(", "options", ".", "str_msg", ")", ":", "ret", "=", "True", "self", ".", "str_msg", "=", "options", ".", "str_msg", "try", ":", "self", ...
Checks if user specified a direct message to the 'pfdcm' service, and if so, construct the message.
[ "Checks", "if", "user", "specified", "a", "direct", "message", "to", "the", "'", "pfdcm", "'", "service", "and", "if", "so", "construct", "the", "message", "." ]
[ "\"\"\"\n Checks if user specified a direct message to the 'pfdcm' service, \n and if so, construct the message.\n\n Return True/False accordingly\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
queryMessage_checkAndConstruct
null
def queryMessage_checkAndConstruct(self, options): """ Checks if user specified a query from a pattern of command line flags, and if so, construct the message. Return True/False accordingly """ if len(options.str_patientID) and len(options.str_PACSservice): ...
Checks if user specified a query from a pattern of command line flags, and if so, construct the message. Return True/False accordingly
Checks if user specified a query from a pattern of command line flags, and if so, construct the message. Return True/False accordingly
[ "Checks", "if", "user", "specified", "a", "query", "from", "a", "pattern", "of", "command", "line", "flags", "and", "if", "so", "construct", "the", "message", ".", "Return", "True", "/", "False", "accordingly" ]
def queryMessage_checkAndConstruct(self, options): if len(options.str_patientID) and len(options.str_PACSservice): self.str_patientID = options.str_patientID self.str_PACSservice = options.str_PACSservice self.d_msg = { 'action': 'PACSinteract', ...
[ "def", "queryMessage_checkAndConstruct", "(", "self", ",", "options", ")", ":", "if", "len", "(", "options", ".", "str_patientID", ")", "and", "len", "(", "options", ".", "str_PACSservice", ")", ":", "self", ".", "str_patientID", "=", "options", ".", "str_pa...
Checks if user specified a query from a pattern of command line flags, and if so, construct the message.
[ "Checks", "if", "user", "specified", "a", "query", "from", "a", "pattern", "of", "command", "line", "flags", "and", "if", "so", "construct", "the", "message", "." ]
[ "\"\"\"\n Checks if user specified a query from a pattern of command line flags,\n and if so, construct the message.\n\n Return True/False accordingly\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveMessage_checkAndConstructBase
<not_specific>
def retrieveMessage_checkAndConstructBase(self, options): """ Checks if user specified a retrieve from a pattern of command line flags, and if so, construct the base message. Return True/False accordingly """ if len(options.str_priorHitsTable) and len(options.str_indexL...
Checks if user specified a retrieve from a pattern of command line flags, and if so, construct the base message. Return True/False accordingly
Checks if user specified a retrieve from a pattern of command line flags, and if so, construct the base message. Return True/False accordingly
[ "Checks", "if", "user", "specified", "a", "retrieve", "from", "a", "pattern", "of", "command", "line", "flags", "and", "if", "so", "construct", "the", "base", "message", ".", "Return", "True", "/", "False", "accordingly" ]
def retrieveMessage_checkAndConstructBase(self, options): if len(options.str_priorHitsTable) and len(options.str_indexList): self.l_indexList = options.str_indexList.split(',') self.str_PACSservice = options.str_PACSservice for series in self.l_indexList: s...
[ "def", "retrieveMessage_checkAndConstructBase", "(", "self", ",", "options", ")", ":", "if", "len", "(", "options", ".", "str_priorHitsTable", ")", "and", "len", "(", "options", ".", "str_indexList", ")", ":", "self", ".", "l_indexList", "=", "options", ".", ...
Checks if user specified a retrieve from a pattern of command line flags, and if so, construct the base message.
[ "Checks", "if", "user", "specified", "a", "retrieve", "from", "a", "pattern", "of", "command", "line", "flags", "and", "if", "so", "construct", "the", "base", "message", "." ]
[ "\"\"\"\n Checks if user specified a retrieve from a pattern of command line flags,\n and if so, construct the base message.\n\n Return True/False accordingly\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
baseMessage_set
<not_specific>
def baseMessage_set(self, *args, **kwargs): """ Operates on the "base" message and sets a specified kwarg value. PRECONDITIONS * A populated self.l_dmsg list of dictionaries -- typically created by a prior call to self.retrieveMessage_checkAndConstructBase() POSTCOND...
Operates on the "base" message and sets a specified kwarg value. PRECONDITIONS * A populated self.l_dmsg list of dictionaries -- typically created by a prior call to self.retrieveMessage_checkAndConstructBase() POSTCONDITIONS * Return True/False accordingly
Operates on the "base" message and sets a specified kwarg value. PRECONDITIONS A populated self.l_dmsg list of dictionaries -- typically created by a prior call to self.retrieveMessage_checkAndConstructBase() POSTCONDITIONS Return True/False accordingly
[ "Operates", "on", "the", "\"", "base", "\"", "message", "and", "sets", "a", "specified", "kwarg", "value", ".", "PRECONDITIONS", "A", "populated", "self", ".", "l_dmsg", "list", "of", "dictionaries", "--", "typically", "created", "by", "a", "prior", "call", ...
def baseMessage_set(self, *args, **kwargs): for k, v in kwargs.items(): for d in self.l_dmsg: d['meta'][k] = v return self.b_canRun
[ "def", "baseMessage_set", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "for", "d", "in", "self", ".", "l_dmsg", ":", "d", "[", "'meta'", "]", "[", "k", "]", "...
Operates on the "base" message and sets a specified kwarg value.
[ "Operates", "on", "the", "\"", "base", "\"", "message", "and", "sets", "a", "specified", "kwarg", "value", "." ]
[ "\"\"\"\n Operates on the \"base\" message and sets a specified kwarg value.\n\n PRECONDITIONS\n * A populated self.l_dmsg list of dictionaries -- typically created by a \n prior call to self.retrieveMessage_checkAndConstructBase()\n\n POSTCONDITIONS\n * Return True/False...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveMessageStatus_checkAndConstruct
<not_specific>
def retrieveMessageStatus_checkAndConstruct(self): """ Construct a status check on a retrieve event. Essentially, this replaces the 'retrieve' string with a 'retrieveStatus' in the already existing message payload. PRECONDITIONS * A populated self.l_dmsg list of diction...
Construct a status check on a retrieve event. Essentially, this replaces the 'retrieve' string with a 'retrieveStatus' in the already existing message payload. PRECONDITIONS * A populated self.l_dmsg list of dictionaries -- typically created by a prior call to self....
Construct a status check on a retrieve event. Essentially, this replaces the 'retrieve' string with a 'retrieveStatus' in the already existing message payload. PRECONDITIONS A populated self.l_dmsg list of dictionaries -- typically created by a prior call to self.retrieveMessage_checkAndConstruct() POSTCONDITIONS Ret...
[ "Construct", "a", "status", "check", "on", "a", "retrieve", "event", ".", "Essentially", "this", "replaces", "the", "'", "retrieve", "'", "string", "with", "a", "'", "retrieveStatus", "'", "in", "the", "already", "existing", "message", "payload", ".", "PRECO...
def retrieveMessageStatus_checkAndConstruct(self): for d in self.l_dmsg: d['meta']['do'] = 'retrieveStatus' return self.b_canRun
[ "def", "retrieveMessageStatus_checkAndConstruct", "(", "self", ")", ":", "for", "d", "in", "self", ".", "l_dmsg", ":", "d", "[", "'meta'", "]", "[", "'do'", "]", "=", "'retrieveStatus'", "return", "self", ".", "b_canRun" ]
Construct a status check on a retrieve event.
[ "Construct", "a", "status", "check", "on", "a", "retrieve", "event", "." ]
[ "\"\"\"\n Construct a status check on a retrieve event. Essentially, this replaces the\n 'retrieve' string with a 'retrieveStatus' in the already existing message\n payload. \n\n PRECONDITIONS\n * A populated self.l_dmsg list of dictionaries -- typically created by a \n p...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveMessageCopy_localPathDetermine
<not_specific>
def retrieveMessageCopy_localPathDetermine(self, *args, **kwargs): """ Determine the local path name based on seriesUID and directory template. """ str_seriesUID = '' b_status = False d_ret = {} str_path = self.options.str_pullDir...
Determine the local path name based on seriesUID and directory template.
Determine the local path name based on seriesUID and directory template.
[ "Determine", "the", "local", "path", "name", "based", "on", "seriesUID", "and", "directory", "template", "." ]
def retrieveMessageCopy_localPathDetermine(self, *args, **kwargs): str_seriesUID = '' b_status = False d_ret = {} str_path = self.options.str_pullDirTemplate for k, v in kwargs.items(): if k == 'seriesUID': str_seriesUID = v if ...
[ "def", "retrieveMessageCopy_localPathDetermine", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "str_seriesUID", "=", "''", "b_status", "=", "False", "d_ret", "=", "{", "}", "str_path", "=", "self", ".", "options", ".", "str_pullDirTemplate", ...
Determine the local path name based on seriesUID and directory template.
[ "Determine", "the", "local", "path", "name", "based", "on", "seriesUID", "and", "directory", "template", "." ]
[ "\"\"\"\n Determine the local path name based on seriesUID and directory\n template.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveMessageCopy_checkAndConstruct
<not_specific>
def retrieveMessageCopy_checkAndConstruct(self): """ Construct a message that will ask the pfdcm to copy a dirtree from one location to another in its filesystem space. PRECONDITIONS * Successful retrieve call. POSTCONDITIONS * Return True/False accordingly ...
Construct a message that will ask the pfdcm to copy a dirtree from one location to another in its filesystem space. PRECONDITIONS * Successful retrieve call. POSTCONDITIONS * Return True/False accordingly
Construct a message that will ask the pfdcm to copy a dirtree from one location to another in its filesystem space. PRECONDITIONS Successful retrieve call. POSTCONDITIONS Return True/False accordingly
[ "Construct", "a", "message", "that", "will", "ask", "the", "pfdcm", "to", "copy", "a", "dirtree", "from", "one", "location", "to", "another", "in", "its", "filesystem", "space", ".", "PRECONDITIONS", "Successful", "retrieve", "call", ".", "POSTCONDITIONS", "Re...
def retrieveMessageCopy_checkAndConstruct(self): self.b_canRun = False self.l_dmsg = [] self.lstr_outputPull = [] for d_copy in self.l_retrieveOK: str_seriesUID = d_copy['retrieveStatus']['seriesUID'] d_path = self.retrieveMessa...
[ "def", "retrieveMessageCopy_checkAndConstruct", "(", "self", ")", ":", "self", ".", "b_canRun", "=", "False", "self", ".", "l_dmsg", "=", "[", "]", "self", ".", "lstr_outputPull", "=", "[", "]", "for", "d_copy", "in", "self", ".", "l_retrieveOK", ":", "str...
Construct a message that will ask the pfdcm to copy a dirtree from one location to another in its filesystem space.
[ "Construct", "a", "message", "that", "will", "ask", "the", "pfdcm", "to", "copy", "a", "dirtree", "from", "one", "location", "to", "another", "in", "its", "filesystem", "space", "." ]
[ "\"\"\"\n Construct a message that will ask the pfdcm to copy a dirtree\n from one location to another in its filesystem space.\n\n PRECONDITIONS\n * Successful retrieve call.\n\n POSTCONDITIONS\n * Return True/False accordingly\n \"\"\"", "# pudb.set_trace()" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
outputFiles_generate
null
def outputFiles_generate(self, options, d_ret, l_dataStudy, l_dataSeries): """ Check and generate output files. """ if len(options.str_numberOfHitsFile): self.numberOfHitsReport_process( studyHits = len(l_dataStudy), ...
Check and generate output files.
Check and generate output files.
[ "Check", "and", "generate", "output", "files", "." ]
def outputFiles_generate(self, options, d_ret, l_dataStudy, l_dataSeries): if len(options.str_numberOfHitsFile): self.numberOfHitsReport_process( studyHits = len(l_dataStudy), seriesHits = len(l_dataSeries), ...
[ "def", "outputFiles_generate", "(", "self", ",", "options", ",", "d_ret", ",", "l_dataStudy", ",", "l_dataSeries", ")", ":", "if", "len", "(", "options", ".", "str_numberOfHitsFile", ")", ":", "self", ".", "numberOfHitsReport_process", "(", "studyHits", "=", "...
Check and generate output files.
[ "Check", "and", "generate", "output", "files", "." ]
[ "\"\"\"\n Check and generate output files.\n \"\"\"", "# seriesSummaryKeys = options.str_seriesSummaryKeys,", "# seriesSummaryFile = options.str_seriesSummaryFile,", "# studySummaryKeys = options.str_studySummaryKeys,", "# studySummaryFile = options.str_studySummaryFile" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null }, { "param": "d_ret", "type": null }, { "param": "l_dataStudy", "type": null }, { "param": "l_dataSeries", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveStatus_callCheck
<not_specific>
def retrieveStatus_callCheck(self, al_call): """ Cycle once through the scheduled retrieves and build a list of return status. """ l_ret = [] if self.b_canRun: for self.d_msg in al_call: self.dp.qprint('Asking the dcm service for u...
Cycle once through the scheduled retrieves and build a list of return status.
Cycle once through the scheduled retrieves and build a list of return status.
[ "Cycle", "once", "through", "the", "scheduled", "retrieves", "and", "build", "a", "list", "of", "return", "status", "." ]
def retrieveStatus_callCheck(self, al_call): l_ret = [] if self.b_canRun: for self.d_msg in al_call: self.dp.qprint('Asking the dcm service for updates on reception of PACS data...') l_ret.append(self.service_call(msg = self.d_msg)) return l_...
[ "def", "retrieveStatus_callCheck", "(", "self", ",", "al_call", ")", ":", "l_ret", "=", "[", "]", "if", "self", ".", "b_canRun", ":", "for", "self", ".", "d_msg", "in", "al_call", ":", "self", ".", "dp", ".", "qprint", "(", "'Asking the dcm service for upd...
Cycle once through the scheduled retrieves and build a list of return status.
[ "Cycle", "once", "through", "the", "scheduled", "retrieves", "and", "build", "a", "list", "of", "return", "status", "." ]
[ "\"\"\"\n Cycle once through the scheduled retrieves and \n build a list of return status.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "al_call", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "al_call", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveStatus_filterPending
<not_specific>
def retrieveStatus_filterPending(self, al_checkCall, al_checkResult): """ Builds a list of status checks that have pending results """ l_pendingCall = [] l_pendingResult = [] l_doneResult = [] b_pending = False # pudb.set_trace(...
Builds a list of status checks that have pending results
Builds a list of status checks that have pending results
[ "Builds", "a", "list", "of", "status", "checks", "that", "have", "pending", "results" ]
def retrieveStatus_filterPending(self, al_checkCall, al_checkResult): l_pendingCall = [] l_pendingResult = [] l_doneResult = [] b_pending = False for d_call, d_result in zip(al_checkCall, al_checkResult): if not d_result['status']: ...
[ "def", "retrieveStatus_filterPending", "(", "self", ",", "al_checkCall", ",", "al_checkResult", ")", ":", "l_pendingCall", "=", "[", "]", "l_pendingResult", "=", "[", "]", "l_doneResult", "=", "[", "]", "b_pending", "=", "False", "for", "d_call", ",", "d_resul...
Builds a list of status checks that have pending results
[ "Builds", "a", "list", "of", "status", "checks", "that", "have", "pending", "results" ]
[ "\"\"\"\n Builds a list of status checks that have pending results\n \"\"\"", "# pudb.set_trace()" ]
[ { "param": "self", "type": null }, { "param": "al_checkCall", "type": null }, { "param": "al_checkResult", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "al_checkCall", "type": null, "docstring": null, "docstring_to...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveStatus_callAndFilter
<not_specific>
def retrieveStatus_callAndFilter(self, al_checkCall): """ Perform a call to the remote service on retrieve status and filter the results into 'done' and 'pending'. """ l_retrieveStatus = [] l_checkCall = [] d_ret = {} ...
Perform a call to the remote service on retrieve status and filter the results into 'done' and 'pending'.
Perform a call to the remote service on retrieve status and filter the results into 'done' and 'pending'.
[ "Perform", "a", "call", "to", "the", "remote", "service", "on", "retrieve", "status", "and", "filter", "the", "results", "into", "'", "done", "'", "and", "'", "pending", "'", "." ]
def retrieveStatus_callAndFilter(self, al_checkCall): l_retrieveStatus = [] l_checkCall = [] d_ret = {} l_checkCall = list(al_checkCall) l_retrieveStatus = self.retrieveStatus_callCheck(l_checkCall) d_ret ...
[ "def", "retrieveStatus_callAndFilter", "(", "self", ",", "al_checkCall", ")", ":", "l_retrieveStatus", "=", "[", "]", "l_checkCall", "=", "[", "]", "d_ret", "=", "{", "}", "l_checkCall", "=", "list", "(", "al_checkCall", ")", "l_retrieveStatus", "=", "self", ...
Perform a call to the remote service on retrieve status and filter the results into 'done' and 'pending'.
[ "Perform", "a", "call", "to", "the", "remote", "service", "on", "retrieve", "status", "and", "filter", "the", "results", "into", "'", "done", "'", "and", "'", "pending", "'", "." ]
[ "\"\"\"\n Perform a call to the remote service on retrieve status\n and filter the results into 'done' and 'pending'.\n \"\"\"", "# First, check on the current status" ]
[ { "param": "self", "type": null }, { "param": "al_checkCall", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "al_checkCall", "type": null, "docstring": null, "docstring_to...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieveStatus_process
<not_specific>
def retrieveStatus_process(self, al_checkCall, **kwargs): """ Process the retrieve status by waiting until all asynchronous retrieves have completed. """ b_jobsPending = True b_breakCondition = False b_waitForPending = True ...
Process the retrieve status by waiting until all asynchronous retrieves have completed.
Process the retrieve status by waiting until all asynchronous retrieves have completed.
[ "Process", "the", "retrieve", "status", "by", "waiting", "until", "all", "asynchronous", "retrieves", "have", "completed", "." ]
def retrieveStatus_process(self, al_checkCall, **kwargs): b_jobsPending = True b_breakCondition = False b_waitForPending = True sleepInterval = 5 l_retrieveStatus = [] l_checkCall = [] self.l_retrieveOK = ...
[ "def", "retrieveStatus_process", "(", "self", ",", "al_checkCall", ",", "**", "kwargs", ")", ":", "b_jobsPending", "=", "True", "b_breakCondition", "=", "False", "b_waitForPending", "=", "True", "sleepInterval", "=", "5", "l_retrieveStatus", "=", "[", "]", "l_ch...
Process the retrieve status by waiting until all asynchronous retrieves have completed.
[ "Process", "the", "retrieve", "status", "by", "waiting", "until", "all", "asynchronous", "retrieves", "have", "completed", "." ]
[ "\"\"\"\n Process the retrieve status by waiting until \n all asynchronous retrieves have completed.\n \"\"\"", "# pudb.set_trace()", "# Update a master list of done results..." ]
[ { "param": "self", "type": null }, { "param": "al_checkCall", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "al_checkCall", "type": null, "docstring": null, "docstring_to...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieve_initiate
<not_specific>
def retrieve_initiate(self, options): """ Initiate the actual retrieve calls to the PACS of interest. """ l_ret = [] if self.b_canRun: for self.d_msg in self.l_dmsg: self.dp.qprint('Messaging the dcm service to initiate a PACS retrieve...') ...
Initiate the actual retrieve calls to the PACS of interest.
Initiate the actual retrieve calls to the PACS of interest.
[ "Initiate", "the", "actual", "retrieve", "calls", "to", "the", "PACS", "of", "interest", "." ]
def retrieve_initiate(self, options): l_ret = [] if self.b_canRun: for self.d_msg in self.l_dmsg: self.dp.qprint('Messaging the dcm service to initiate a PACS retrieve...') l_ret.append(self.service_call(msg = self.d_msg)) return l_ret
[ "def", "retrieve_initiate", "(", "self", ",", "options", ")", ":", "l_ret", "=", "[", "]", "if", "self", ".", "b_canRun", ":", "for", "self", ".", "d_msg", "in", "self", ".", "l_dmsg", ":", "self", ".", "dp", ".", "qprint", "(", "'Messaging the dcm ser...
Initiate the actual retrieve calls to the PACS of interest.
[ "Initiate", "the", "actual", "retrieve", "calls", "to", "the", "PACS", "of", "interest", "." ]
[ "\"\"\"\n Initiate the actual retrieve calls to the PACS of interest.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
retrieve_resultsCopy
<not_specific>
def retrieve_resultsCopy(self, ald_msg): """ Call the pfdcm service to copy outputs from its internal unpack location to the output dir of this script. PRECONDITIONS * The filesystem of this script and that of pfdcm are logically the same. """ l_ret = [] ...
Call the pfdcm service to copy outputs from its internal unpack location to the output dir of this script. PRECONDITIONS * The filesystem of this script and that of pfdcm are logically the same.
Call the pfdcm service to copy outputs from its internal unpack location to the output dir of this script. PRECONDITIONS The filesystem of this script and that of pfdcm are logically the same.
[ "Call", "the", "pfdcm", "service", "to", "copy", "outputs", "from", "its", "internal", "unpack", "location", "to", "the", "output", "dir", "of", "this", "script", ".", "PRECONDITIONS", "The", "filesystem", "of", "this", "script", "and", "that", "of", "pfdcm"...
def retrieve_resultsCopy(self, ald_msg): l_ret = [] if self.b_canRun: for self.d_msg in ald_msg: self.dp.qprint('Messaging the dcm service to pull retrieved DICOM data...') l_ret.append(self.service_call(msg = self.d_msg)) return l_ret
[ "def", "retrieve_resultsCopy", "(", "self", ",", "ald_msg", ")", ":", "l_ret", "=", "[", "]", "if", "self", ".", "b_canRun", ":", "for", "self", ".", "d_msg", "in", "ald_msg", ":", "self", ".", "dp", ".", "qprint", "(", "'Messaging the dcm service to pull ...
Call the pfdcm service to copy outputs from its internal unpack location to the output dir of this script.
[ "Call", "the", "pfdcm", "service", "to", "copy", "outputs", "from", "its", "internal", "unpack", "location", "to", "the", "output", "dir", "of", "this", "script", "." ]
[ "\"\"\"\n Call the pfdcm service to copy outputs from its internal unpack location\n to the output dir of this script.\n\n PRECONDITIONS\n * The filesystem of this script and that of pfdcm are logically the same.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ald_msg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ald_msg", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
jpgPreview_generate
null
def jpgPreview_generate(self, *args, **kwargs): """ Generate a jpg preview of the DICOMS in a list of directories containing DICOM data. """ lstr_DICOMdirs = [] b_status = False d_ret = {} for k,v in kwargs.items(): if k == '...
Generate a jpg preview of the DICOMS in a list of directories containing DICOM data.
Generate a jpg preview of the DICOMS in a list of directories containing DICOM data.
[ "Generate", "a", "jpg", "preview", "of", "the", "DICOMS", "in", "a", "list", "of", "directories", "containing", "DICOM", "data", "." ]
def jpgPreview_generate(self, *args, **kwargs): lstr_DICOMdirs = [] b_status = False d_ret = {} for k,v in kwargs.items(): if k == 'l_DICOMdirs': lstr_DICOMdirs = v for str_DICOMdir in lstr_DICOMdirs: self.dp.qprint('In directory %s...
[ "def", "jpgPreview_generate", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "lstr_DICOMdirs", "=", "[", "]", "b_status", "=", "False", "d_ret", "=", "{", "}", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", ":", "if", ...
Generate a jpg preview of the DICOMS in a list of directories containing DICOM data.
[ "Generate", "a", "jpg", "preview", "of", "the", "DICOMS", "in", "a", "list", "of", "directories", "containing", "DICOM", "data", "." ]
[ "\"\"\"\n Generate a jpg preview of the DICOMS in a list of directories\n containing DICOM data.\n \"\"\"", "# create a jpg subdir", "# Loop over every DICOM to create a JPG", "# pudb.set_trace()", "# Convert to jpg", "# Loop over every JPG to resize", "# pudb.set_trace()", "# Now...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
run
<not_specific>
def run(self, options): """ Define the code to be run by this plugin app. """ d_ret = { 'status': False } self.options = options self.b_pfurlQuiet = options.b_pfurlQuiet self.b_serviceCallQuiet ...
Define the code to be run by this plugin app.
Define the code to be run by this plugin app.
[ "Define", "the", "code", "to", "be", "run", "by", "this", "plugin", "app", "." ]
def run(self, options): d_ret = { 'status': False } self.options = options self.b_pfurlQuiet = options.b_pfurlQuiet self.b_serviceCallQuiet = options.b_serviceCallQuiet self.str_outputDir = options.ou...
[ "def", "run", "(", "self", ",", "options", ")", ":", "d_ret", "=", "{", "'status'", ":", "False", "}", "self", ".", "options", "=", "options", "self", ".", "b_pfurlQuiet", "=", "options", ".", "b_pfurlQuiet", "self", ".", "b_serviceCallQuiet", "=", "opti...
Define the code to be run by this plugin app.
[ "Define", "the", "code", "to", "be", "run", "by", "this", "plugin", "app", "." ]
[ "\"\"\"\n Define the code to be run by this plugin app.\n \"\"\"", "# pudb.set_trace()" ]
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
define_parameters
null
def define_parameters(self): """ Define the CLI arguments accepted by this plugin app. """ # PACS settings self.add_argument( '--aet', dest='aet', type=str, default=DICOM['calling_aet'], optional=True, help='...
Define the CLI arguments accepted by this plugin app.
Define the CLI arguments accepted by this plugin app.
[ "Define", "the", "CLI", "arguments", "accepted", "by", "this", "plugin", "app", "." ]
def define_parameters(self): self.add_argument( '--aet', dest='aet', type=str, default=DICOM['calling_aet'], optional=True, help='aet') self.add_argument( '--aec', dest='aec', type=str, ...
[ "def", "define_parameters", "(", "self", ")", ":", "self", ".", "add_argument", "(", "'--aet'", ",", "dest", "=", "'aet'", ",", "type", "=", "str", ",", "default", "=", "DICOM", "[", "'calling_aet'", "]", ",", "optional", "=", "True", ",", "help", "=",...
Define the CLI arguments accepted by this plugin app.
[ "Define", "the", "CLI", "arguments", "accepted", "by", "this", "plugin", "app", "." ]
[ "\"\"\"\n Define the CLI arguments accepted by this plugin app.\n \"\"\"", "# PACS settings", "# Retrieve settings" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0670720c45892d7373449493a402dcea4d3b7435
FNNDSC/pl-pacsretrieve
pacsretrieve/pacsretrieve.py
[ "MIT" ]
Python
run
<not_specific>
def run(self, options): """ Define the code to be run by this plugin app. """ # options.inputdir # common options between all request types # aet # aec # aet_listener # ip # port pacs_settings = { 'aet': options.aet, ...
Define the code to be run by this plugin app.
Define the code to be run by this plugin app.
[ "Define", "the", "code", "to", "be", "run", "by", "this", "plugin", "app", "." ]
def run(self, options): _listener pacs_settings = { 'aet': options.aet, 'aec': options.aec, 'aet_listener': options.aet_listener, 'server_ip': options.server_ip, 'server_port': options.server_port } pacs_settings['executable'] =...
[ "def", "run", "(", "self", ",", "options", ")", ":", "pacs_settings", "=", "{", "'aet'", ":", "options", ".", "aet", ",", "'aec'", ":", "options", ".", "aec", ",", "'aet_listener'", ":", "options", ".", "aet_listener", ",", "'server_ip'", ":", "options",...
Define the code to be run by this plugin app.
[ "Define", "the", "code", "to", "be", "run", "by", "this", "plugin", "app", "." ]
[ "\"\"\"\n Define the code to be run by this plugin app.\n \"\"\"", "# options.inputdir", "# common options between all request types", "# aet", "# aec", "# aet_listener", "# ip", "# port", "# echo the PACS to make sure we can access it", "# create dummy series file with all series", ...
[ { "param": "self", "type": null }, { "param": "options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "options", "type": null, "docstring": null, "docstring_tokens"...
7770201531da1d268c1dbbea09bbc29b69160c06
Bhekinkosi12/quiz-itp-w1
main.py
[ "MIT" ]
Python
question_1
<not_specific>
def question_1(): """Return the correct answer for the following question. What's the correct data type of the following values: True, False a) Integer b) Boolean c) String d) Collection """ return 'Boolean'
Return the correct answer for the following question. What's the correct data type of the following values: True, False a) Integer b) Boolean c) String d) Collection
Return the correct answer for the following question. What's the correct data type of the following values: True, False a) Integer b) Boolean c) String d) Collection
[ "Return", "the", "correct", "answer", "for", "the", "following", "question", ".", "What", "'", "s", "the", "correct", "data", "type", "of", "the", "following", "values", ":", "True", "False", "a", ")", "Integer", "b", ")", "Boolean", "c", ")", "String", ...
def question_1(): return 'Boolean'
[ "def", "question_1", "(", ")", ":", "return", "'Boolean'" ]
Return the correct answer for the following question.
[ "Return", "the", "correct", "answer", "for", "the", "following", "question", "." ]
[ "\"\"\"Return the correct answer for the following question.\n\n What's the correct data type of the following values: True, False\n\n a) Integer\n b) Boolean\n c) String\n d) Collection\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7770201531da1d268c1dbbea09bbc29b69160c06
Bhekinkosi12/quiz-itp-w1
main.py
[ "MIT" ]
Python
calculate_tax
<not_specific>
def calculate_tax(income): """Implement the code required to make this function work. Write a function `calculate_tax` that receives a number (`income`) and calculates how much of Federal taxes is due, according to the following table: | Income | Tax Percentage | | ------------- | ----------...
Implement the code required to make this function work. Write a function `calculate_tax` that receives a number (`income`) and calculates how much of Federal taxes is due, according to the following table: | Income | Tax Percentage | | ------------- | ------------- | | <= $50,000 | ...
Implement the code required to make this function work. Write a function `calculate_tax` that receives a number (`income`) and calculates how much of Federal taxes is due, according to the following table.
[ "Implement", "the", "code", "required", "to", "make", "this", "function", "work", ".", "Write", "a", "function", "`", "calculate_tax", "`", "that", "receives", "a", "number", "(", "`", "income", "`", ")", "and", "calculates", "how", "much", "of", "Federal"...
def calculate_tax(income): tax = 0 if income <= 50000: tax += (income *.15) return tax elif income >= 50000 and income <= 75000: tax += (income * .25) return tax elif income >= 75000 and income <= 100000: tax += (income * .30) return tax elif income >=...
[ "def", "calculate_tax", "(", "income", ")", ":", "tax", "=", "0", "if", "income", "<=", "50000", ":", "tax", "+=", "(", "income", "*", ".15", ")", "return", "tax", "elif", "income", ">=", "50000", "and", "income", "<=", "75000", ":", "tax", "+=", "...
Implement the code required to make this function work.
[ "Implement", "the", "code", "required", "to", "make", "this", "function", "work", "." ]
[ "\"\"\"Implement the code required to make this function work.\n\n Write a function `calculate_tax` that receives a number (`income`) and\n calculates how much of Federal taxes is due,\n according to the following table:\n\n\n | Income | Tax Percentage |\n | ------------- | ------------- |\n | <=...
[ { "param": "income", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "income", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [ { "identifier": "examples", "docstring": null,...
7770201531da1d268c1dbbea09bbc29b69160c06
Bhekinkosi12/quiz-itp-w1
main.py
[ "MIT" ]
Python
matrix_sum
<not_specific>
def matrix_sum(a_matrix): """Implement the code required to make this function work. Write a function `matrix_sum` that sums all the values in a square matrix. Example: m1 = [ [2, 9, 1], [3, 1, 18], [22, 8, 16] ] m2 = [ [81, 29], [31, 57] ] matrix_s...
Implement the code required to make this function work. Write a function `matrix_sum` that sums all the values in a square matrix. Example: m1 = [ [2, 9, 1], [3, 1, 18], [22, 8, 16] ] m2 = [ [81, 29], [31, 57] ] matrix_sum(m1) # 80 matrix_sum(m2) ...
Implement the code required to make this function work. Write a function `matrix_sum` that sums all the values in a square matrix.
[ "Implement", "the", "code", "required", "to", "make", "this", "function", "work", ".", "Write", "a", "function", "`", "matrix_sum", "`", "that", "sums", "all", "the", "values", "in", "a", "square", "matrix", "." ]
def matrix_sum(a_matrix): result = 0 for row in a_matrix: for col in row: result += col return result
[ "def", "matrix_sum", "(", "a_matrix", ")", ":", "result", "=", "0", "for", "row", "in", "a_matrix", ":", "for", "col", "in", "row", ":", "result", "+=", "col", "return", "result" ]
Implement the code required to make this function work.
[ "Implement", "the", "code", "required", "to", "make", "this", "function", "work", "." ]
[ "\"\"\"Implement the code required to make this function work.\n\n Write a function `matrix_sum` that sums all the values in a square matrix.\n Example:\n\n m1 = [\n [2, 9, 1],\n [3, 1, 18],\n [22, 8, 16]\n ]\n m2 = [\n [81, 29],\n [31, 57]\n ]\n\n matrix_sum(m1) ...
[ { "param": "a_matrix", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "a_matrix", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [ { "identifier": "examples", "docstring": nul...
c4d8d1b2889ae52acc9b000629e3d6c7c7592c2b
ninjadotorg/KPI
restapi/app/routes/answer.py
[ "MIT" ]
Python
view_detail
<not_specific>
def view_detail(): """ " view all ratings and comments of user with question id """ try: current_user = get_jwt_identity() user = db.session.query(User).filter(User.email==func.binary(current_user)).first() if user is None: return response_error(MESSAGE.USER_INVALID_EMAIL, CODE.USER_INVALID_EMAIL) revie...
" view all ratings and comments of user with question id
" view all ratings and comments of user with question id
[ "\"", "view", "all", "ratings", "and", "comments", "of", "user", "with", "question", "id" ]
def view_detail(): try: current_user = get_jwt_identity() user = db.session.query(User).filter(User.email==func.binary(current_user)).first() if user is None: return response_error(MESSAGE.USER_INVALID_EMAIL, CODE.USER_INVALID_EMAIL) review_type = request.args.get('type', '') question_id = request.args.ge...
[ "def", "view_detail", "(", ")", ":", "try", ":", "current_user", "=", "get_jwt_identity", "(", ")", "user", "=", "db", ".", "session", ".", "query", "(", "User", ")", ".", "filter", "(", "User", ".", "email", "==", "func", ".", "binary", "(", "curren...
" view all ratings and comments of user with question id
[ "\"", "view", "all", "ratings", "and", "comments", "of", "user", "with", "question", "id" ]
[ "\"\"\"\n\t\"\tview all ratings and comments of user with question id\n\t\"\"\"", "# get all ratings" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
3051d8f5b37205ec556e607691d751065d835f44
ninjadotorg/KPI
restapi/app/routes/question.py
[ "MIT" ]
Python
add_quesion_for_type
<not_specific>
def add_quesion_for_type(): """ " admin will add questions for object type which need to be reviewed """ try: data = request.json if data is None: return response_error(MESSAGE.INVALID_DATA, CODE.INVALID_DATA) review_type = request.args.get('type', '') if len(review_type) == 0: return response_error(...
" admin will add questions for object type which need to be reviewed
" admin will add questions for object type which need to be reviewed
[ "\"", "admin", "will", "add", "questions", "for", "object", "type", "which", "need", "to", "be", "reviewed" ]
def add_quesion_for_type(): try: data = request.json if data is None: return response_error(MESSAGE.INVALID_DATA, CODE.INVALID_DATA) review_type = request.args.get('type', '') if len(review_type) == 0: return response_error(MESSAGE.TYPE_INVALID, CODE.TYPE_INVALID) t = db.session.query(ReviewType).filte...
[ "def", "add_quesion_for_type", "(", ")", ":", "try", ":", "data", "=", "request", ".", "json", "if", "data", "is", "None", ":", "return", "response_error", "(", "MESSAGE", ".", "INVALID_DATA", ",", "CODE", ".", "INVALID_DATA", ")", "review_type", "=", "req...
" admin will add questions for object type which need to be reviewed
[ "\"", "admin", "will", "add", "questions", "for", "object", "type", "which", "need", "to", "be", "reviewed" ]
[ "\"\"\"\n\t\"\tadmin will add questions for object type which need to be reviewed\n\t\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
3051d8f5b37205ec556e607691d751065d835f44
ninjadotorg/KPI
restapi/app/routes/question.py
[ "MIT" ]
Python
update_question_for_type
<not_specific>
def update_question_for_type(question_id): """ " admin change question name for type """ try: review_type = request.args.get('type', '') if len(review_type) == 0: return response_error(MESSAGE.TYPE_INVALID, CODE.TYPE_INVALID) t = db.session.query(ReviewType).filter(ReviewType.name==func.binary(review_ty...
" admin change question name for type
" admin change question name for type
[ "\"", "admin", "change", "question", "name", "for", "type" ]
def update_question_for_type(question_id): try: review_type = request.args.get('type', '') if len(review_type) == 0: return response_error(MESSAGE.TYPE_INVALID, CODE.TYPE_INVALID) t = db.session.query(ReviewType).filter(ReviewType.name==func.binary(review_type)).first() if t is None: return response_erro...
[ "def", "update_question_for_type", "(", "question_id", ")", ":", "try", ":", "review_type", "=", "request", ".", "args", ".", "get", "(", "'type'", ",", "''", ")", "if", "len", "(", "review_type", ")", "==", "0", ":", "return", "response_error", "(", "ME...
" admin change question name for type
[ "\"", "admin", "change", "question", "name", "for", "type" ]
[ "\"\"\"\n\t\"\tadmin change question name for type\n\t\"\"\"" ]
[ { "param": "question_id", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "question_id", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
01fb7d0990bf7f41d7ac561ebd043a58515cbd71
lzaoral/symbiotic
lib/symbioticpy/symbiotic/property.py
[ "MIT" ]
Python
nullderef
<not_specific>
def nullderef(self): """ Check for null dereferences (this property is distinct from memsafety) """ return False
Check for null dereferences (this property is distinct from memsafety)
Check for null dereferences (this property is distinct from memsafety)
[ "Check", "for", "null", "dereferences", "(", "this", "property", "is", "distinct", "from", "memsafety", ")" ]
def nullderef(self): return False
[ "def", "nullderef", "(", "self", ")", ":", "return", "False" ]
Check for null dereferences (this property is distinct from memsafety)
[ "Check", "for", "null", "dereferences", "(", "this", "property", "is", "distinct", "from", "memsafety", ")" ]
[ "\"\"\"\n Check for null dereferences (this property is distinct from memsafety)\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b6e91d6b6b1d3bd87da00a5a365feb6cbbd0291
lzaoral/symbiotic
lib/symbioticpy/symbiotic/targets/tool.py
[ "MIT" ]
Python
compilation_options
<not_specific>
def compilation_options(self): """ List of compilation options specific for the tool """ opts = [] if self._options.property.undefinedness(): opts.append('-fsanitize=undefined') opts.append('-fno-sanitize=unsigned-integer-overflow') elif self._opti...
List of compilation options specific for the tool
List of compilation options specific for the tool
[ "List", "of", "compilation", "options", "specific", "for", "the", "tool" ]
def compilation_options(self): opts = [] if self._options.property.undefinedness(): opts.append('-fsanitize=undefined') opts.append('-fno-sanitize=unsigned-integer-overflow') elif self._options.property.signedoverflow(): opts.append('-fsanitize=signed-integer-...
[ "def", "compilation_options", "(", "self", ")", ":", "opts", "=", "[", "]", "if", "self", ".", "_options", ".", "property", ".", "undefinedness", "(", ")", ":", "opts", ".", "append", "(", "'-fsanitize=undefined'", ")", "opts", ".", "append", "(", "'-fno...
List of compilation options specific for the tool
[ "List", "of", "compilation", "options", "specific", "for", "the", "tool" ]
[ "\"\"\"\n List of compilation options specific for the tool\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b6e91d6b6b1d3bd87da00a5a365feb6cbbd0291
lzaoral/symbiotic
lib/symbioticpy/symbiotic/targets/tool.py
[ "MIT" ]
Python
instrumentation_options
<not_specific>
def instrumentation_options(self): """ Returns a triple (d, c, l, x) where d is the directory with configuration files, c is the configuration file for instrumentation (or None if no instrumentation should be performed), l is the file with definitions of the instrumented ...
Returns a triple (d, c, l, x) where d is the directory with configuration files, c is the configuration file for instrumentation (or None if no instrumentation should be performed), l is the file with definitions of the instrumented functions and x is True if the definit...
Returns a triple (d, c, l, x) where d is the directory with configuration files, c is the configuration file for instrumentation (or None if no instrumentation should be performed), l is the file with definitions of the instrumented functions and x is True if the definitions should be linked after instrumentation (and ...
[ "Returns", "a", "triple", "(", "d", "c", "l", "x", ")", "where", "d", "is", "the", "directory", "with", "configuration", "files", "c", "is", "the", "configuration", "file", "for", "instrumentation", "(", "or", "None", "if", "no", "instrumentation", "should...
def instrumentation_options(self): if self._options.property.signedoverflow() and\ self._options.overflow_with_clang: return (None, None, None, None) if self._options.full_instrumentation: if self._options.property.memsafety(): return ('memsafety', s...
[ "def", "instrumentation_options", "(", "self", ")", ":", "if", "self", ".", "_options", ".", "property", ".", "signedoverflow", "(", ")", "and", "self", ".", "_options", ".", "overflow_with_clang", ":", "return", "(", "None", ",", "None", ",", "None", ",",...
Returns a triple (d, c, l, x) where d is the directory with configuration files, c is the configuration file for instrumentation (or None if no instrumentation should be performed), l is the file with definitions of the instrumented functions and x is True if the definitions should be linked after instrumentation (and ...
[ "Returns", "a", "triple", "(", "d", "c", "l", "x", ")", "where", "d", "is", "the", "directory", "with", "configuration", "files", "c", "is", "the", "configuration", "file", "for", "instrumentation", "(", "or", "None", "if", "no", "instrumentation", "should...
[ "\"\"\"\n Returns a triple (d, c, l, x) where d is the directory\n with configuration files, c is the configuration\n file for instrumentation (or None if no instrumentation\n should be performed), l is the\n file with definitions of the instrumented functions\n and x is Tr...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5b6e91d6b6b1d3bd87da00a5a365feb6cbbd0291
lzaoral/symbiotic
lib/symbioticpy/symbiotic/targets/tool.py
[ "MIT" ]
Python
slicer_options
<not_specific>
def slicer_options(self): """ Returns tuple (c, opts) where c is the slicing criterion and opts is a list of options """ if self._options.full_instrumentation: # all is reachability return (self._options.slicing_criterion,[]) if self._options.pro...
Returns tuple (c, opts) where c is the slicing criterion and opts is a list of options
Returns tuple (c, opts) where c is the slicing criterion and opts is a list of options
[ "Returns", "tuple", "(", "c", "opts", ")", "where", "c", "is", "the", "slicing", "criterion", "and", "opts", "is", "a", "list", "of", "options" ]
def slicer_options(self): if self._options.full_instrumentation: return (self._options.slicing_criterion,[]) if self._options.property.memsafety(): return ('__INSTR_mark_pointer,__INSTR_mark_free,__INSTR_mark_allocation,__INSTR_mark_exit', ['-memsafety']) ...
[ "def", "slicer_options", "(", "self", ")", ":", "if", "self", ".", "_options", ".", "full_instrumentation", ":", "return", "(", "self", ".", "_options", ".", "slicing_criterion", ",", "[", "]", ")", "if", "self", ".", "_options", ".", "property", ".", "m...
Returns tuple (c, opts) where c is the slicing criterion and opts is a list of options
[ "Returns", "tuple", "(", "c", "opts", ")", "where", "c", "is", "the", "slicing", "criterion", "and", "opts", "is", "a", "list", "of", "options" ]
[ "\"\"\"\n Returns tuple (c, opts) where c is the slicing\n criterion and opts is a list of options\n \"\"\"", "# all is reachability", "# default config file is 'config.json'", "# slice with respect to the memory handling operations", "# default config file is 'config.json'", "# slice...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8f87ababacbec684ca26554d278b9f6cb4e66e12
lzaoral/symbiotic
lib/symbioticpy/symbiotic/transform.py
[ "MIT" ]
Python
run
<not_specific>
def run(self): """ Compile the program, optimize and slice it and return the name of the created bitcode """ restart_counting_time() dbg('Running symbiotic-cc for {0}'.format(self._tool.name())) self._disable_some_optimizations(self._tool.llvm_version()) ...
Compile the program, optimize and slice it and return the name of the created bitcode
Compile the program, optimize and slice it and return the name of the created bitcode
[ "Compile", "the", "program", "optimize", "and", "slice", "it", "and", "return", "the", "name", "of", "the", "created", "bitcode" ]
def run(self): restart_counting_time() dbg('Running symbiotic-cc for {0}'.format(self._tool.name())) self._disable_some_optimizations(self._tool.llvm_version()) self._compile_sources() self.curfile = os.path.abspath(self.curfile) self._save_ll() self._get_stats('A...
[ "def", "run", "(", "self", ")", ":", "restart_counting_time", "(", ")", "dbg", "(", "'Running symbiotic-cc for {0}'", ".", "format", "(", "self", ".", "_tool", ".", "name", "(", ")", ")", ")", "self", ".", "_disable_some_optimizations", "(", "self", ".", "...
Compile the program, optimize and slice it and return the name of the created bitcode
[ "Compile", "the", "program", "optimize", "and", "slice", "it", "and", "return", "the", "name", "of", "the", "created", "bitcode" ]
[ "\"\"\"\n Compile the program, optimize and slice it and\n return the name of the created bitcode\n \"\"\"", "#################### #################### ###################", "# COMPILATION", "# - compile the code into LLVM bitcode", "#################### #################### ##########...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
86898c96d019281799ca158abe99c508e2d60177
lzaoral/symbiotic
lib/symbioticpy/symbiotic/targets/predator.py
[ "MIT" ]
Python
passes_before_verification
<not_specific>
def passes_before_verification(self): """ Passes that should run before CPAchecker """ # llvm2c has a bug with PHI nodes return ["-lowerswitch", "-simplifycfg"]
Passes that should run before CPAchecker
Passes that should run before CPAchecker
[ "Passes", "that", "should", "run", "before", "CPAchecker" ]
def passes_before_verification(self): return ["-lowerswitch", "-simplifycfg"]
[ "def", "passes_before_verification", "(", "self", ")", ":", "return", "[", "\"-lowerswitch\"", ",", "\"-simplifycfg\"", "]" ]
Passes that should run before CPAchecker
[ "Passes", "that", "should", "run", "before", "CPAchecker" ]
[ "\"\"\"\n Passes that should run before CPAchecker\n \"\"\"", "# llvm2c has a bug with PHI nodes" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
30dd821e5997e6789326cae772aa4a4429dc3148
Visgean/photos2geojson
photos2geojson/utils.py
[ "MIT" ]
Python
convert_to_degress
<not_specific>
def convert_to_degress(value): """ Helper function to convert the GPS coordinates stored in the EXIF to degress in float format :param value: :type value: exifread.utils.Ratio :rtype: float """ try: d = float(value.values[0].num) / float(value.values[0].den) m = float(value.v...
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format :param value: :type value: exifread.utils.Ratio :rtype: float
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format
[ "Helper", "function", "to", "convert", "the", "GPS", "coordinates", "stored", "in", "the", "EXIF", "to", "degress", "in", "float", "format" ]
def convert_to_degress(value): try: d = float(value.values[0].num) / float(value.values[0].den) m = float(value.values[1].num) / float(value.values[1].den) s = float(value.values[2].num) / float(value.values[2].den) except (ZeroDivisionError, IndexError) as e: d = m = s = 0 r...
[ "def", "convert_to_degress", "(", "value", ")", ":", "try", ":", "d", "=", "float", "(", "value", ".", "values", "[", "0", "]", ".", "num", ")", "/", "float", "(", "value", ".", "values", "[", "0", "]", ".", "den", ")", "m", "=", "float", "(", ...
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format
[ "Helper", "function", "to", "convert", "the", "GPS", "coordinates", "stored", "in", "the", "EXIF", "to", "degress", "in", "float", "format" ]
[ "\"\"\"\n Helper function to convert the GPS coordinates stored in the EXIF to degress in float format\n :param value:\n :type value: exifread.utils.Ratio\n :rtype: float\n \"\"\"" ]
[ { "param": "value", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
e68d19e8bfa59180ff22bbdbb593b0006843b7b9
Tulip2MF/100_Days_Challenge
day_014/functions_higher_lower.py
[ "Unlicense" ]
Python
check_followers
<not_specific>
def check_followers(user_selection, a_name,a_follower_count,b_name,b_follower_count): """ This function will check the user selection against the first and second cards and give result""" if a_follower_count == b_follower_count: print("Both of them got same number of followers") elif a_follower_coun...
This function will check the user selection against the first and second cards and give result
This function will check the user selection against the first and second cards and give result
[ "This", "function", "will", "check", "the", "user", "selection", "against", "the", "first", "and", "second", "cards", "and", "give", "result" ]
def check_followers(user_selection, a_name,a_follower_count,b_name,b_follower_count): if a_follower_count == b_follower_count: print("Both of them got same number of followers") elif a_follower_count > b_follower_count: if user_selection == a_name: print("You are correct") ...
[ "def", "check_followers", "(", "user_selection", ",", "a_name", ",", "a_follower_count", ",", "b_name", ",", "b_follower_count", ")", ":", "if", "a_follower_count", "==", "b_follower_count", ":", "print", "(", "\"Both of them got same number of followers\"", ")", "elif"...
This function will check the user selection against the first and second cards and give result
[ "This", "function", "will", "check", "the", "user", "selection", "against", "the", "first", "and", "second", "cards", "and", "give", "result" ]
[ "\"\"\" This function will check the user selection against the first and second cards and give result\"\"\"" ]
[ { "param": "user_selection", "type": null }, { "param": "a_name", "type": null }, { "param": "a_follower_count", "type": null }, { "param": "b_name", "type": null }, { "param": "b_follower_count", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "user_selection", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a_name", "type": null, "docstring": null, "docstrin...
8c14033f2290460d5a3a0a7540f4334cad516b23
Tulip2MF/100_Days_Challenge
day_012/check_number_function.py
[ "Unlicense" ]
Python
number_check
<not_specific>
def number_check(input_number, generated_number,chances,tries): """This function checks whether the number guessed by user is above, equal or below the other random number where both the numbers are given as input""" if input_number == generated_number: print(f"You guessed it correct. The number is ...
This function checks whether the number guessed by user is above, equal or below the other random number where both the numbers are given as input
This function checks whether the number guessed by user is above, equal or below the other random number where both the numbers are given as input
[ "This", "function", "checks", "whether", "the", "number", "guessed", "by", "user", "is", "above", "equal", "or", "below", "the", "other", "random", "number", "where", "both", "the", "numbers", "are", "given", "as", "input" ]
def number_check(input_number, generated_number,chances,tries): if input_number == generated_number: print(f"You guessed it correct. The number is {input_number}") return "y" elif input_number > generated_number: print(f"{input_number} is too high\nYou got {chances - tries - 1} tries lef...
[ "def", "number_check", "(", "input_number", ",", "generated_number", ",", "chances", ",", "tries", ")", ":", "if", "input_number", "==", "generated_number", ":", "print", "(", "f\"You guessed it correct. The number is {input_number}\"", ")", "return", "\"y\"", "elif", ...
This function checks whether the number guessed by user is above, equal or below the other random number where both the numbers are given as input
[ "This", "function", "checks", "whether", "the", "number", "guessed", "by", "user", "is", "above", "equal", "or", "below", "the", "other", "random", "number", "where", "both", "the", "numbers", "are", "given", "as", "input" ]
[ "\"\"\"This function checks whether the number guessed by user is above, equal or below the other random number\n where both the numbers are given as input\"\"\"" ]
[ { "param": "input_number", "type": null }, { "param": "generated_number", "type": null }, { "param": "chances", "type": null }, { "param": "tries", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_number", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "generated_number", "type": null, "docstring": null, "...
b9218403ac1c398615b19e99196428e570c3df2c
vsoch/wordfish-plugins
pubmed/functions.py
[ "MIT" ]
Python
download_pubmed
null
def download_pubmed(pmids,download_folder,ftp=None): """download_pubmed Download full text of articles with pubmed ids pmids to folder pmids: list of pubmed ids to download download_folder: destination folder ftp: pandas data frame of pubmed ftp. If...
download_pubmed Download full text of articles with pubmed ids pmids to folder pmids: list of pubmed ids to download download_folder: destination folder ftp: pandas data frame of pubmed ftp. If not provided, will be obtained and read program...
download_pubmed Download full text of articles with pubmed ids pmids to folder pmids: list of pubmed ids to download download_folder: destination folder ftp: pandas data frame of pubmed ftp. If not provided, will be obtained and read programatically. If this function is being run in a cluster environment, it is recomme...
[ "download_pubmed", "Download", "full", "text", "of", "articles", "with", "pubmed", "ids", "pmids", "to", "folder", "pmids", ":", "list", "of", "pubmed", "ids", "to", "download", "download_folder", ":", "destination", "folder", "ftp", ":", "pandas", "data", "fr...
def download_pubmed(pmids,download_folder,ftp=None): if ftp == None: ftp = get_ftp() if isinstance(pmids,str): pmids = [pmids] subset = pandas.DataFrame(columns=ftp.columns) for p in pmids: row = ftp.loc[ftp.index[ftp.PMCID == p]] subset = subset.append(row) for row i...
[ "def", "download_pubmed", "(", "pmids", ",", "download_folder", ",", "ftp", "=", "None", ")", ":", "if", "ftp", "==", "None", ":", "ftp", "=", "get_ftp", "(", ")", "if", "isinstance", "(", "pmids", ",", "str", ")", ":", "pmids", "=", "[", "pmids", ...
download_pubmed Download full text of articles with pubmed ids pmids to folder pmids: list of pubmed ids to download download_folder: destination folder ftp: pandas data frame of pubmed ftp.
[ "download_pubmed", "Download", "full", "text", "of", "articles", "with", "pubmed", "ids", "pmids", "to", "folder", "pmids", ":", "list", "of", "pubmed", "ids", "to", "download", "download_folder", ":", "destination", "folder", "ftp", ":", "pandas", "data", "fr...
[ "\"\"\"download_pubmed\n Download full text of articles with pubmed ids pmids to folder\n pmids: \n list of pubmed ids to download\n download_folder: \n destination folder\n ftp: \n pandas data frame of pubmed ftp. If not provided,\n will be obtain...
[ { "param": "pmids", "type": null }, { "param": "download_folder", "type": null }, { "param": "ftp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pmids", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "download_folder", "type": null, "docstring": null, "docstrin...
b9218403ac1c398615b19e99196428e570c3df2c
vsoch/wordfish-plugins
pubmed/functions.py
[ "MIT" ]
Python
search_abstract
<not_specific>
def search_abstract(article,terms,stem=False): '''search_article Search article for one or more terms of interest - no processing of expression. return 1 if found, 0 if not article: Article an Article object terms: str/list a list of terms to be compiled with re stem: boolean ...
search_article Search article for one or more terms of interest - no processing of expression. return 1 if found, 0 if not article: Article an Article object terms: str/list a list of terms to be compiled with re stem: boolean if True, stem article words first
search_article Search article for one or more terms of interest - no processing of expression. return 1 if found, 0 if not Article an Article object terms: str/list a list of terms to be compiled with re stem: boolean if True, stem article words first
[ "search_article", "Search", "article", "for", "one", "or", "more", "terms", "of", "interest", "-", "no", "processing", "of", "expression", ".", "return", "1", "if", "found", "0", "if", "not", "Article", "an", "Article", "object", "terms", ":", "str", "/", ...
def search_abstract(article,terms,stem=False): text = [article.getAbstract()] + article.getMesh() + article.getKeywords() text = text[0].lower() if stem: words = do_stem(terms,return_unique=True) term = "|".join([x.strip(" ").lower() for x in words]) expression = re.compile(term) found =...
[ "def", "search_abstract", "(", "article", ",", "terms", ",", "stem", "=", "False", ")", ":", "text", "=", "[", "article", ".", "getAbstract", "(", ")", "]", "+", "article", ".", "getMesh", "(", ")", "+", "article", ".", "getKeywords", "(", ")", "text...
search_article Search article for one or more terms of interest - no processing of expression.
[ "search_article", "Search", "article", "for", "one", "or", "more", "terms", "of", "interest", "-", "no", "processing", "of", "expression", "." ]
[ "'''search_article\n Search article for one or more terms of interest - no processing of expression. return 1 if found, 0 if not\n\n article: Article \n an Article object\n terms: str/list\n a list of terms to be compiled with re\n stem: boolean\n if True, stem article words first\n...
[ { "param": "article", "type": null }, { "param": "terms", "type": null }, { "param": "stem", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "article", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "terms", "type": null, "docstring": null, "docstring_tokens...
b9218403ac1c398615b19e99196428e570c3df2c
vsoch/wordfish-plugins
pubmed/functions.py
[ "MIT" ]
Python
search_articles
<not_specific>
def search_articles(searchterm,email): '''search_articles Return list of articles based on search term Parameters ========== searchterm: str a search term to search for Returns ======= articles: Article objects a list of articles that match search term ''' print "G...
search_articles Return list of articles based on search term Parameters ========== searchterm: str a search term to search for Returns ======= articles: Article objects a list of articles that match search term
search_articles Return list of articles based on search term Parameters str a search term to search for Returns Article objects a list of articles that match search term
[ "search_articles", "Return", "list", "of", "articles", "based", "on", "search", "term", "Parameters", "str", "a", "search", "term", "to", "search", "for", "Returns", "Article", "objects", "a", "list", "of", "articles", "that", "match", "search", "term" ]
def search_articles(searchterm,email): print "Getting pubmed articles for search term %s" %(searchterm) Entrez.email = email handle = Entrez.esearch(db='pubmed',term=searchterm,retmax=5000) record = Entrez.read(handle) if "IdList" in record: if record["Count"] != "0": ids = recor...
[ "def", "search_articles", "(", "searchterm", ",", "email", ")", ":", "print", "\"Getting pubmed articles for search term %s\"", "%", "(", "searchterm", ")", "Entrez", ".", "email", "=", "email", "handle", "=", "Entrez", ".", "esearch", "(", "db", "=", "'pubmed'"...
search_articles Return list of articles based on search term Parameters
[ "search_articles", "Return", "list", "of", "articles", "based", "on", "search", "term", "Parameters" ]
[ "'''search_articles\n Return list of articles based on search term\n Parameters\n ==========\n searchterm: str\n a search term to search for\n Returns\n =======\n articles: Article objects\n a list of articles that match search term\n '''", "# If there are papers", "# Fetch ...
[ { "param": "searchterm", "type": null }, { "param": "email", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "searchterm", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "email", "type": null, "docstring": null, "docstring_tok...
f7d666c2baa8dbe44ddc2710da9946633bfd4e0f
vsoch/wordfish-plugins
neurosynth/functions.py
[ "MIT" ]
Python
download_data
<not_specific>
def download_data(destination=None): '''download_data download neurosynth repo data to a temporary or specified destination return path to features and database files Parameters ========== destination: path full path to download destination. If none, will use temporary directory Retu...
download_data download neurosynth repo data to a temporary or specified destination return path to features and database files Parameters ========== destination: path full path to download destination. If none, will use temporary directory Returns ======= database,features: paths...
download_data download neurosynth repo data to a temporary or specified destination return path to features and database files Parameters path full path to download destination. If none, will use temporary directory Returns database,features: paths full paths to database and features files
[ "download_data", "download", "neurosynth", "repo", "data", "to", "a", "temporary", "or", "specified", "destination", "return", "path", "to", "features", "and", "database", "files", "Parameters", "path", "full", "path", "to", "download", "destination", ".", "If", ...
def download_data(destination=None): print "Downloading neurosynth database..." if destination==None: destination = download_repo(repo_url="https://github.com/neurosynth/neurosynth-data") else: download_repo(repo_url="https://github.com/neurosynth/neurosynth-data",tmpdir=destination) unt...
[ "def", "download_data", "(", "destination", "=", "None", ")", ":", "print", "\"Downloading neurosynth database...\"", "if", "destination", "==", "None", ":", "destination", "=", "download_repo", "(", "repo_url", "=", "\"https://github.com/neurosynth/neurosynth-data\"", ")...
download_data download neurosynth repo data to a temporary or specified destination return path to features and database files Parameters
[ "download_data", "download", "neurosynth", "repo", "data", "to", "a", "temporary", "or", "specified", "destination", "return", "path", "to", "features", "and", "database", "files", "Parameters" ]
[ "'''download_data\n download neurosynth repo data to a temporary or specified destination\n return path to features and database files\n Parameters\n ==========\n destination: path\n full path to download destination. If none, will use temporary directory\n Returns\n =======\n databas...
[ { "param": "destination", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "destination", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e9f73197cd4a502cecd9b71ca4fca31c57140f4f
vsoch/wordfish-plugins
reddit/functions.py
[ "MIT" ]
Python
extract_text
null
def extract_text(boards,output_dir): '''extract_text main function for parsing reddit boards into deepdive input corpus Parameters ========== boards: list list of reddit boards to parse ''' if isinstance(boards,str): boards = [boards] if has_internet_connectivity(): r = p...
extract_text main function for parsing reddit boards into deepdive input corpus Parameters ========== boards: list list of reddit boards to parse
extract_text main function for parsing reddit boards into deepdive input corpus Parameters list list of reddit boards to parse
[ "extract_text", "main", "function", "for", "parsing", "reddit", "boards", "into", "deepdive", "input", "corpus", "Parameters", "list", "list", "of", "reddit", "boards", "to", "parse" ]
def extract_text(boards,output_dir): if isinstance(boards,str): boards = [boards] if has_internet_connectivity(): r = praw.Reddit(user_agent='wordfish') for board in boards: corpus_input = dict() print "Parsing %s" %board submissions = r.get_subreddit(board).g...
[ "def", "extract_text", "(", "boards", ",", "output_dir", ")", ":", "if", "isinstance", "(", "boards", ",", "str", ")", ":", "boards", "=", "[", "boards", "]", "if", "has_internet_connectivity", "(", ")", ":", "r", "=", "praw", ".", "Reddit", "(", "user...
extract_text main function for parsing reddit boards into deepdive input corpus Parameters
[ "extract_text", "main", "function", "for", "parsing", "reddit", "boards", "into", "deepdive", "input", "corpus", "Parameters" ]
[ "'''extract_text\n main function for parsing reddit boards into deepdive input corpus\n Parameters\n ==========\n boards: list\n list of reddit boards to parse\n '''", "# For each result, package into the right format for text parsing", "# Save articles to text files in output folder "...
[ { "param": "boards", "type": null }, { "param": "output_dir", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "boards", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_dir", "type": null, "docstring": null, "docstring_to...
b8d392f84453059a12f9169b84807a433e7e3a3d
theletterf/collectd-spark
spark_plugin.py
[ "Apache-2.0" ]
Python
_validate_kv
<not_specific>
def _validate_kv(kv): """ check for malformed data on split Args: kv (list): List of key value pair Returns: bool: True if list contained expected pair and False otherwise """ if len(kv) == 2 and "" not in kv: return True return False
check for malformed data on split Args: kv (list): List of key value pair Returns: bool: True if list contained expected pair and False otherwise
check for malformed data on split Args: kv (list): List of key value pair True if list contained expected pair and False otherwise
[ "check", "for", "malformed", "data", "on", "split", "Args", ":", "kv", "(", "list", ")", ":", "List", "of", "key", "value", "pair", "True", "if", "list", "contained", "expected", "pair", "and", "False", "otherwise" ]
def _validate_kv(kv): if len(kv) == 2 and "" not in kv: return True return False
[ "def", "_validate_kv", "(", "kv", ")", ":", "if", "len", "(", "kv", ")", "==", "2", "and", "\"\"", "not", "in", "kv", ":", "return", "True", "return", "False" ]
check for malformed data on split Args: kv (list): List of key value pair
[ "check", "for", "malformed", "data", "on", "split", "Args", ":", "kv", "(", "list", ")", ":", "List", "of", "key", "value", "pair" ]
[ "\"\"\"\n check for malformed data on split\n\n Args:\n kv (list): List of key value pair\n\n Returns:\n bool: True if list contained expected pair and False otherwise\n \"\"\"" ]
[ { "param": "kv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "kv", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b8d392f84453059a12f9169b84807a433e7e3a3d
theletterf/collectd-spark
spark_plugin.py
[ "Apache-2.0" ]
Python
_dimensions_str_to_dict
<not_specific>
def _dimensions_str_to_dict(dimensions_str): """ convert str config of dimensions into dictionary Args: dimensions_str (str): String representing custom dimensions """ dimensions = {} dimensions_list = dimensions_str.strip().split(",") for dimension in dimensions_list: kv = di...
convert str config of dimensions into dictionary Args: dimensions_str (str): String representing custom dimensions
convert str config of dimensions into dictionary Args: dimensions_str (str): String representing custom dimensions
[ "convert", "str", "config", "of", "dimensions", "into", "dictionary", "Args", ":", "dimensions_str", "(", "str", ")", ":", "String", "representing", "custom", "dimensions" ]
def _dimensions_str_to_dict(dimensions_str): dimensions = {} dimensions_list = dimensions_str.strip().split(",") for dimension in dimensions_list: kv = dimension.strip().split("=") if _validate_kv(kv): dimensions[kv[0]] = kv[1] else: collectd.info( ...
[ "def", "_dimensions_str_to_dict", "(", "dimensions_str", ")", ":", "dimensions", "=", "{", "}", "dimensions_list", "=", "dimensions_str", ".", "strip", "(", ")", ".", "split", "(", "\",\"", ")", "for", "dimension", "in", "dimensions_list", ":", "kv", "=", "d...
convert str config of dimensions into dictionary Args: dimensions_str (str): String representing custom dimensions
[ "convert", "str", "config", "of", "dimensions", "into", "dictionary", "Args", ":", "dimensions_str", "(", "str", ")", ":", "String", "representing", "custom", "dimensions" ]
[ "\"\"\"\n convert str config of dimensions into dictionary\n\n Args:\n dimensions_str (str): String representing custom dimensions\n \"\"\"" ]
[ { "param": "dimensions_str", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dimensions_str", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b8d392f84453059a12f9169b84807a433e7e3a3d
theletterf/collectd-spark
spark_plugin.py
[ "Apache-2.0" ]
Python
emit
null
def emit(self, metric_record): """ Construct a single collectd Values instance from the given MetricRecord and dispatch. """ emit_value = collectd.Values() emit_value.plugin = PLUGIN_NAME emit_value.values = [metric_record.value] emit_value.type = metric_r...
Construct a single collectd Values instance from the given MetricRecord and dispatch.
Construct a single collectd Values instance from the given MetricRecord and dispatch.
[ "Construct", "a", "single", "collectd", "Values", "instance", "from", "the", "given", "MetricRecord", "and", "dispatch", "." ]
def emit(self, metric_record): emit_value = collectd.Values() emit_value.plugin = PLUGIN_NAME emit_value.values = [metric_record.value] emit_value.type = metric_record.type emit_value.type_instance = metric_record.name emit_value.plugin_instance = "[{0}]".format(self._for...
[ "def", "emit", "(", "self", ",", "metric_record", ")", ":", "emit_value", "=", "collectd", ".", "Values", "(", ")", "emit_value", ".", "plugin", "=", "PLUGIN_NAME", "emit_value", ".", "values", "=", "[", "metric_record", ".", "value", "]", "emit_value", "....
Construct a single collectd Values instance from the given MetricRecord and dispatch.
[ "Construct", "a", "single", "collectd", "Values", "instance", "from", "the", "given", "MetricRecord", "and", "dispatch", "." ]
[ "\"\"\"\n Construct a single collectd Values instance from the given MetricRecord\n and dispatch.\n \"\"\"", "# With some versions of CollectD, a dummy metadata map must to be added", "# to each value for it to be correctly serialized to JSON by the", "# write_http plugin. See", "# http...
[ { "param": "self", "type": null }, { "param": "metric_record", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "metric_record", "type": null, "docstring": null, "docstring_t...
b8d392f84453059a12f9169b84807a433e7e3a3d
theletterf/collectd-spark
spark_plugin.py
[ "Apache-2.0" ]
Python
_format_dimensions
<not_specific>
def _format_dimensions(self, dimensions): """ Formats a dictionary of key/value pairs as a comma-delimited list of key=value tokens. Taken from docker-collectd-plugin. """ return ",".join(["=".join((key.replace(".", "_"), value)) for key, value in dimensions.items()])
Formats a dictionary of key/value pairs as a comma-delimited list of key=value tokens. Taken from docker-collectd-plugin.
Formats a dictionary of key/value pairs as a comma-delimited list of key=value tokens. Taken from docker-collectd-plugin.
[ "Formats", "a", "dictionary", "of", "key", "/", "value", "pairs", "as", "a", "comma", "-", "delimited", "list", "of", "key", "=", "value", "tokens", ".", "Taken", "from", "docker", "-", "collectd", "-", "plugin", "." ]
def _format_dimensions(self, dimensions): return ",".join(["=".join((key.replace(".", "_"), value)) for key, value in dimensions.items()])
[ "def", "_format_dimensions", "(", "self", ",", "dimensions", ")", ":", "return", "\",\"", ".", "join", "(", "[", "\"=\"", ".", "join", "(", "(", "key", ".", "replace", "(", "\".\"", ",", "\"_\"", ")", ",", "value", ")", ")", "for", "key", ",", "val...
Formats a dictionary of key/value pairs as a comma-delimited list of key=value tokens.
[ "Formats", "a", "dictionary", "of", "key", "/", "value", "pairs", "as", "a", "comma", "-", "delimited", "list", "of", "key", "=", "value", "tokens", "." ]
[ "\"\"\"\n Formats a dictionary of key/value pairs\n as a comma-delimited list of key=value tokens.\n Taken from docker-collectd-plugin.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dimensions", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dimensions", "type": null, "docstring": null, "docstring_toke...
b8d392f84453059a12f9169b84807a433e7e3a3d
theletterf/collectd-spark
spark_plugin.py
[ "Apache-2.0" ]
Python
request_metrics
<not_specific>
def request_metrics(self, url, path, *args, **kwargs): """ Makes REST call and converts response to JSON """ resp = self.rest_request(url, path, *args, **kwargs) if not resp: return [] try: return json.load(resp) except ValueError as e: ...
Makes REST call and converts response to JSON
Makes REST call and converts response to JSON
[ "Makes", "REST", "call", "and", "converts", "response", "to", "JSON" ]
def request_metrics(self, url, path, *args, **kwargs): resp = self.rest_request(url, path, *args, **kwargs) if not resp: return [] try: return json.load(resp) except ValueError as e: collectd.info("Error parsing JSON from API call (%s) %s/%s" % (e, url...
[ "def", "request_metrics", "(", "self", ",", "url", ",", "path", ",", "*", "args", ",", "**", "kwargs", ")", ":", "resp", "=", "self", ".", "rest_request", "(", "url", ",", "path", ",", "*", "args", ",", "**", "kwargs", ")", "if", "not", "resp", "...
Makes REST call and converts response to JSON
[ "Makes", "REST", "call", "and", "converts", "response", "to", "JSON" ]
[ "\"\"\"\n Makes REST call and converts response to JSON\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "url", "type": null }, { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens": []...