repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
sassoo/goldman
goldman/resources/model.py
on_delete
def on_delete(resc, req, resp, rid): # pylint: disable=unused-argument """ Delete the single item Upon a successful deletion an empty bodied 204 is returned. """ signals.pre_req.send(resc.model) signals.pre_req_delete.send(resc.model) model = find(resc.model, rid) goldman.sess.store....
python
def on_delete(resc, req, resp, rid): # pylint: disable=unused-argument """ Delete the single item Upon a successful deletion an empty bodied 204 is returned. """ signals.pre_req.send(resc.model) signals.pre_req_delete.send(resc.model) model = find(resc.model, rid) goldman.sess.store....
[ "def", "on_delete", "(", "resc", ",", "req", ",", "resp", ",", "rid", ")", ":", "# pylint: disable=unused-argument", "signals", ".", "pre_req", ".", "send", "(", "resc", ".", "model", ")", "signals", ".", "pre_req_delete", ".", "send", "(", "resc", ".", ...
Delete the single item Upon a successful deletion an empty bodied 204 is returned.
[ "Delete", "the", "single", "item" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L23-L39
sassoo/goldman
goldman/resources/model.py
on_get
def on_get(resc, req, resp, rid): """ Find the model by id & serialize it back """ signals.pre_req.send(resc.model) signals.pre_req_find.send(resc.model) model = find(resc.model, rid) props = to_rest_model(model, includes=req.includes) resp.last_modified = model.updated resp.serialize(pro...
python
def on_get(resc, req, resp, rid): """ Find the model by id & serialize it back """ signals.pre_req.send(resc.model) signals.pre_req_find.send(resc.model) model = find(resc.model, rid) props = to_rest_model(model, includes=req.includes) resp.last_modified = model.updated resp.serialize(pro...
[ "def", "on_get", "(", "resc", ",", "req", ",", "resp", ",", "rid", ")", ":", "signals", ".", "pre_req", ".", "send", "(", "resc", ".", "model", ")", "signals", ".", "pre_req_find", ".", "send", "(", "resc", ".", "model", ")", "model", "=", "find", ...
Find the model by id & serialize it back
[ "Find", "the", "model", "by", "id", "&", "serialize", "it", "back" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L42-L55
sassoo/goldman
goldman/resources/model.py
on_patch
def on_patch(resc, req, resp, rid): """ Deserialize the payload & update the single item """ signals.pre_req.send(resc.model) signals.pre_req_update.send(resc.model) props = req.deserialize() model = find(resc.model, rid) from_rest(model, props) goldman.sess.store.update(model) props...
python
def on_patch(resc, req, resp, rid): """ Deserialize the payload & update the single item """ signals.pre_req.send(resc.model) signals.pre_req_update.send(resc.model) props = req.deserialize() model = find(resc.model, rid) from_rest(model, props) goldman.sess.store.update(model) props...
[ "def", "on_patch", "(", "resc", ",", "req", ",", "resp", ",", "rid", ")", ":", "signals", ".", "pre_req", ".", "send", "(", "resc", ".", "model", ")", "signals", ".", "pre_req_update", ".", "send", "(", "resc", ".", "model", ")", "props", "=", "req...
Deserialize the payload & update the single item
[ "Deserialize", "the", "payload", "&", "update", "the", "single", "item" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L58-L75
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/parser_xml.py
decode
def decode(data): """ Handles decoding of the XML `data`. Args: data (str): Data which will be decoded. Returns: dict: Dictionary with decoded data. """ dom = None try: dom = dhtmlparser.parseString(data) except Exception, e: raise MetaParsingException("...
python
def decode(data): """ Handles decoding of the XML `data`. Args: data (str): Data which will be decoded. Returns: dict: Dictionary with decoded data. """ dom = None try: dom = dhtmlparser.parseString(data) except Exception, e: raise MetaParsingException("...
[ "def", "decode", "(", "data", ")", ":", "dom", "=", "None", "try", ":", "dom", "=", "dhtmlparser", ".", "parseString", "(", "data", ")", "except", "Exception", ",", "e", ":", "raise", "MetaParsingException", "(", "\"Can't parse your XML data: %s\"", "%", "e"...
Handles decoding of the XML `data`. Args: data (str): Data which will be decoded. Returns: dict: Dictionary with decoded data.
[ "Handles", "decoding", "of", "the", "XML", "data", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/parser_xml.py#L41-L87
mugurbil/gnm
gnm/gnm.py
sampler.prior
def prior(self, m, H): """ Set prior Set prior values Inputs : m : mean of the prior H : precision matrix of the prior Hiddens : ln_H_ : log(det(H))/2 calculate this once to use everytime log prior is called Hm : < ...
python
def prior(self, m, H): """ Set prior Set prior values Inputs : m : mean of the prior H : precision matrix of the prior Hiddens : ln_H_ : log(det(H))/2 calculate this once to use everytime log prior is called Hm : < ...
[ "def", "prior", "(", "self", ",", "m", ",", "H", ")", ":", "if", "self", ".", "_prior", "==", "True", ":", "raise", "Warning", "(", "\"prior information is already set\"", ")", "else", ":", "self", ".", "_prior", "=", "True", "# mean", "self", ".", "_m...
Set prior Set prior values Inputs : m : mean of the prior H : precision matrix of the prior Hiddens : ln_H_ : log(det(H))/2 calculate this once to use everytime log prior is called Hm : < H, m > calculate this once ...
[ "Set", "prior", "Set", "prior", "values", "Inputs", ":", "m", ":", "mean", "of", "the", "prior", "H", ":", "precision", "matrix", "of", "the", "prior", "Hiddens", ":", "ln_H_", ":", "log", "(", "det", "(", "H", "))", "/", "2", "calculate", "this", ...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L93-L129
mugurbil/gnm
gnm/gnm.py
sampler.static
def static(self, max_steps, step_size): """ Set Back-off to Static Set the sampler parameters for static back off Inputs : max_steps : maximum optimization steps to be taken step_size : the step size of the back-off """ self._dynamic = Fal...
python
def static(self, max_steps, step_size): """ Set Back-off to Static Set the sampler parameters for static back off Inputs : max_steps : maximum optimization steps to be taken step_size : the step size of the back-off """ self._dynamic = Fal...
[ "def", "static", "(", "self", ",", "max_steps", ",", "step_size", ")", ":", "self", ".", "_dynamic", "=", "False", "# begin checks ", "try", ":", "self", ".", "_max_steps", "=", "int", "(", "max_steps", ")", "except", ":", "print", "(", "\"Error: Inpu...
Set Back-off to Static Set the sampler parameters for static back off Inputs : max_steps : maximum optimization steps to be taken step_size : the step size of the back-off
[ "Set", "Back", "-", "off", "to", "Static", "Set", "the", "sampler", "parameters", "for", "static", "back", "off", "Inputs", ":", "max_steps", ":", "maximum", "optimization", "steps", "to", "be", "taken", "step_size", ":", "the", "step", "size", "of", "the"...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L152-L194
mugurbil/gnm
gnm/gnm.py
sampler.dynamic
def dynamic(self, max_steps, opts={}): """ Dynamic Switch Set the sampler parameters for dynamic back off Inputs : max_steps : maximum back-off steps to be taken Optional Inputs: opts : ({}) dictionary containing fancy options """ self._dy...
python
def dynamic(self, max_steps, opts={}): """ Dynamic Switch Set the sampler parameters for dynamic back off Inputs : max_steps : maximum back-off steps to be taken Optional Inputs: opts : ({}) dictionary containing fancy options """ self._dy...
[ "def", "dynamic", "(", "self", ",", "max_steps", ",", "opts", "=", "{", "}", ")", ":", "self", ".", "_dynamic", "=", "True", "# begin checks ", "try", ":", "self", ".", "_max_steps", "=", "int", "(", "max_steps", ")", "except", ":", "raise", "Type...
Dynamic Switch Set the sampler parameters for dynamic back off Inputs : max_steps : maximum back-off steps to be taken Optional Inputs: opts : ({}) dictionary containing fancy options
[ "Dynamic", "Switch", "Set", "the", "sampler", "parameters", "for", "dynamic", "back", "off", "Inputs", ":", "max_steps", ":", "maximum", "back", "-", "off", "steps", "to", "be", "taken", "Optional", "Inputs", ":", "opts", ":", "(", "{}", ")", "dictionary",...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L197-L222
mugurbil/gnm
gnm/gnm.py
sampler.sample
def sample(self, n_samples, divs=1, visual=False, safe=False): """ Sample Sampling Inputs : n_samples : number of samples to generate Optional Inputs : divs : (1) number of divisions visual : show progress safe : ...
python
def sample(self, n_samples, divs=1, visual=False, safe=False): """ Sample Sampling Inputs : n_samples : number of samples to generate Optional Inputs : divs : (1) number of divisions visual : show progress safe : ...
[ "def", "sample", "(", "self", ",", "n_samples", ",", "divs", "=", "1", ",", "visual", "=", "False", ",", "safe", "=", "False", ")", ":", "if", "visual", ":", "print", "(", "\"Sampling: 0%\"", ")", "for", "i", "in", "xrange", "(", "divs", ")", ":", ...
Sample Sampling Inputs : n_samples : number of samples to generate Optional Inputs : divs : (1) number of divisions visual : show progress safe : save the chain at every division
[ "Sample", "Sampling", "Inputs", ":", "n_samples", ":", "number", "of", "samples", "to", "generate", "Optional", "Inputs", ":", "divs", ":", "(", "1", ")", "number", "of", "divisions", "visual", ":", "show", "progress", "safe", ":", "save", "the", "chain", ...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L225-L252
mugurbil/gnm
gnm/gnm.py
sampler.save
def save(self, path="chain.dat"): """ Save Save data to file Inputs : path : specifies the path name of the file to be loaded to """ # create dictionary for data dic = {} dic['chain'] = self._chain.tolist() dic['step_count'] = self._s...
python
def save(self, path="chain.dat"): """ Save Save data to file Inputs : path : specifies the path name of the file to be loaded to """ # create dictionary for data dic = {} dic['chain'] = self._chain.tolist() dic['step_count'] = self._s...
[ "def", "save", "(", "self", ",", "path", "=", "\"chain.dat\"", ")", ":", "# create dictionary for data", "dic", "=", "{", "}", "dic", "[", "'chain'", "]", "=", "self", ".", "_chain", ".", "tolist", "(", ")", "dic", "[", "'step_count'", "]", "=", "self"...
Save Save data to file Inputs : path : specifies the path name of the file to be loaded to
[ "Save", "Save", "data", "to", "file", "Inputs", ":", "path", ":", "specifies", "the", "path", "name", "of", "the", "file", "to", "be", "loaded", "to" ]
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L254-L275
mugurbil/gnm
gnm/gnm.py
sampler.load
def load(self, path="chain.dat"): """ Load Load data from file Inputs : path : specifies the path name of the file to be loaded from """ # read data from file file = open(path, 'r') dic = json.load(file) file.close() # get da...
python
def load(self, path="chain.dat"): """ Load Load data from file Inputs : path : specifies the path name of the file to be loaded from """ # read data from file file = open(path, 'r') dic = json.load(file) file.close() # get da...
[ "def", "load", "(", "self", ",", "path", "=", "\"chain.dat\"", ")", ":", "# read data from file", "file", "=", "open", "(", "path", ",", "'r'", ")", "dic", "=", "json", ".", "load", "(", "file", ")", "file", ".", "close", "(", ")", "# get data from dic...
Load Load data from file Inputs : path : specifies the path name of the file to be loaded from
[ "Load", "Load", "data", "from", "file", "Inputs", ":", "path", ":", "specifies", "the", "path", "name", "of", "the", "file", "to", "be", "loaded", "from" ]
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L277-L298
mugurbil/gnm
gnm/gnm.py
sampler.acor
def acor(self, k = 5): """ Autocorrelation time of the chain return the autocorrelation time for each parameters Inputs : k : parameter in self-consistent window Outputs : t : autocorrelation time of the chain """ try: impo...
python
def acor(self, k = 5): """ Autocorrelation time of the chain return the autocorrelation time for each parameters Inputs : k : parameter in self-consistent window Outputs : t : autocorrelation time of the chain """ try: impo...
[ "def", "acor", "(", "self", ",", "k", "=", "5", ")", ":", "try", ":", "import", "acor", "except", "ImportError", ":", "print", "(", "\"Can't import acor, please download it.\"", ")", "return", "0", "n", "=", "np", ".", "shape", "(", "self", ".", "_chain"...
Autocorrelation time of the chain return the autocorrelation time for each parameters Inputs : k : parameter in self-consistent window Outputs : t : autocorrelation time of the chain
[ "Autocorrelation", "time", "of", "the", "chain", "return", "the", "autocorrelation", "time", "for", "each", "parameters", "Inputs", ":", "k", ":", "parameter", "in", "self", "-", "consistent", "window", "Outputs", ":", "t", ":", "autocorrelation", "time", "of"...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L316-L336
mugurbil/gnm
gnm/gnm.py
sampler.posterior
def posterior(self, x): """ Posterior density ** not normalized ** This is used to plot the theoretical curve for tests. Inputs : x : input value Outputs : p : p(x)=pi(x)*exp{-||f(x)||^2/(2)} posterior probability of x """ ...
python
def posterior(self, x): """ Posterior density ** not normalized ** This is used to plot the theoretical curve for tests. Inputs : x : input value Outputs : p : p(x)=pi(x)*exp{-||f(x)||^2/(2)} posterior probability of x """ ...
[ "def", "posterior", "(", "self", ",", "x", ")", ":", "x", "=", "np", ".", "reshape", "(", "np", ".", "array", "(", "x", ")", ",", "(", "-", "1", ",", "1", ")", ")", "chi_x", ",", "f_x", ",", "J_x", "=", "self", ".", "_f", "(", "x", ")", ...
Posterior density ** not normalized ** This is used to plot the theoretical curve for tests. Inputs : x : input value Outputs : p : p(x)=pi(x)*exp{-||f(x)||^2/(2)} posterior probability of x
[ "Posterior", "density", "**", "not", "normalized", "**", "This", "is", "used", "to", "plot", "the", "theoretical", "curve", "for", "tests", ".", "Inputs", ":", "x", ":", "input", "value", "Outputs", ":", "p", ":", "p", "(", "x", ")", "=", "pi", "(", ...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L338-L361
mugurbil/gnm
gnm/gnm.py
sampler.error_bars
def error_bars(self, n_bins, d_min, d_max): """ Error Bars create bars and error bars to plot Inputs : n_bins : number of bins plot_range : (shape) = (number of dimensions, 2) matrix which contain the min and max for each dimension as rows Outputs :...
python
def error_bars(self, n_bins, d_min, d_max): """ Error Bars create bars and error bars to plot Inputs : n_bins : number of bins plot_range : (shape) = (number of dimensions, 2) matrix which contain the min and max for each dimension as rows Outputs :...
[ "def", "error_bars", "(", "self", ",", "n_bins", ",", "d_min", ",", "d_max", ")", ":", "# fetch data", "chain", "=", "self", ".", "_chain", "len_chain", "=", "len", "(", "chain", ")", "try", ":", "n_dims", "=", "np", ".", "shape", "(", "chain", ")", ...
Error Bars create bars and error bars to plot Inputs : n_bins : number of bins plot_range : (shape) = (number of dimensions, 2) matrix which contain the min and max for each dimension as rows Outputs : x : domain p_x : ...
[ "Error", "Bars", "create", "bars", "and", "error", "bars", "to", "plot", "Inputs", ":", "n_bins", ":", "number", "of", "bins", "plot_range", ":", "(", "shape", ")", "=", "(", "number", "of", "dimensions", "2", ")", "matrix", "which", "contain", "the", ...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L363-L428
mugurbil/gnm
gnm/gnm.py
sampler._sample
def _sample(self, n_samples): """ Sample Generate samples for posterior distribution using Gauss-Newton proposal parameters Inputs : n_samples : number of samples to generate Hidden Outputs : chain : chain of samples n_samples : ...
python
def _sample(self, n_samples): """ Sample Generate samples for posterior distribution using Gauss-Newton proposal parameters Inputs : n_samples : number of samples to generate Hidden Outputs : chain : chain of samples n_samples : ...
[ "def", "_sample", "(", "self", ",", "n_samples", ")", ":", "try", ":", "n_samples", "=", "int", "(", "n_samples", ")", "except", ":", "raise", "TypeError", "(", "\"number of samples has to be an integer\"", ")", "exit", "(", ")", "# fetch info", "X", "=", "s...
Sample Generate samples for posterior distribution using Gauss-Newton proposal parameters Inputs : n_samples : number of samples to generate Hidden Outputs : chain : chain of samples n_samples : length of chain n_accepted : ...
[ "Sample", "Generate", "samples", "for", "posterior", "distribution", "using", "Gauss", "-", "Newton", "proposal", "parameters", "Inputs", ":", "n_samples", ":", "number", "of", "samples", "to", "generate", "Hidden", "Outputs", ":", "chain", ":", "chain", "of", ...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L432-L530
mugurbil/gnm
gnm/gnm.py
sampler._proposal_params
def _proposal_params(self, state): """ Proposal parameters Calculate parameters needed for the proposal. Inputs : state : x : the present sample, the place to linearize around f : f(x), function value at x J : ...
python
def _proposal_params(self, state): """ Proposal parameters Calculate parameters needed for the proposal. Inputs : state : x : the present sample, the place to linearize around f : f(x), function value at x J : ...
[ "def", "_proposal_params", "(", "self", ",", "state", ")", ":", "x", "=", "state", "[", "'x'", "]", "f", "=", "state", "[", "'f'", "]", "J", "=", "state", "[", "'J'", "]", "JJ", "=", "np", ".", "dot", "(", "J", ".", "T", ",", "J", ")", "if"...
Proposal parameters Calculate parameters needed for the proposal. Inputs : state : x : the present sample, the place to linearize around f : f(x), function value at x J : f'(x), the jacobian of the functio...
[ "Proposal", "parameters", "Calculate", "parameters", "needed", "for", "the", "proposal", ".", "Inputs", ":", "state", ":", "x", ":", "the", "present", "sample", "the", "place", "to", "linearize", "around", "f", ":", "f", "(", "x", ")", "function", "value",...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L533-L576
mugurbil/gnm
gnm/gnm.py
sampler._log_P
def _log_P(self, X , Z, k): """ Log of the probability of transition from z to x with k steps log ( P_k (x, z) ) Inputs : X : state to be proposed to Z : state to be proposed from k : number of recursions, depth """ r...
python
def _log_P(self, X , Z, k): """ Log of the probability of transition from z to x with k steps log ( P_k (x, z) ) Inputs : X : state to be proposed to Z : state to be proposed from k : number of recursions, depth """ r...
[ "def", "_log_P", "(", "self", ",", "X", ",", "Z", ",", "k", ")", ":", "r_", "=", "self", ".", "_r_", "Z_", "=", "self", ".", "_Z_", "# zero case", "if", "k", "==", "0", ":", "log_P", "=", "Z", "[", "'log_p'", "]", "+", "log_K", "(", "X", ",...
Log of the probability of transition from z to x with k steps log ( P_k (x, z) ) Inputs : X : state to be proposed to Z : state to be proposed from k : number of recursions, depth
[ "Log", "of", "the", "probability", "of", "transition", "from", "z", "to", "x", "with", "k", "steps", "log", "(", "P_k", "(", "x", "z", ")", ")", "Inputs", ":", "X", ":", "state", "to", "be", "proposed", "to", "Z", ":", "state", "to", "be", "propo...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L578-L605
mugurbil/gnm
gnm/gnm.py
sampler._back_off
def _back_off(self): """ Back off Calculate the back off step size Inputs : Z_ : list of states in current proposal r_ : list of back offs in current proposal q : step size reduction dynamic : set to True if you ...
python
def _back_off(self): """ Back off Calculate the back off step size Inputs : Z_ : list of states in current proposal r_ : list of back offs in current proposal q : step size reduction dynamic : set to True if you ...
[ "def", "_back_off", "(", "self", ")", ":", "q", "=", "self", ".", "_step_size", "r", "=", "self", ".", "_r_", "[", "-", "1", "]", "Z_", "=", "self", ".", "_Z_", "if", "self", ".", "_dynamic", ":", "p_0", "=", "la", ".", "norm", "(", "Z_", "["...
Back off Calculate the back off step size Inputs : Z_ : list of states in current proposal r_ : list of back offs in current proposal q : step size reduction dynamic : set to True if you want to use the dynamic back-off ...
[ "Back", "off", "Calculate", "the", "back", "off", "step", "size", "Inputs", ":", "Z_", ":", "list", "of", "states", "in", "current", "proposal", "r_", ":", "list", "of", "back", "offs", "in", "current", "proposal", "q", ":", "step", "size", "reduction", ...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L607-L633
mugurbil/gnm
gnm/gnm.py
sampler._log_post
def _log_post(self,x,f_x): """ Log of the posterior density This is used to calculete acceptance probability for sampling. Inputs : x : input value f_x : f(x), function value at x Outputs : log(p_x) : log[pi(x)]-||f(x)||^2/(2) ...
python
def _log_post(self,x,f_x): """ Log of the posterior density This is used to calculete acceptance probability for sampling. Inputs : x : input value f_x : f(x), function value at x Outputs : log(p_x) : log[pi(x)]-||f(x)||^2/(2) ...
[ "def", "_log_post", "(", "self", ",", "x", ",", "f_x", ")", ":", "# least squares part -||f(x)||^2/2", "log_likelihood", "=", "(", "-", "la", ".", "norm", "(", "f_x", ")", "**", "2", ")", "/", "(", "2.", ")", "# prior part -(x-m)'H(x-m)/2", "if",...
Log of the posterior density This is used to calculete acceptance probability for sampling. Inputs : x : input value f_x : f(x), function value at x Outputs : log(p_x) : log[pi(x)]-||f(x)||^2/(2) log of the posterior probability
[ "Log", "of", "the", "posterior", "density", "This", "is", "used", "to", "calculete", "acceptance", "probability", "for", "sampling", ".", "Inputs", ":", "x", ":", "input", "value", "f_x", ":", "f", "(", "x", ")", "function", "value", "at", "x", "Outputs"...
train
https://github.com/mugurbil/gnm/blob/4f9711fb9d78cc02820c25234bc3ab9615014f11/gnm/gnm.py#L635-L658
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.activate
def activate(self, ideSettings, ideGlobalData): """Activates the plugin. The plugin may override the method to do specific plugin activation handling. ideSettings - reference to the IDE Settings singleton see codimension/src/utils/settings.py ideGlobalData...
python
def activate(self, ideSettings, ideGlobalData): """Activates the plugin. The plugin may override the method to do specific plugin activation handling. ideSettings - reference to the IDE Settings singleton see codimension/src/utils/settings.py ideGlobalData...
[ "def", "activate", "(", "self", ",", "ideSettings", ",", "ideGlobalData", ")", ":", "WizardInterface", ".", "activate", "(", "self", ",", "ideSettings", ",", "ideGlobalData", ")", "self", ".", "__where", "=", "self", ".", "__getConfiguredWhere", "(", ")", "s...
Activates the plugin. The plugin may override the method to do specific plugin activation handling. ideSettings - reference to the IDE Settings singleton see codimension/src/utils/settings.py ideGlobalData - reference to the IDE global settings ...
[ "Activates", "the", "plugin", "." ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L51-L70
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.deactivate
def deactivate(self): """Deactivates the plugin. The plugin may override the method to do specific plugin deactivation handling. Note: if overriden do not forget to call the base class deactivate() """ self.ide.project.sigProjectChanged.disconnect(self.__co...
python
def deactivate(self): """Deactivates the plugin. The plugin may override the method to do specific plugin deactivation handling. Note: if overriden do not forget to call the base class deactivate() """ self.ide.project.sigProjectChanged.disconnect(self.__co...
[ "def", "deactivate", "(", "self", ")", ":", "self", ".", "ide", ".", "project", ".", "sigProjectChanged", ".", "disconnect", "(", "self", ".", "__collectGarbage", ")", "self", ".", "ide", ".", "editorsManager", ".", "sigTabClosed", ".", "disconnect", "(", ...
Deactivates the plugin. The plugin may override the method to do specific plugin deactivation handling. Note: if overriden do not forget to call the base class deactivate()
[ "Deactivates", "the", "plugin", "." ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L72-L83
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.populateMainMenu
def populateMainMenu(self, parentMenu): """Populates the main menu. The main menu looks as follows: Plugins - Plugin manager (fixed item) - Separator (fixed item) - <Plugin #1 name> (this is the parentMenu passed) ... If no items were popu...
python
def populateMainMenu(self, parentMenu): """Populates the main menu. The main menu looks as follows: Plugins - Plugin manager (fixed item) - Separator (fixed item) - <Plugin #1 name> (this is the parentMenu passed) ... If no items were popu...
[ "def", "populateMainMenu", "(", "self", ",", "parentMenu", ")", ":", "parentMenu", ".", "addAction", "(", "\"Configure\"", ",", "self", ".", "configure", ")", "parentMenu", ".", "addAction", "(", "\"Collect garbage\"", ",", "self", ".", "__collectGarbage", ")" ]
Populates the main menu. The main menu looks as follows: Plugins - Plugin manager (fixed item) - Separator (fixed item) - <Plugin #1 name> (this is the parentMenu passed) ... If no items were populated by the plugin then there will be no <...
[ "Populates", "the", "main", "menu", "." ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L96-L110
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.populateBufferContextMenu
def populateBufferContextMenu(self, parentMenu): """Populates the editing buffer context menu. The buffer context menu shown for the current edited/viewed file will have an item with a plugin name and subitems which are populated here. If no items were populated then the plugin menu ...
python
def populateBufferContextMenu(self, parentMenu): """Populates the editing buffer context menu. The buffer context menu shown for the current edited/viewed file will have an item with a plugin name and subitems which are populated here. If no items were populated then the plugin menu ...
[ "def", "populateBufferContextMenu", "(", "self", ",", "parentMenu", ")", ":", "parentMenu", ".", "addAction", "(", "\"Configure\"", ",", "self", ".", "configure", ")", "parentMenu", ".", "addAction", "(", "\"Collect garbage\"", ",", "self", ".", "__collectGarbage"...
Populates the editing buffer context menu. The buffer context menu shown for the current edited/viewed file will have an item with a plugin name and subitems which are populated here. If no items were populated then the plugin menu item will not be shown. Note: when a buffer co...
[ "Populates", "the", "editing", "buffer", "context", "menu", "." ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L140-L161
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.configure
def configure(self): """Configures the garbage collector plugin""" dlg = GCPluginConfigDialog(self.__where) if dlg.exec_() == QDialog.Accepted: newWhere = dlg.getCheckedOption() if newWhere != self.__where: self.__where = newWhere self.__sa...
python
def configure(self): """Configures the garbage collector plugin""" dlg = GCPluginConfigDialog(self.__where) if dlg.exec_() == QDialog.Accepted: newWhere = dlg.getCheckedOption() if newWhere != self.__where: self.__where = newWhere self.__sa...
[ "def", "configure", "(", "self", ")", ":", "dlg", "=", "GCPluginConfigDialog", "(", "self", ".", "__where", ")", "if", "dlg", ".", "exec_", "(", ")", "==", "QDialog", ".", "Accepted", ":", "newWhere", "=", "dlg", ".", "getCheckedOption", "(", ")", "if"...
Configures the garbage collector plugin
[ "Configures", "the", "garbage", "collector", "plugin" ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L163-L170
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.__getConfiguredWhere
def __getConfiguredWhere(self): """Provides the saved configured value""" defaultSettings = {'where': GCPluginConfigDialog.SILENT} configFile = self.__getConfigFile() if not os.path.exists(configFile): values = defaultSettings else: values = loadJSON(confi...
python
def __getConfiguredWhere(self): """Provides the saved configured value""" defaultSettings = {'where': GCPluginConfigDialog.SILENT} configFile = self.__getConfigFile() if not os.path.exists(configFile): values = defaultSettings else: values = loadJSON(confi...
[ "def", "__getConfiguredWhere", "(", "self", ")", ":", "defaultSettings", "=", "{", "'where'", ":", "GCPluginConfigDialog", ".", "SILENT", "}", "configFile", "=", "self", ".", "__getConfigFile", "(", ")", "if", "not", "os", ".", "path", ".", "exists", "(", ...
Provides the saved configured value
[ "Provides", "the", "saved", "configured", "value" ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L176-L193
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/__init__.py
GCPlugin.__collectGarbage
def __collectGarbage(self, ignored=None): """Collects garbage""" del ignored # unused argument collected = [] level0, level1, level2 = gc.get_count() if level0 > 0: collected.append(gc.collect(0)) if level1 > 0: collected.append(gc.co...
python
def __collectGarbage(self, ignored=None): """Collects garbage""" del ignored # unused argument collected = [] level0, level1, level2 = gc.get_count() if level0 > 0: collected.append(gc.collect(0)) if level1 > 0: collected.append(gc.co...
[ "def", "__collectGarbage", "(", "self", ",", "ignored", "=", "None", ")", ":", "del", "ignored", "# unused argument", "collected", "=", "[", "]", "level0", ",", "level1", ",", "level2", "=", "gc", ".", "get_count", "(", ")", "if", "level0", ">", "0", "...
Collects garbage
[ "Collects", "garbage" ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L200-L237
radjkarl/fancyTools
fancytools/fit/polyFitIgnoringOutliers.py
polyFitIgnoringOutliers
def polyFitIgnoringOutliers( x, y, deg=2, niter=3, nstd=2, return_outliers=False): """Returns: (np.poly1d): callable function of polynomial fit excluding all outliers Args: deg (int): degree of polynomial fit n_iter (int): do linear regression n times succes...
python
def polyFitIgnoringOutliers( x, y, deg=2, niter=3, nstd=2, return_outliers=False): """Returns: (np.poly1d): callable function of polynomial fit excluding all outliers Args: deg (int): degree of polynomial fit n_iter (int): do linear regression n times succes...
[ "def", "polyFitIgnoringOutliers", "(", "x", ",", "y", ",", "deg", "=", "2", ",", "niter", "=", "3", ",", "nstd", "=", "2", ",", "return_outliers", "=", "False", ")", ":", "if", "return_outliers", ":", "a", "=", "all_outliers", "=", "np", ".", "zeros_...
Returns: (np.poly1d): callable function of polynomial fit excluding all outliers Args: deg (int): degree of polynomial fit n_iter (int): do linear regression n times successive removing nstd (float): exclude outliers, if their deviation is > [nstd] *...
[ "Returns", ":", "(", "np", ".", "poly1d", ")", ":", "callable", "function", "of", "polynomial", "fit", "excluding", "all", "outliers", "Args", ":", "deg", "(", "int", ")", ":", "degree", "of", "polynomial", "fit", "n_iter", "(", "int", ")", ":", "do", ...
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/fit/polyFitIgnoringOutliers.py#L5-L40
ronaldguillen/wave
wave/renderers.py
JSONRenderer.render
def render(self, data, accepted_media_type=None, renderer_context=None): """ Render `data` into JSON, returning a bytestring. """ if data is None: return bytes() renderer_context = renderer_context or {} indent = self.get_indent(accepted_media_type, renderer_...
python
def render(self, data, accepted_media_type=None, renderer_context=None): """ Render `data` into JSON, returning a bytestring. """ if data is None: return bytes() renderer_context = renderer_context or {} indent = self.get_indent(accepted_media_type, renderer_...
[ "def", "render", "(", "self", ",", "data", ",", "accepted_media_type", "=", "None", ",", "renderer_context", "=", "None", ")", ":", "if", "data", "is", "None", ":", "return", "bytes", "(", ")", "renderer_context", "=", "renderer_context", "or", "{", "}", ...
Render `data` into JSON, returning a bytestring.
[ "Render", "data", "into", "JSON", "returning", "a", "bytestring", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L86-L118
ronaldguillen/wave
wave/renderers.py
TemplateHTMLRenderer.render
def render(self, data, accepted_media_type=None, renderer_context=None): """ Renders data to HTML, using Django's standard template rendering. The template name is determined by (in order of preference): 1. An explicit .template_name set on the response. 2. An explicit .templat...
python
def render(self, data, accepted_media_type=None, renderer_context=None): """ Renders data to HTML, using Django's standard template rendering. The template name is determined by (in order of preference): 1. An explicit .template_name set on the response. 2. An explicit .templat...
[ "def", "render", "(", "self", ",", "data", ",", "accepted_media_type", "=", "None", ",", "renderer_context", "=", "None", ")", ":", "renderer_context", "=", "renderer_context", "or", "{", "}", "view", "=", "renderer_context", "[", "'view'", "]", "request", "...
Renders data to HTML, using Django's standard template rendering. The template name is determined by (in order of preference): 1. An explicit .template_name set on the response. 2. An explicit .template_name set on this class. 3. The return result of calling view.get_template_names().
[ "Renders", "data", "to", "HTML", "using", "Django", "s", "standard", "template", "rendering", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L150-L172
ronaldguillen/wave
wave/renderers.py
HTMLFormRenderer.render
def render(self, data, accepted_media_type=None, renderer_context=None): """ Render serializer data and return an HTML form, as a string. """ form = data.serializer style = renderer_context.get('style', {}) if 'template_pack' not in style: style['template_pac...
python
def render(self, data, accepted_media_type=None, renderer_context=None): """ Render serializer data and return an HTML form, as a string. """ form = data.serializer style = renderer_context.get('style', {}) if 'template_pack' not in style: style['template_pac...
[ "def", "render", "(", "self", ",", "data", ",", "accepted_media_type", "=", "None", ",", "renderer_context", "=", "None", ")", ":", "form", "=", "data", ".", "serializer", "style", "=", "renderer_context", ".", "get", "(", "'style'", ",", "{", "}", ")", ...
Render serializer data and return an HTML form, as a string.
[ "Render", "serializer", "data", "and", "return", "an", "HTML", "form", "as", "a", "string", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L340-L358
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.get_default_renderer
def get_default_renderer(self, view): """ Return an instance of the first valid renderer. (Don't use another documenting renderer.) """ renderers = [renderer for renderer in view.renderer_classes if not issubclass(renderer, BrowsableAPIRenderer)] non_...
python
def get_default_renderer(self, view): """ Return an instance of the first valid renderer. (Don't use another documenting renderer.) """ renderers = [renderer for renderer in view.renderer_classes if not issubclass(renderer, BrowsableAPIRenderer)] non_...
[ "def", "get_default_renderer", "(", "self", ",", "view", ")", ":", "renderers", "=", "[", "renderer", "for", "renderer", "in", "view", ".", "renderer_classes", "if", "not", "issubclass", "(", "renderer", ",", "BrowsableAPIRenderer", ")", "]", "non_template_rende...
Return an instance of the first valid renderer. (Don't use another documenting renderer.)
[ "Return", "an", "instance", "of", "the", "first", "valid", "renderer", ".", "(", "Don", "t", "use", "another", "documenting", "renderer", ".", ")" ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L372-L386
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.get_content
def get_content(self, renderer, data, accepted_media_type, renderer_context): """ Get the content as if it had been rendered by the default non-documenting renderer. """ if not renderer: return '[No renderers were found]' renderer_context[...
python
def get_content(self, renderer, data, accepted_media_type, renderer_context): """ Get the content as if it had been rendered by the default non-documenting renderer. """ if not renderer: return '[No renderers were found]' renderer_context[...
[ "def", "get_content", "(", "self", ",", "renderer", ",", "data", ",", "accepted_media_type", ",", "renderer_context", ")", ":", "if", "not", "renderer", ":", "return", "'[No renderers were found]'", "renderer_context", "[", "'indent'", "]", "=", "4", "content", ...
Get the content as if it had been rendered by the default non-documenting renderer.
[ "Get", "the", "content", "as", "if", "it", "had", "been", "rendered", "by", "the", "default", "non", "-", "documenting", "renderer", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L388-L406
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.show_form_for_method
def show_form_for_method(self, view, method, request, obj): """ Returns True if a form should be shown for this method. """ if method not in view.allowed_methods: return # Not a valid method try: view.check_permissions(request) if obj is not ...
python
def show_form_for_method(self, view, method, request, obj): """ Returns True if a form should be shown for this method. """ if method not in view.allowed_methods: return # Not a valid method try: view.check_permissions(request) if obj is not ...
[ "def", "show_form_for_method", "(", "self", ",", "view", ",", "method", ",", "request", ",", "obj", ")", ":", "if", "method", "not", "in", "view", ".", "allowed_methods", ":", "return", "# Not a valid method", "try", ":", "view", ".", "check_permissions", "(...
Returns True if a form should be shown for this method.
[ "Returns", "True", "if", "a", "form", "should", "be", "shown", "for", "this", "method", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L408-L421
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.get_rendered_html_form
def get_rendered_html_form(self, data, view, method, request): """ Return a string representing a rendered HTML form, possibly bound to either the input or output data. In the absence of the View having an associated form then return None. """ # See issue #2089 for refac...
python
def get_rendered_html_form(self, data, view, method, request): """ Return a string representing a rendered HTML form, possibly bound to either the input or output data. In the absence of the View having an associated form then return None. """ # See issue #2089 for refac...
[ "def", "get_rendered_html_form", "(", "self", ",", "data", ",", "view", ",", "method", ",", "request", ")", ":", "# See issue #2089 for refactoring this.", "serializer", "=", "getattr", "(", "data", ",", "'serializer'", ",", "None", ")", "if", "serializer", "and...
Return a string representing a rendered HTML form, possibly bound to either the input or output data. In the absence of the View having an associated form then return None.
[ "Return", "a", "string", "representing", "a", "rendered", "HTML", "form", "possibly", "bound", "to", "either", "the", "input", "or", "output", "data", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L431-L501
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.get_raw_data_form
def get_raw_data_form(self, data, view, method, request): """ Returns a form that allows for arbitrary content types to be tunneled via standard HTML forms. (Which are typically application/x-www-form-urlencoded) """ # See issue #2089 for refactoring this. seriali...
python
def get_raw_data_form(self, data, view, method, request): """ Returns a form that allows for arbitrary content types to be tunneled via standard HTML forms. (Which are typically application/x-www-form-urlencoded) """ # See issue #2089 for refactoring this. seriali...
[ "def", "get_raw_data_form", "(", "self", ",", "data", ",", "view", ",", "method", ",", "request", ")", ":", "# See issue #2089 for refactoring this.", "serializer", "=", "getattr", "(", "data", ",", "'serializer'", ",", "None", ")", "if", "serializer", "and", ...
Returns a form that allows for arbitrary content types to be tunneled via standard HTML forms. (Which are typically application/x-www-form-urlencoded)
[ "Returns", "a", "form", "that", "allows", "for", "arbitrary", "content", "types", "to", "be", "tunneled", "via", "standard", "HTML", "forms", ".", "(", "Which", "are", "typically", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", ")" ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L503-L563
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.get_context
def get_context(self, data, accepted_media_type, renderer_context): """ Returns the context used to render. """ view = renderer_context['view'] request = renderer_context['request'] response = renderer_context['response'] renderer = self.get_default_renderer(view...
python
def get_context(self, data, accepted_media_type, renderer_context): """ Returns the context used to render. """ view = renderer_context['view'] request = renderer_context['request'] response = renderer_context['response'] renderer = self.get_default_renderer(view...
[ "def", "get_context", "(", "self", ",", "data", ",", "accepted_media_type", ",", "renderer_context", ")", ":", "view", "=", "renderer_context", "[", "'view'", "]", "request", "=", "renderer_context", "[", "'request'", "]", "response", "=", "renderer_context", "[...
Returns the context used to render.
[ "Returns", "the", "context", "used", "to", "render", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L607-L665
ronaldguillen/wave
wave/renderers.py
BrowsableAPIRenderer.render
def render(self, data, accepted_media_type=None, renderer_context=None): """ Render the HTML for the browsable API representation. """ self.accepted_media_type = accepted_media_type or '' self.renderer_context = renderer_context or {} template = loader.get_template(self....
python
def render(self, data, accepted_media_type=None, renderer_context=None): """ Render the HTML for the browsable API representation. """ self.accepted_media_type = accepted_media_type or '' self.renderer_context = renderer_context or {} template = loader.get_template(self....
[ "def", "render", "(", "self", ",", "data", ",", "accepted_media_type", "=", "None", ",", "renderer_context", "=", "None", ")", ":", "self", ".", "accepted_media_type", "=", "accepted_media_type", "or", "''", "self", ".", "renderer_context", "=", "renderer_contex...
Render the HTML for the browsable API representation.
[ "Render", "the", "HTML", "for", "the", "browsable", "API", "representation", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L667-L685
ronaldguillen/wave
wave/renderers.py
AdminRenderer.get_context
def get_context(self, data, accepted_media_type, renderer_context): """ Render the HTML for the browsable API representation. """ context = super(AdminRenderer, self).get_context( data, accepted_media_type, renderer_context ) paginator = getattr(context['view...
python
def get_context(self, data, accepted_media_type, renderer_context): """ Render the HTML for the browsable API representation. """ context = super(AdminRenderer, self).get_context( data, accepted_media_type, renderer_context ) paginator = getattr(context['view...
[ "def", "get_context", "(", "self", ",", "data", ",", "accepted_media_type", ",", "renderer_context", ")", ":", "context", "=", "super", "(", "AdminRenderer", ",", "self", ")", ".", "get_context", "(", "data", ",", "accepted_media_type", ",", "renderer_context", ...
Render the HTML for the browsable API representation.
[ "Render", "the", "HTML", "for", "the", "browsable", "API", "representation", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L732-L768
vfxetc/sgactions
sgactions/tickets.py
exception_uuid
def exception_uuid(exc_type, exc_value, exc_traceback): """Calculate a 32-bit UUID for a given exception. Useful for looking for an existing ticket coresponding to a given exception. Takes into account the type of exception, and the name of every file and function in the traceback, along with the s...
python
def exception_uuid(exc_type, exc_value, exc_traceback): """Calculate a 32-bit UUID for a given exception. Useful for looking for an existing ticket coresponding to a given exception. Takes into account the type of exception, and the name of every file and function in the traceback, along with the s...
[ "def", "exception_uuid", "(", "exc_type", ",", "exc_value", ",", "exc_traceback", ")", ":", "hasher", "=", "hashlib", ".", "sha256", "(", "str", "(", "exc_type", ")", ")", "for", "file_name", ",", "line_no", ",", "func_name", ",", "source", "in", "tracebac...
Calculate a 32-bit UUID for a given exception. Useful for looking for an existing ticket coresponding to a given exception. Takes into account the type of exception, and the name of every file and function in the traceback, along with the source code from those lines. This should remain consis...
[ "Calculate", "a", "32", "-", "bit", "UUID", "for", "a", "given", "exception", ".", "Useful", "for", "looking", "for", "an", "existing", "ticket", "coresponding", "to", "a", "given", "exception", ".", "Takes", "into", "account", "the", "type", "of", "except...
train
https://github.com/vfxetc/sgactions/blob/e2c6ee14a1f8092e97f57a501650581428a6ac6e/sgactions/tickets.py#L23-L40
vfxetc/sgactions
sgactions/tickets.py
get_ticket_for_exception
def get_ticket_for_exception(exc_type=None, exc_value=None, exc_traceback=None, title=None): """Get (or create) a ticket for the given exception. Uses :func:`exception_uuid` to identify existing tickets by looking for the tag in square brackets in the title. E.g. ``Something happened. [deadbeef]``. ...
python
def get_ticket_for_exception(exc_type=None, exc_value=None, exc_traceback=None, title=None): """Get (or create) a ticket for the given exception. Uses :func:`exception_uuid` to identify existing tickets by looking for the tag in square brackets in the title. E.g. ``Something happened. [deadbeef]``. ...
[ "def", "get_ticket_for_exception", "(", "exc_type", "=", "None", ",", "exc_value", "=", "None", ",", "exc_traceback", "=", "None", ",", "title", "=", "None", ")", ":", "if", "exc_type", "and", "exc_value", "and", "exc_traceback", ":", "mini_uuid", "=", "exce...
Get (or create) a ticket for the given exception. Uses :func:`exception_uuid` to identify existing tickets by looking for the tag in square brackets in the title. E.g. ``Something happened. [deadbeef]``. :param str title: Title to use if creating a new ticket. Defaults to the exception typ...
[ "Get", "(", "or", "create", ")", "a", "ticket", "for", "the", "given", "exception", ".", "Uses", ":", "func", ":", "exception_uuid", "to", "identify", "existing", "tickets", "by", "looking", "for", "the", "tag", "in", "square", "brackets", "in", "the", "...
train
https://github.com/vfxetc/sgactions/blob/e2c6ee14a1f8092e97f57a501650581428a6ac6e/sgactions/tickets.py#L43-L101
vfxetc/sgactions
sgactions/tickets.py
reply_to_ticket
def reply_to_ticket(ticket_id, content, user_id=None): """Create a structured reply to a ticket. :param int ticket_id: The ticket to reply to. :param content: ``str``, ``dict``, or iterator of ``(title, content``) pairs. :returns: ``(reply_id, reply_content)``. """ user_comment = ...
python
def reply_to_ticket(ticket_id, content, user_id=None): """Create a structured reply to a ticket. :param int ticket_id: The ticket to reply to. :param content: ``str``, ``dict``, or iterator of ``(title, content``) pairs. :returns: ``(reply_id, reply_content)``. """ user_comment = ...
[ "def", "reply_to_ticket", "(", "ticket_id", ",", "content", ",", "user_id", "=", "None", ")", ":", "user_comment", "=", "None", "exc_type", "=", "None", "if", "isinstance", "(", "content", ",", "dict", ")", ":", "content", "=", "sorted", "(", "content", ...
Create a structured reply to a ticket. :param int ticket_id: The ticket to reply to. :param content: ``str``, ``dict``, or iterator of ``(title, content``) pairs. :returns: ``(reply_id, reply_content)``.
[ "Create", "a", "structured", "reply", "to", "a", "ticket", ".", ":", "param", "int", "ticket_id", ":", "The", "ticket", "to", "reply", "to", ".", ":", "param", "content", ":", "str", "dict", "or", "iterator", "of", "(", "title", "content", ")", "pairs"...
train
https://github.com/vfxetc/sgactions/blob/e2c6ee14a1f8092e97f57a501650581428a6ac6e/sgactions/tickets.py#L104-L192
radjkarl/fancyTools
fancytools/os/setup.py
setup
def setup(package, **kwargs): """a template for the python setup.py installer routine * take setup information from the packages __init__.py file * this way these informations, like... - __email__ - __version__ - __depencies__ ...
python
def setup(package, **kwargs): """a template for the python setup.py installer routine * take setup information from the packages __init__.py file * this way these informations, like... - __email__ - __version__ - __depencies__ ...
[ "def", "setup", "(", "package", ",", "*", "*", "kwargs", ")", ":", "def", "read", "(", "*", "paths", ")", ":", "\"\"\"Build a file path from *paths* and return the contents.\"\"\"", "p", "=", "os", ".", "path", ".", "join", "(", "*", "paths", ")", "if", "o...
a template for the python setup.py installer routine * take setup information from the packages __init__.py file * this way these informations, like... - __email__ - __version__ - __depencies__ are still available after instal...
[ "a", "template", "for", "the", "python", "setup", ".", "py", "installer", "routine" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/setup.py#L9-L62
ronaldguillen/wave
wave/utils/breadcrumbs.py
get_breadcrumbs
def get_breadcrumbs(url, request=None): """ Given a url returns a list of breadcrumbs, which are each a tuple of (name, url). """ from wave.reverse import preserve_builtin_query_params from wave.settings import api_settings from wave.views import APIView view_name_func = api_settings.VI...
python
def get_breadcrumbs(url, request=None): """ Given a url returns a list of breadcrumbs, which are each a tuple of (name, url). """ from wave.reverse import preserve_builtin_query_params from wave.settings import api_settings from wave.views import APIView view_name_func = api_settings.VI...
[ "def", "get_breadcrumbs", "(", "url", ",", "request", "=", "None", ")", ":", "from", "wave", ".", "reverse", "import", "preserve_builtin_query_params", "from", "wave", ".", "settings", "import", "api_settings", "from", "wave", ".", "views", "import", "APIView", ...
Given a url returns a list of breadcrumbs, which are each a tuple of (name, url).
[ "Given", "a", "url", "returns", "a", "list", "of", "breadcrumbs", "which", "are", "each", "a", "tuple", "of", "(", "name", "url", ")", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/utils/breadcrumbs.py#L6-L58
pip-services3-python/pip-services3-components-python
pip_services3_components/config/YamlConfigReader.py
YamlConfigReader._read_object
def _read_object(self, correlation_id, parameters): """ Reads configuration file, parameterizes its content and converts it into JSON object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuratio...
python
def _read_object(self, correlation_id, parameters): """ Reads configuration file, parameterizes its content and converts it into JSON object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuratio...
[ "def", "_read_object", "(", "self", ",", "correlation_id", ",", "parameters", ")", ":", "path", "=", "self", ".", "get_path", "(", ")", "if", "path", "==", "None", ":", "raise", "ConfigException", "(", "correlation_id", ",", "\"NO_PATH\"", ",", "\"Missing co...
Reads configuration file, parameterizes its content and converts it into JSON object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuration. :return: a JSON object with configuration.
[ "Reads", "configuration", "file", "parameterizes", "its", "content", "and", "converts", "it", "into", "JSON", "object", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L48-L76
pip-services3-python/pip-services3-components-python
pip_services3_components/config/YamlConfigReader.py
YamlConfigReader.read_config
def read_config(self, correlation_id, parameters): """ Reads configuration and parameterize it with given values. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuration or null to skip parameteri...
python
def read_config(self, correlation_id, parameters): """ Reads configuration and parameterize it with given values. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuration or null to skip parameteri...
[ "def", "read_config", "(", "self", ",", "correlation_id", ",", "parameters", ")", ":", "value", "=", "self", ".", "_read_object", "(", "correlation_id", ",", "parameters", ")", "return", "ConfigParams", ".", "from_value", "(", "value", ")" ]
Reads configuration and parameterize it with given values. :param correlation_id: (optional) transaction id to trace execution through call chain. :param parameters: values to parameters the configuration or null to skip parameterization. :return: ConfigParams configuration.
[ "Reads", "configuration", "and", "parameterize", "it", "with", "given", "values", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L78-L89
pip-services3-python/pip-services3-components-python
pip_services3_components/config/YamlConfigReader.py
YamlConfigReader._read_config
def _read_config(correlation_id, path, parameters): """ Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param path: a path to configuration...
python
def _read_config(correlation_id, path, parameters): """ Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param path: a path to configuration...
[ "def", "_read_config", "(", "correlation_id", ",", "path", ",", "parameters", ")", ":", "value", "=", "YamlConfigReader", "(", "path", ")", ".", "_read_object", "(", "correlation_id", ",", "parameters", ")", "return", "ConfigParams", ".", "from_value", "(", "v...
Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object. :param correlation_id: (optional) transaction id to trace execution through call chain. :param path: a path to configuration file. :param parameters: values to parameters the configuratio...
[ "Reads", "configuration", "from", "a", "file", "parameterize", "it", "with", "given", "values", "and", "returns", "a", "new", "ConfigParams", "object", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L107-L120
itsnauman/jumprun
jumprun.py
JumpRun.run
def run(self): """ Perform the specified action """ if self.args['add']: self.action_add() elif self.args['rm']: self.action_rm() elif self.args['show']: self.action_show() elif self.args['rename']: self.action_r...
python
def run(self): """ Perform the specified action """ if self.args['add']: self.action_add() elif self.args['rm']: self.action_rm() elif self.args['show']: self.action_show() elif self.args['rename']: self.action_r...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "args", "[", "'add'", "]", ":", "self", ".", "action_add", "(", ")", "elif", "self", ".", "args", "[", "'rm'", "]", ":", "self", ".", "action_rm", "(", ")", "elif", "self", ".", "args", "[...
Perform the specified action
[ "Perform", "the", "specified", "action" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L95-L113
itsnauman/jumprun
jumprun.py
JumpRun.init_db
def init_db(self): """ Init database and prepare tables """ # database file db_path = self.get_data_file("data.sqlite") # comect and create cursor self.db = sqlite3.connect(db_path) self.cursor = self.db.cursor() # prep tables self.db_ex...
python
def init_db(self): """ Init database and prepare tables """ # database file db_path = self.get_data_file("data.sqlite") # comect and create cursor self.db = sqlite3.connect(db_path) self.cursor = self.db.cursor() # prep tables self.db_ex...
[ "def", "init_db", "(", "self", ")", ":", "# database file", "db_path", "=", "self", ".", "get_data_file", "(", "\"data.sqlite\"", ")", "# comect and create cursor", "self", ".", "db", "=", "sqlite3", ".", "connect", "(", "db_path", ")", "self", ".", "cursor", ...
Init database and prepare tables
[ "Init", "database", "and", "prepare", "tables" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L121-L141
itsnauman/jumprun
jumprun.py
JumpRun.db_query
def db_query(self, query, args=None): """ Execute a query in the DB """ if args is None: self.cursor.execute(query) else: self.cursor.execute(query, args)
python
def db_query(self, query, args=None): """ Execute a query in the DB """ if args is None: self.cursor.execute(query) else: self.cursor.execute(query, args)
[ "def", "db_query", "(", "self", ",", "query", ",", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "self", ".", "cursor", ".", "execute", "(", "query", ")", "else", ":", "self", ".", "cursor", ".", "execute", "(", "query", ",", "a...
Execute a query in the DB
[ "Execute", "a", "query", "in", "the", "DB" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L143-L150
itsnauman/jumprun
jumprun.py
JumpRun.db_exec
def db_exec(self, query, args=None): """ Execute a query in the DB """ if args is None: self.db_query(query) else: self.db_query(query, args) self.db.commit()
python
def db_exec(self, query, args=None): """ Execute a query in the DB """ if args is None: self.db_query(query) else: self.db_query(query, args) self.db.commit()
[ "def", "db_exec", "(", "self", ",", "query", ",", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "self", ".", "db_query", "(", "query", ")", "else", ":", "self", ".", "db_query", "(", "query", ",", "args", ")", "self", ".", "db",...
Execute a query in the DB
[ "Execute", "a", "query", "in", "the", "DB" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L152-L161
itsnauman/jumprun
jumprun.py
JumpRun.shortcut_exists
def shortcut_exists(self, name): """ Check if a shortcut of given name already exists in the DB """ self.db_query(''' SELECT * FROM shortcuts WHERE name=? ''', (name,)) pth = self.db_fetch_one() if pth is None or len(pth) == 0: retur...
python
def shortcut_exists(self, name): """ Check if a shortcut of given name already exists in the DB """ self.db_query(''' SELECT * FROM shortcuts WHERE name=? ''', (name,)) pth = self.db_fetch_one() if pth is None or len(pth) == 0: retur...
[ "def", "shortcut_exists", "(", "self", ",", "name", ")", ":", "self", ".", "db_query", "(", "'''\n SELECT * FROM shortcuts WHERE name=?\n '''", ",", "(", "name", ",", ")", ")", "pth", "=", "self", ".", "db_fetch_one", "(", ")", "if", "pth",...
Check if a shortcut of given name already exists in the DB
[ "Check", "if", "a", "shortcut", "of", "given", "name", "already", "exists", "in", "the", "DB" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L175-L189
itsnauman/jumprun
jumprun.py
JumpRun.shortcut_str
def shortcut_str(self, path, cmd): """ Get a string with colors describing a shortcut """ s = colored('| path = ', 'cyan') + colored(path, 'yellow') + '\n' \ + colored('| cmd = ', 'cyan') + \ colored(cmd, 'green', attrs=['bold']) return s
python
def shortcut_str(self, path, cmd): """ Get a string with colors describing a shortcut """ s = colored('| path = ', 'cyan') + colored(path, 'yellow') + '\n' \ + colored('| cmd = ', 'cyan') + \ colored(cmd, 'green', attrs=['bold']) return s
[ "def", "shortcut_str", "(", "self", ",", "path", ",", "cmd", ")", ":", "s", "=", "colored", "(", "'| path = '", ",", "'cyan'", ")", "+", "colored", "(", "path", ",", "'yellow'", ")", "+", "'\\n'", "+", "colored", "(", "'| cmd = '", ",", "'cyan'", ")...
Get a string with colors describing a shortcut
[ "Get", "a", "string", "with", "colors", "describing", "a", "shortcut" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L191-L200
itsnauman/jumprun
jumprun.py
JumpRun.action_add
def action_add(self): """ Add a new shortcut """ # prepare values for new shortcut path = self.args['--workdir'] or os.getcwd() name = self.args['<name>'] cmd = self.args['<command>'] overwrite = self.args['--force'] # check for conflicts in DB ...
python
def action_add(self): """ Add a new shortcut """ # prepare values for new shortcut path = self.args['--workdir'] or os.getcwd() name = self.args['<name>'] cmd = self.args['<command>'] overwrite = self.args['--force'] # check for conflicts in DB ...
[ "def", "action_add", "(", "self", ")", ":", "# prepare values for new shortcut", "path", "=", "self", ".", "args", "[", "'--workdir'", "]", "or", "os", ".", "getcwd", "(", ")", "name", "=", "self", ".", "args", "[", "'<name>'", "]", "cmd", "=", "self", ...
Add a new shortcut
[ "Add", "a", "new", "shortcut" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L202-L291
itsnauman/jumprun
jumprun.py
JumpRun.action_rm
def action_rm(self): """ Delete a shortcut """ name = self.args['<name>'] if self.args['all']: # delete all if ask_yes_no('Really delete ALL shortcuts?', default='no'): self.db_exec(''' DELETE FROM shortcuts ''') print_ms...
python
def action_rm(self): """ Delete a shortcut """ name = self.args['<name>'] if self.args['all']: # delete all if ask_yes_no('Really delete ALL shortcuts?', default='no'): self.db_exec(''' DELETE FROM shortcuts ''') print_ms...
[ "def", "action_rm", "(", "self", ")", ":", "name", "=", "self", ".", "args", "[", "'<name>'", "]", "if", "self", ".", "args", "[", "'all'", "]", ":", "# delete all", "if", "ask_yes_no", "(", "'Really delete ALL shortcuts?'", ",", "default", "=", "'no'", ...
Delete a shortcut
[ "Delete", "a", "shortcut" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L293-L331
itsnauman/jumprun
jumprun.py
JumpRun.action_rename
def action_rename(self): """ Rename a shortcut """ # get old and new name from args old = self.args['<old>'] new = self.args['<new>'] # select the old shortcut self.db_query(''' SELECT id FROM shortcuts WHERE name=? ''', (old,)) ...
python
def action_rename(self): """ Rename a shortcut """ # get old and new name from args old = self.args['<old>'] new = self.args['<new>'] # select the old shortcut self.db_query(''' SELECT id FROM shortcuts WHERE name=? ''', (old,)) ...
[ "def", "action_rename", "(", "self", ")", ":", "# get old and new name from args", "old", "=", "self", ".", "args", "[", "'<old>'", "]", "new", "=", "self", ".", "args", "[", "'<new>'", "]", "# select the old shortcut", "self", ".", "db_query", "(", "'''\n ...
Rename a shortcut
[ "Rename", "a", "shortcut" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L333-L366
itsnauman/jumprun
jumprun.py
JumpRun.action_show
def action_show(self): """ Show shortcut(s) value """ # helper function to display one row with colors # r = [name, path, command] def show_a_row(r): msg = colored('Shortcut: ', 'cyan') \ + colored(r[0], 'white', attrs=['bold']) + '\n' \ ...
python
def action_show(self): """ Show shortcut(s) value """ # helper function to display one row with colors # r = [name, path, command] def show_a_row(r): msg = colored('Shortcut: ', 'cyan') \ + colored(r[0], 'white', attrs=['bold']) + '\n' \ ...
[ "def", "action_show", "(", "self", ")", ":", "# helper function to display one row with colors", "# r = [name, path, command]", "def", "show_a_row", "(", "r", ")", ":", "msg", "=", "colored", "(", "'Shortcut: '", ",", "'cyan'", ")", "+", "colored", "(", "r", "[", ...
Show shortcut(s) value
[ "Show", "shortcut", "(", "s", ")", "value" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L368-L412
itsnauman/jumprun
jumprun.py
JumpRun.action_run_command
def action_run_command(self): """ Run a shortcut, if exists """ name = self.args['<name>'] # get entry from DB self.db_query(''' SELECT path,command FROM shortcuts WHERE name=? ''', (name,)) row = self.db_fetch_one() if row is N...
python
def action_run_command(self): """ Run a shortcut, if exists """ name = self.args['<name>'] # get entry from DB self.db_query(''' SELECT path,command FROM shortcuts WHERE name=? ''', (name,)) row = self.db_fetch_one() if row is N...
[ "def", "action_run_command", "(", "self", ")", ":", "name", "=", "self", ".", "args", "[", "'<name>'", "]", "# get entry from DB", "self", ".", "db_query", "(", "'''\n SELECT path,command FROM shortcuts WHERE name=?\n '''", ",", "(", "name", ",", ...
Run a shortcut, if exists
[ "Run", "a", "shortcut", "if", "exists" ]
train
https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L414-L447
glue-viz/echo
echo/callback_container.py
CallbackContainer._wrap
def _wrap(self, value, priority=0): """ Given a function/method, this will automatically wrap a method using weakref to avoid circular references. """ if not callable(value): raise TypeError("Only callable values can be stored in CallbackContainer") elif sel...
python
def _wrap(self, value, priority=0): """ Given a function/method, this will automatically wrap a method using weakref to avoid circular references. """ if not callable(value): raise TypeError("Only callable values can be stored in CallbackContainer") elif sel...
[ "def", "_wrap", "(", "self", ",", "value", ",", "priority", "=", "0", ")", ":", "if", "not", "callable", "(", "value", ")", ":", "raise", "TypeError", "(", "\"Only callable values can be stored in CallbackContainer\"", ")", "elif", "self", ".", "is_bound_method"...
Given a function/method, this will automatically wrap a method using weakref to avoid circular references.
[ "Given", "a", "function", "/", "method", "this", "will", "automatically", "wrap", "a", "method", "using", "weakref", "to", "avoid", "circular", "references", "." ]
train
https://github.com/glue-viz/echo/blob/6ad54cc5e869de27c34e8716f2619ddc640f08fe/echo/callback_container.py#L20-L43
fogcitymarathoner/s3_mysql_backup
s3_mysql_backup/scripts/delete_bucket.py
delete_bucket
def delete_bucket(): """ Delete S3 Bucket """ args = parser.parse_args s3_bucket(args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name)().delete()
python
def delete_bucket(): """ Delete S3 Bucket """ args = parser.parse_args s3_bucket(args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name)().delete()
[ "def", "delete_bucket", "(", ")", ":", "args", "=", "parser", ".", "parse_args", "s3_bucket", "(", "args", ".", "aws_access_key_id", ",", "args", ".", "aws_secret_access_key", ",", "args", ".", "bucket_name", ")", "(", ")", ".", "delete", "(", ")" ]
Delete S3 Bucket
[ "Delete", "S3", "Bucket" ]
train
https://github.com/fogcitymarathoner/s3_mysql_backup/blob/8a0fb3e51a7b873eb4287d4954548a0dbab0e734/s3_mysql_backup/scripts/delete_bucket.py#L13-L18
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.check_instance_state
def check_instance_state(self, instance_id, wait=True): ''' method for checking the state of an instance on AWS EC2 :param instance_id: string with AWS id of instance :param wait: [optional] boolean to wait for instance while pending :return: string repo...
python
def check_instance_state(self, instance_id, wait=True): ''' method for checking the state of an instance on AWS EC2 :param instance_id: string with AWS id of instance :param wait: [optional] boolean to wait for instance while pending :return: string repo...
[ "def", "check_instance_state", "(", "self", ",", "instance_id", ",", "wait", "=", "True", ")", ":", "title", "=", "'%s.check_instance_state'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'instance_id'", ":", "i...
method for checking the state of an instance on AWS EC2 :param instance_id: string with AWS id of instance :param wait: [optional] boolean to wait for instance while pending :return: string reporting state of instance
[ "method", "for", "checking", "the", "state", "of", "an", "instance", "on", "AWS", "EC2", ":", "param", "instance_id", ":", "string", "with", "AWS", "id", "of", "instance", ":", "param", "wait", ":", "[", "optional", "]", "boolean", "to", "wait", "for", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L64-L160
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.check_instance_status
def check_instance_status(self, instance_id, wait=True): ''' a method to wait until AWS instance reports an OK status :param instance_id: string of instance id on AWS :param wait: [optional] boolean to wait for instance while initializing :return: True ''' ...
python
def check_instance_status(self, instance_id, wait=True): ''' a method to wait until AWS instance reports an OK status :param instance_id: string of instance id on AWS :param wait: [optional] boolean to wait for instance while initializing :return: True ''' ...
[ "def", "check_instance_status", "(", "self", ",", "instance_id", ",", "wait", "=", "True", ")", ":", "title", "=", "'%s.check_instance_status'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'instance_id'", ":", ...
a method to wait until AWS instance reports an OK status :param instance_id: string of instance id on AWS :param wait: [optional] boolean to wait for instance while initializing :return: True
[ "a", "method", "to", "wait", "until", "AWS", "instance", "reports", "an", "OK", "status" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L162-L233
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.list_instances
def list_instances(self, tag_values=None): ''' a method to retrieve the list of instances on AWS EC2 :param tag_values: [optional] list of tag values :return: list of strings with instance AWS ids ''' title = '%s.list_instances' % self.__class__.__name__ # val...
python
def list_instances(self, tag_values=None): ''' a method to retrieve the list of instances on AWS EC2 :param tag_values: [optional] list of tag values :return: list of strings with instance AWS ids ''' title = '%s.list_instances' % self.__class__.__name__ # val...
[ "def", "list_instances", "(", "self", ",", "tag_values", "=", "None", ")", ":", "title", "=", "'%s.list_instances'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'tag_values'", ":", "tag_values", "}", "for", "...
a method to retrieve the list of instances on AWS EC2 :param tag_values: [optional] list of tag values :return: list of strings with instance AWS ids
[ "a", "method", "to", "retrieve", "the", "list", "of", "instances", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L235-L312
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.read_instance
def read_instance(self, instance_id): ''' a method to retrieving the details of a single instances on AWS EC2 :param instance_id: string of instance id on AWS :return: dictionary with instance attributes relevant fields: 'instance_id': '', 'image_i...
python
def read_instance(self, instance_id): ''' a method to retrieving the details of a single instances on AWS EC2 :param instance_id: string of instance id on AWS :return: dictionary with instance attributes relevant fields: 'instance_id': '', 'image_i...
[ "def", "read_instance", "(", "self", ",", "instance_id", ")", ":", "title", "=", "'%s.read_instance'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'instance_id'", ":", "instance_id", "}", "for", "key", ",", "...
a method to retrieving the details of a single instances on AWS EC2 :param instance_id: string of instance id on AWS :return: dictionary with instance attributes relevant fields: 'instance_id': '', 'image_id': '', 'instance_type': '', 'region': '', ...
[ "a", "method", "to", "retrieving", "the", "details", "of", "a", "single", "instances", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L314-L387
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.tag_instance
def tag_instance(self, instance_id, tag_list): ''' a method for adding or updating tags on an AWS instance :param instance_id: string of instance id on AWS :param tag_list: list of single key-value pairs :return: dictionary with aws response info ''' title ...
python
def tag_instance(self, instance_id, tag_list): ''' a method for adding or updating tags on an AWS instance :param instance_id: string of instance id on AWS :param tag_list: list of single key-value pairs :return: dictionary with aws response info ''' title ...
[ "def", "tag_instance", "(", "self", ",", "instance_id", ",", "tag_list", ")", ":", "title", "=", "'%s.tag_instance'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'instance_id'", ":", "instance_id", ",", "'tag_l...
a method for adding or updating tags on an AWS instance :param instance_id: string of instance id on AWS :param tag_list: list of single key-value pairs :return: dictionary with aws response info
[ "a", "method", "for", "adding", "or", "updating", "tags", "on", "an", "AWS", "instance" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L389-L452
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.create_instance
def create_instance(self, image_id, pem_file, group_ids, instance_type, volume_type='gp2', ebs_optimized=False, instance_monitoring=False, iam_profile='', tag_list=None, auction_bid=0.0): ''' a method for starting an instance on AWS EC2 :param image_id: string with aws id of im...
python
def create_instance(self, image_id, pem_file, group_ids, instance_type, volume_type='gp2', ebs_optimized=False, instance_monitoring=False, iam_profile='', tag_list=None, auction_bid=0.0): ''' a method for starting an instance on AWS EC2 :param image_id: string with aws id of im...
[ "def", "create_instance", "(", "self", ",", "image_id", ",", "pem_file", ",", "group_ids", ",", "instance_type", ",", "volume_type", "=", "'gp2'", ",", "ebs_optimized", "=", "False", ",", "instance_monitoring", "=", "False", ",", "iam_profile", "=", "''", ",",...
a method for starting an instance on AWS EC2 :param image_id: string with aws id of image for instance :param pem_file: string with path to pem file to access image :param group_ids: list with aws id of security group(s) to attach to instance :param instance_type: string wi...
[ "a", "method", "for", "starting", "an", "instance", "on", "AWS", "EC2", ":", "param", "image_id", ":", "string", "with", "aws", "id", "of", "image", "for", "instance", ":", "param", "pem_file", ":", "string", "with", "path", "to", "pem", "file", "to", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L454-L611
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.delete_instance
def delete_instance(self, instance_id): ''' method for removing an instance from AWS EC2 :param instance_id: string of instance id on AWS :return: string reporting state of instance ''' title = '%s.delete_instance' % self.__class__.__name__ # validate inputs ...
python
def delete_instance(self, instance_id): ''' method for removing an instance from AWS EC2 :param instance_id: string of instance id on AWS :return: string reporting state of instance ''' title = '%s.delete_instance' % self.__class__.__name__ # validate inputs ...
[ "def", "delete_instance", "(", "self", ",", "instance_id", ")", ":", "title", "=", "'%s.delete_instance'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'instance_id'", ":", "instance_id", "}", "for", "key", ",",...
method for removing an instance from AWS EC2 :param instance_id: string of instance id on AWS :return: string reporting state of instance
[ "method", "for", "removing", "an", "instance", "from", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L613-L685
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.list_addresses
def list_addresses(self, tag_values=None): ''' a method to list elastic ip addresses associated with account on AWS :param tag_values: [optional] list of tag values :return: list of strings with ip addresses ''' title = '%s.list_addresse...
python
def list_addresses(self, tag_values=None): ''' a method to list elastic ip addresses associated with account on AWS :param tag_values: [optional] list of tag values :return: list of strings with ip addresses ''' title = '%s.list_addresse...
[ "def", "list_addresses", "(", "self", ",", "tag_values", "=", "None", ")", ":", "title", "=", "'%s.list_addresses'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'tag_values'", ":", "tag_values", "}", "for", "...
a method to list elastic ip addresses associated with account on AWS :param tag_values: [optional] list of tag values :return: list of strings with ip addresses
[ "a", "method", "to", "list", "elastic", "ip", "addresses", "associated", "with", "account", "on", "AWS", ":", "param", "tag_values", ":", "[", "optional", "]", "list", "of", "tag", "values", ":", "return", ":", "list", "of", "strings", "with", "ip", "add...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L687-L735
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.read_address
def read_address(self, ip_address): ''' a method to retrieve details about an elastic ip address associated with account on AWS :param ip_address: string with elastic ipv4 address on ec2 :return: dictionary with ip address details ''' t...
python
def read_address(self, ip_address): ''' a method to retrieve details about an elastic ip address associated with account on AWS :param ip_address: string with elastic ipv4 address on ec2 :return: dictionary with ip address details ''' t...
[ "def", "read_address", "(", "self", ",", "ip_address", ")", ":", "title", "=", "'%s.read_address'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'ip_address'", ":", "ip_address", "}", "for", "key", ",", "value...
a method to retrieve details about an elastic ip address associated with account on AWS :param ip_address: string with elastic ipv4 address on ec2 :return: dictionary with ip address details
[ "a", "method", "to", "retrieve", "details", "about", "an", "elastic", "ip", "address", "associated", "with", "account", "on", "AWS", ":", "param", "ip_address", ":", "string", "with", "elastic", "ipv4", "address", "on", "ec2", ":", "return", ":", "dictionary...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L737-L782
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.assign_address
def assign_address(self, ip_address, instance_id): ''' a method to assign (or reassign) an elastic ip to an instance on AWS :param ip_address: string with elastic ipv4 address on ec2 :param instance_id: string with aws id for running instance :return: ...
python
def assign_address(self, ip_address, instance_id): ''' a method to assign (or reassign) an elastic ip to an instance on AWS :param ip_address: string with elastic ipv4 address on ec2 :param instance_id: string with aws id for running instance :return: ...
[ "def", "assign_address", "(", "self", ",", "ip_address", ",", "instance_id", ")", ":", "title", "=", "'%s.assign_address'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'ip_address'", ":", "ip_address", ",", "'i...
a method to assign (or reassign) an elastic ip to an instance on AWS :param ip_address: string with elastic ipv4 address on ec2 :param instance_id: string with aws id for running instance :return: dictioanry with response metadata fields
[ "a", "method", "to", "assign", "(", "or", "reassign", ")", "an", "elastic", "ip", "to", "an", "instance", "on", "AWS", ":", "param", "ip_address", ":", "string", "with", "elastic", "ipv4", "address", "on", "ec2", ":", "param", "instance_id", ":", "string...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L784-L817
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.check_image_state
def check_image_state(self, image_id, wait=True): ''' method for checking the state of an image on AWS EC2 :param image_id: string with AWS id of image :param wait: [optional] boolean to wait for image while pending :return: string reporting state of image ''' ...
python
def check_image_state(self, image_id, wait=True): ''' method for checking the state of an image on AWS EC2 :param image_id: string with AWS id of image :param wait: [optional] boolean to wait for image while pending :return: string reporting state of image ''' ...
[ "def", "check_image_state", "(", "self", ",", "image_id", ",", "wait", "=", "True", ")", ":", "title", "=", "'%s.check_image_state'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'image_id'", ":", "image_id", ...
method for checking the state of an image on AWS EC2 :param image_id: string with AWS id of image :param wait: [optional] boolean to wait for image while pending :return: string reporting state of image
[ "method", "for", "checking", "the", "state", "of", "an", "image", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L819-L916
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.list_images
def list_images(self, tag_values=None): ''' a method to retrieve the list of images of account on AWS EC2 :param tag_values: [optional] list of tag values :return: list of image AWS ids ''' title = '%s.list_images' % self.__class__.__name__ # validate inputs ...
python
def list_images(self, tag_values=None): ''' a method to retrieve the list of images of account on AWS EC2 :param tag_values: [optional] list of tag values :return: list of image AWS ids ''' title = '%s.list_images' % self.__class__.__name__ # validate inputs ...
[ "def", "list_images", "(", "self", ",", "tag_values", "=", "None", ")", ":", "title", "=", "'%s.list_images'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'tag_values'", ":", "tag_values", "}", "for", "key", ...
a method to retrieve the list of images of account on AWS EC2 :param tag_values: [optional] list of tag values :return: list of image AWS ids
[ "a", "method", "to", "retrieve", "the", "list", "of", "images", "of", "account", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L918-L1000
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.read_image
def read_image(self, image_id): ''' a method to retrieve the details of a single image on AWS EC2 :param image_id: string with AWS id of image :return: dictionary of image attributes relevant fields: 'image_id': '', 'snapshot_id': '', 'regi...
python
def read_image(self, image_id): ''' a method to retrieve the details of a single image on AWS EC2 :param image_id: string with AWS id of image :return: dictionary of image attributes relevant fields: 'image_id': '', 'snapshot_id': '', 'regi...
[ "def", "read_image", "(", "self", ",", "image_id", ")", ":", "title", "=", "'%s.read_image'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'image_id'", ":", "image_id", "}", "for", "key", ",", "value", "in",...
a method to retrieve the details of a single image on AWS EC2 :param image_id: string with AWS id of image :return: dictionary of image attributes relevant fields: 'image_id': '', 'snapshot_id': '', 'region': '', 'state': '', 'tags': []
[ "a", "method", "to", "retrieve", "the", "details", "of", "a", "single", "image", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1002-L1055
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.tag_image
def tag_image(self, image_id, tag_list): ''' a method for adding or updating tags on an AWS instance :param image_id: string with AWS id of instance :param tag_list: list of tags to add to instance :return: dictionary with response data ''' title = '%s.tag_...
python
def tag_image(self, image_id, tag_list): ''' a method for adding or updating tags on an AWS instance :param image_id: string with AWS id of instance :param tag_list: list of tags to add to instance :return: dictionary with response data ''' title = '%s.tag_...
[ "def", "tag_image", "(", "self", ",", "image_id", ",", "tag_list", ")", ":", "title", "=", "'%s.tag_image'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'image_id'", ":", "image_id", ",", "'tag_list'", ":", ...
a method for adding or updating tags on an AWS instance :param image_id: string with AWS id of instance :param tag_list: list of tags to add to instance :return: dictionary with response data
[ "a", "method", "for", "adding", "or", "updating", "tags", "on", "an", "AWS", "instance" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1057-L1120
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.create_image
def create_image(self, instance_id, image_name, tag_list=None): ''' method for imaging an instance on AWS EC2 :param instance_id: string with AWS id of running instance :param image_name: string with name to give new image :param tag_list: [optional] list of resources tags ...
python
def create_image(self, instance_id, image_name, tag_list=None): ''' method for imaging an instance on AWS EC2 :param instance_id: string with AWS id of running instance :param image_name: string with name to give new image :param tag_list: [optional] list of resources tags ...
[ "def", "create_image", "(", "self", ",", "instance_id", ",", "image_name", ",", "tag_list", "=", "None", ")", ":", "title", "=", "'%s.create_image'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'instance_id'", ...
method for imaging an instance on AWS EC2 :param instance_id: string with AWS id of running instance :param image_name: string with name to give new image :param tag_list: [optional] list of resources tags to add to image :return: string with AWS id of image
[ "method", "for", "imaging", "an", "instance", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1122-L1237
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.delete_image
def delete_image(self, image_id): ''' method for removing an image from AWS EC2 :param image_id: string with AWS id of instance :return: string with AWS response from snapshot delete ''' title = '%s.delete_image' % self.__class__.__name__ # validate inputs ...
python
def delete_image(self, image_id): ''' method for removing an image from AWS EC2 :param image_id: string with AWS id of instance :return: string with AWS response from snapshot delete ''' title = '%s.delete_image' % self.__class__.__name__ # validate inputs ...
[ "def", "delete_image", "(", "self", ",", "image_id", ")", ":", "title", "=", "'%s.delete_image'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'image_id'", ":", "image_id", "}", "for", "key", ",", "value", "...
method for removing an image from AWS EC2 :param image_id: string with AWS id of instance :return: string with AWS response from snapshot delete
[ "method", "for", "removing", "an", "image", "from", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1239-L1298
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.import_image
def import_image(self, image_id, region_name): ''' a method to import an image from another AWS region https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html REQUIRED: aws credentials must have valid access to both regions :param image_id: string wit...
python
def import_image(self, image_id, region_name): ''' a method to import an image from another AWS region https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html REQUIRED: aws credentials must have valid access to both regions :param image_id: string wit...
[ "def", "import_image", "(", "self", ",", "image_id", ",", "region_name", ")", ":", "title", "=", "'%s.import_image'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'image_id'", ":", "image_id", "}", "for", "key...
a method to import an image from another AWS region https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html REQUIRED: aws credentials must have valid access to both regions :param image_id: string with AWS id of source image :param region_name: string with AWS reg...
[ "a", "method", "to", "import", "an", "image", "from", "another", "AWS", "region" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1300-L1433
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.export_image
def export_image(self, image_id, region_name): ''' a method to add a copy of an image to another AWS region https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html REQUIRED: iam credentials must have valid access to both regions :param image_id: strin...
python
def export_image(self, image_id, region_name): ''' a method to add a copy of an image to another AWS region https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html REQUIRED: iam credentials must have valid access to both regions :param image_id: strin...
[ "def", "export_image", "(", "self", ",", "image_id", ",", "region_name", ")", ":", "title", "=", "'%s.export_image'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'image_id'", ":", "image_id", "}", "for", "key...
a method to add a copy of an image to another AWS region https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html REQUIRED: iam credentials must have valid access to both regions :param image_id: string of AWS id of image to be copied :param region_name: string of ...
[ "a", "method", "to", "add", "a", "copy", "of", "an", "image", "to", "another", "AWS", "region" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1435-L1562
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.list_keypairs
def list_keypairs(self): ''' a method to discover the list of key pairs on AWS :return: list of key pairs ''' title = '%s.list_keypairs' % self.__class__.__name__ # request subnet list from AWS self.iam.printer('Querying AWS region %s for key pairs.' % self.ia...
python
def list_keypairs(self): ''' a method to discover the list of key pairs on AWS :return: list of key pairs ''' title = '%s.list_keypairs' % self.__class__.__name__ # request subnet list from AWS self.iam.printer('Querying AWS region %s for key pairs.' % self.ia...
[ "def", "list_keypairs", "(", "self", ")", ":", "title", "=", "'%s.list_keypairs'", "%", "self", ".", "__class__", ".", "__name__", "# request subnet list from AWS", "self", ".", "iam", ".", "printer", "(", "'Querying AWS region %s for key pairs.'", "%", "self", ".",...
a method to discover the list of key pairs on AWS :return: list of key pairs
[ "a", "method", "to", "discover", "the", "list", "of", "key", "pairs", "on", "AWS" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1564-L1600
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.list_subnets
def list_subnets(self, tag_values=None): ''' a method to discover the list of subnets on AWS EC2 :param tag_values: [optional] list of tag values :return: list of strings with subnet ids ''' title = '%s.list_subnets' % self.__class__.__name__ # validate inputs...
python
def list_subnets(self, tag_values=None): ''' a method to discover the list of subnets on AWS EC2 :param tag_values: [optional] list of tag values :return: list of strings with subnet ids ''' title = '%s.list_subnets' % self.__class__.__name__ # validate inputs...
[ "def", "list_subnets", "(", "self", ",", "tag_values", "=", "None", ")", ":", "title", "=", "'%s.list_subnets'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'tag_values'", ":", "tag_values", "}", "for", "key"...
a method to discover the list of subnets on AWS EC2 :param tag_values: [optional] list of tag values :return: list of strings with subnet ids
[ "a", "method", "to", "discover", "the", "list", "of", "subnets", "on", "AWS", "EC2" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1602-L1664
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.read_subnet
def read_subnet(self, subnet_id): ''' a method to retrieve the details about a subnet :param subnet_id: string with AWS id of subnet :return: dictionary with subnet details relevant fields: 'subnet_id': '', 'vpc_id': '', 'availability_zone'...
python
def read_subnet(self, subnet_id): ''' a method to retrieve the details about a subnet :param subnet_id: string with AWS id of subnet :return: dictionary with subnet details relevant fields: 'subnet_id': '', 'vpc_id': '', 'availability_zone'...
[ "def", "read_subnet", "(", "self", ",", "subnet_id", ")", ":", "title", "=", "'%s.read_subnet'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'subnet_id'", ":", "subnet_id", "}", "for", "key", ",", "value", ...
a method to retrieve the details about a subnet :param subnet_id: string with AWS id of subnet :return: dictionary with subnet details relevant fields: 'subnet_id': '', 'vpc_id': '', 'availability_zone': '', 'state': '', 'tags': [{'key': '', 'va...
[ "a", "method", "to", "retrieve", "the", "details", "about", "a", "subnet" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1666-L1716
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.read_security_group
def read_security_group(self, group_id): ''' a method to retrieve the details about a security group :param group_id: string with AWS id of security group :return: dictionary with security group details relevant fields: 'group_id: '', 'vpc_id': '',...
python
def read_security_group(self, group_id): ''' a method to retrieve the details about a security group :param group_id: string with AWS id of security group :return: dictionary with security group details relevant fields: 'group_id: '', 'vpc_id': '',...
[ "def", "read_security_group", "(", "self", ",", "group_id", ")", ":", "title", "=", "'%s.read_security_group'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'group_id'", ":", "group_id", "}", "for", "key", ",", ...
a method to retrieve the details about a security group :param group_id: string with AWS id of security group :return: dictionary with security group details relevant fields: 'group_id: '', 'vpc_id': '', 'group_name': '', 'tags': [{'key': '', 'value': '...
[ "a", "method", "to", "retrieve", "the", "details", "about", "a", "security", "group" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1782-L1835
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
ec2Client.cleanup
def cleanup(self): ''' a method for removing instances and images in unusual states :return: True ''' # find non-running instances self.iam.printer('Cleaning up AWS region %s.' % self.iam.region_name) response = self.connection.describe_instances() inst...
python
def cleanup(self): ''' a method for removing instances and images in unusual states :return: True ''' # find non-running instances self.iam.printer('Cleaning up AWS region %s.' % self.iam.region_name) response = self.connection.describe_instances() inst...
[ "def", "cleanup", "(", "self", ")", ":", "# find non-running instances", "self", ".", "iam", ".", "printer", "(", "'Cleaning up AWS region %s.'", "%", "self", ".", "iam", ".", "region_name", ")", "response", "=", "self", ".", "connection", ".", "describe_instanc...
a method for removing instances and images in unusual states :return: True
[ "a", "method", "for", "removing", "instances", "and", "images", "in", "unusual", "states" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1837-L1972
neumark/microcli
microcli.py
GlobalOptionParser.print_help
def print_help(self, file=None): """ recursively call all command parsers' helps """ output = file or self.stderr CustomStderrOptionParser.print_help(self, output) output.write("\nCommands:\n") for command_def in self.command_definitions.values(): command_def.opt_pars...
python
def print_help(self, file=None): """ recursively call all command parsers' helps """ output = file or self.stderr CustomStderrOptionParser.print_help(self, output) output.write("\nCommands:\n") for command_def in self.command_definitions.values(): command_def.opt_pars...
[ "def", "print_help", "(", "self", ",", "file", "=", "None", ")", ":", "output", "=", "file", "or", "self", ".", "stderr", "CustomStderrOptionParser", ".", "print_help", "(", "self", ",", "output", ")", "output", ".", "write", "(", "\"\\nCommands:\\n\"", ")...
recursively call all command parsers' helps
[ "recursively", "call", "all", "command", "parsers", "helps" ]
train
https://github.com/neumark/microcli/blob/fa31a35a95f63593ca12d246a5a84e2dff522dd6/microcli.py#L151-L158
theirc/rapidsms-multitenancy
multitenancy/auth.py
get_user_groups
def get_user_groups(user): """Return the set of associated TenantGroups for the given user.""" if user.is_active and user.is_authenticated(): if user.is_superuser: return TenantGroup.objects.all() else: return TenantGroup.objects.filter(tenantrole__user=user).distinct() ...
python
def get_user_groups(user): """Return the set of associated TenantGroups for the given user.""" if user.is_active and user.is_authenticated(): if user.is_superuser: return TenantGroup.objects.all() else: return TenantGroup.objects.filter(tenantrole__user=user).distinct() ...
[ "def", "get_user_groups", "(", "user", ")", ":", "if", "user", ".", "is_active", "and", "user", ".", "is_authenticated", "(", ")", ":", "if", "user", ".", "is_superuser", ":", "return", "TenantGroup", ".", "objects", ".", "all", "(", ")", "else", ":", ...
Return the set of associated TenantGroups for the given user.
[ "Return", "the", "set", "of", "associated", "TenantGroups", "for", "the", "given", "user", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L7-L15
theirc/rapidsms-multitenancy
multitenancy/auth.py
get_user_tenants
def get_user_tenants(user, group): """Return the set of associated Tenants for the given user and group.""" if user.is_active and user.is_authenticated(): if user.is_superuser or is_group_manager(user, group.pk): return Tenant.objects.filter(group=group) else: return Tena...
python
def get_user_tenants(user, group): """Return the set of associated Tenants for the given user and group.""" if user.is_active and user.is_authenticated(): if user.is_superuser or is_group_manager(user, group.pk): return Tenant.objects.filter(group=group) else: return Tena...
[ "def", "get_user_tenants", "(", "user", ",", "group", ")", ":", "if", "user", ".", "is_active", "and", "user", ".", "is_authenticated", "(", ")", ":", "if", "user", ".", "is_superuser", "or", "is_group_manager", "(", "user", ",", "group", ".", "pk", ")",...
Return the set of associated Tenants for the given user and group.
[ "Return", "the", "set", "of", "associated", "Tenants", "for", "the", "given", "user", "and", "group", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L18-L26
theirc/rapidsms-multitenancy
multitenancy/auth.py
get_user_roles
def get_user_roles(user): """Return a list of all of the user's roles.""" if not hasattr(user, '_role_cache'): user._role_cache = list(TenantRole.objects.filter(user=user).values_list( 'group', 'role', 'tenant')) return user._role_cache
python
def get_user_roles(user): """Return a list of all of the user's roles.""" if not hasattr(user, '_role_cache'): user._role_cache = list(TenantRole.objects.filter(user=user).values_list( 'group', 'role', 'tenant')) return user._role_cache
[ "def", "get_user_roles", "(", "user", ")", ":", "if", "not", "hasattr", "(", "user", ",", "'_role_cache'", ")", ":", "user", ".", "_role_cache", "=", "list", "(", "TenantRole", ".", "objects", ".", "filter", "(", "user", "=", "user", ")", ".", "values_...
Return a list of all of the user's roles.
[ "Return", "a", "list", "of", "all", "of", "the", "user", "s", "roles", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L29-L34
theirc/rapidsms-multitenancy
multitenancy/auth.py
is_group_manager
def is_group_manager(user, group=None): """Returns True if user is a group manager either for the group or any group.""" roles = get_user_roles(user) return any(x[1] == TenantRole.ROLE_GROUP_MANAGER and (not group or x[0] == group) for x in roles)
python
def is_group_manager(user, group=None): """Returns True if user is a group manager either for the group or any group.""" roles = get_user_roles(user) return any(x[1] == TenantRole.ROLE_GROUP_MANAGER and (not group or x[0] == group) for x in roles)
[ "def", "is_group_manager", "(", "user", ",", "group", "=", "None", ")", ":", "roles", "=", "get_user_roles", "(", "user", ")", "return", "any", "(", "x", "[", "1", "]", "==", "TenantRole", ".", "ROLE_GROUP_MANAGER", "and", "(", "not", "group", "or", "x...
Returns True if user is a group manager either for the group or any group.
[ "Returns", "True", "if", "user", "is", "a", "group", "manager", "either", "for", "the", "group", "or", "any", "group", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L37-L40
theirc/rapidsms-multitenancy
multitenancy/auth.py
is_tenant_manager
def is_tenant_manager(user, group=None, tenant=None): """Returns True if user is a tenant manager either for the group/tenant or any group/tenant.""" roles = get_user_roles(user) return any( x[1] == TenantRole.ROLE_TENANT_MANAGER and (not group or x[0] == group) and (not tenant or x[...
python
def is_tenant_manager(user, group=None, tenant=None): """Returns True if user is a tenant manager either for the group/tenant or any group/tenant.""" roles = get_user_roles(user) return any( x[1] == TenantRole.ROLE_TENANT_MANAGER and (not group or x[0] == group) and (not tenant or x[...
[ "def", "is_tenant_manager", "(", "user", ",", "group", "=", "None", ",", "tenant", "=", "None", ")", ":", "roles", "=", "get_user_roles", "(", "user", ")", "return", "any", "(", "x", "[", "1", "]", "==", "TenantRole", ".", "ROLE_TENANT_MANAGER", "and", ...
Returns True if user is a tenant manager either for the group/tenant or any group/tenant.
[ "Returns", "True", "if", "user", "is", "a", "tenant", "manager", "either", "for", "the", "group", "/", "tenant", "or", "any", "group", "/", "tenant", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L43-L51
nefarioustim/parker
parker/consumepage.py
get_instance
def get_instance(page_to_consume): """Return an instance of ConsumePage.""" global _instances if isinstance(page_to_consume, basestring): uri = page_to_consume page_to_consume = page.get_instance(uri) elif isinstance(page_to_consume, page.Page): uri = page_to_consume.uri else...
python
def get_instance(page_to_consume): """Return an instance of ConsumePage.""" global _instances if isinstance(page_to_consume, basestring): uri = page_to_consume page_to_consume = page.get_instance(uri) elif isinstance(page_to_consume, page.Page): uri = page_to_consume.uri else...
[ "def", "get_instance", "(", "page_to_consume", ")", ":", "global", "_instances", "if", "isinstance", "(", "page_to_consume", ",", "basestring", ")", ":", "uri", "=", "page_to_consume", "page_to_consume", "=", "page", ".", "get_instance", "(", "uri", ")", "elif",...
Return an instance of ConsumePage.
[ "Return", "an", "instance", "of", "ConsumePage", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L12-L36
nefarioustim/parker
parker/consumepage.py
ConsumePage.get_key_value_dict_by_selectors
def get_key_value_dict_by_selectors( self, key_selector, value_selector, value_sub_selector=None ): """Return a dictionary of key value data.""" key_nodes = self.parsedpage.get_nodes_by_selector(key_selector) keys = [ self.parsedpage.get_text_from_node(node) f...
python
def get_key_value_dict_by_selectors( self, key_selector, value_selector, value_sub_selector=None ): """Return a dictionary of key value data.""" key_nodes = self.parsedpage.get_nodes_by_selector(key_selector) keys = [ self.parsedpage.get_text_from_node(node) f...
[ "def", "get_key_value_dict_by_selectors", "(", "self", ",", "key_selector", ",", "value_selector", ",", "value_sub_selector", "=", "None", ")", ":", "key_nodes", "=", "self", ".", "parsedpage", ".", "get_nodes_by_selector", "(", "key_selector", ")", "keys", "=", "...
Return a dictionary of key value data.
[ "Return", "a", "dictionary", "of", "key", "value", "data", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L53-L78
nefarioustim/parker
parker/consumepage.py
ConsumePage.get_crumb_list_by_selector
def get_crumb_list_by_selector(self, crumb_selector): """Return a list of crumbs.""" return [ self.parsedpage.get_text_from_node(crumb) for crumb in self.parsedpage.get_nodes_by_selector(crumb_selector) ]
python
def get_crumb_list_by_selector(self, crumb_selector): """Return a list of crumbs.""" return [ self.parsedpage.get_text_from_node(crumb) for crumb in self.parsedpage.get_nodes_by_selector(crumb_selector) ]
[ "def", "get_crumb_list_by_selector", "(", "self", ",", "crumb_selector", ")", ":", "return", "[", "self", ".", "parsedpage", ".", "get_text_from_node", "(", "crumb", ")", "for", "crumb", "in", "self", ".", "parsedpage", ".", "get_nodes_by_selector", "(", "crumb_...
Return a list of crumbs.
[ "Return", "a", "list", "of", "crumbs", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L80-L85
nefarioustim/parker
parker/consumepage.py
ConsumePage.get_media_list_by_selector
def get_media_list_by_selector( self, media_selector, media_attribute="src" ): """Return a list of media.""" page_url = urlparse.urlparse(self.uri) return [ mediafile.get_instance( urlparse.urljoin( "%s://%s" % ( ...
python
def get_media_list_by_selector( self, media_selector, media_attribute="src" ): """Return a list of media.""" page_url = urlparse.urlparse(self.uri) return [ mediafile.get_instance( urlparse.urljoin( "%s://%s" % ( ...
[ "def", "get_media_list_by_selector", "(", "self", ",", "media_selector", ",", "media_attribute", "=", "\"src\"", ")", ":", "page_url", "=", "urlparse", ".", "urlparse", "(", "self", ".", "uri", ")", "return", "[", "mediafile", ".", "get_instance", "(", "urlpar...
Return a list of media.
[ "Return", "a", "list", "of", "media", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L87-L106
nefarioustim/parker
parker/consumepage.py
ConsumePage.get_data_dict_from_config
def get_data_dict_from_config(self, config_dict): """Return a dictionary of data inferred from config_dict.""" return { key: self.parsedpage.get_filtered_values_by_selector( item_dict['selector'], item_dict.get('regex_filter', None), item_dict....
python
def get_data_dict_from_config(self, config_dict): """Return a dictionary of data inferred from config_dict.""" return { key: self.parsedpage.get_filtered_values_by_selector( item_dict['selector'], item_dict.get('regex_filter', None), item_dict....
[ "def", "get_data_dict_from_config", "(", "self", ",", "config_dict", ")", ":", "return", "{", "key", ":", "self", ".", "parsedpage", ".", "get_filtered_values_by_selector", "(", "item_dict", "[", "'selector'", "]", ",", "item_dict", ".", "get", "(", "'regex_filt...
Return a dictionary of data inferred from config_dict.
[ "Return", "a", "dictionary", "of", "data", "inferred", "from", "config_dict", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L108-L118
veltzer/pytconf
pytconf/config.py
config_arg_parse_and_launch
def config_arg_parse_and_launch(print_messages=True, launch=True): """ backwards compatibility function :return: """ get_pytconf().config_arg_parse_and_launch( print_messages=print_messages, launch=launch, )
python
def config_arg_parse_and_launch(print_messages=True, launch=True): """ backwards compatibility function :return: """ get_pytconf().config_arg_parse_and_launch( print_messages=print_messages, launch=launch, )
[ "def", "config_arg_parse_and_launch", "(", "print_messages", "=", "True", ",", "launch", "=", "True", ")", ":", "get_pytconf", "(", ")", ".", "config_arg_parse_and_launch", "(", "print_messages", "=", "print_messages", ",", "launch", "=", "launch", ",", ")" ]
backwards compatibility function :return:
[ "backwards", "compatibility", "function", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L355-L363
veltzer/pytconf
pytconf/config.py
PytconfConf.register_config
def register_config(self, cls, name): """ register a configuration class :param cls: :param name: :return: """ self._configs.add(cls) self._config_names.add(name)
python
def register_config(self, cls, name): """ register a configuration class :param cls: :param name: :return: """ self._configs.add(cls) self._config_names.add(name)
[ "def", "register_config", "(", "self", ",", "cls", ",", "name", ")", ":", "self", ".", "_configs", ".", "add", "(", "cls", ")", "self", ".", "_config_names", ".", "add", "(", "name", ")" ]
register a configuration class :param cls: :param name: :return:
[ "register", "a", "configuration", "class", ":", "param", "cls", ":", ":", "param", "name", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L53-L61
veltzer/pytconf
pytconf/config.py
PytconfConf.parse_args
def parse_args(self, command_selected, flags, _free_args): # type: (str, Dict[str, str], List[str]) -> bool """ Parse the args and fill the global data Currently we disregard the free parameters :param command_selected: :param flags: :param _free_args: :re...
python
def parse_args(self, command_selected, flags, _free_args): # type: (str, Dict[str, str], List[str]) -> bool """ Parse the args and fill the global data Currently we disregard the free parameters :param command_selected: :param flags: :param _free_args: :re...
[ "def", "parse_args", "(", "self", ",", "command_selected", ",", "flags", ",", "_free_args", ")", ":", "# type: (str, Dict[str, str], List[str]) -> bool", "configs", "=", "self", ".", "function_name_to_configs", "[", "command_selected", "]", "suggested_configs", "=", "se...
Parse the args and fill the global data Currently we disregard the free parameters :param command_selected: :param flags: :param _free_args: :return:
[ "Parse", "the", "args", "and", "fill", "the", "global", "data", "Currently", "we", "disregard", "the", "free", "parameters", ":", "param", "command_selected", ":", ":", "param", "flags", ":", ":", "param", "_free_args", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L152-L213
veltzer/pytconf
pytconf/config.py
ParamCreator.create_int
def create_int(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[int, NO_DEFAULT_TYPE]) -> int """ Create an int parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamFunctions( ...
python
def create_int(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[int, NO_DEFAULT_TYPE]) -> int """ Create an int parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamFunctions( ...
[ "def", "create_int", "(", "help_string", "=", "NO_HELP", ",", "default", "=", "NO_DEFAULT", ")", ":", "# type: (str, Union[int, NO_DEFAULT_TYPE]) -> int", "# noinspection PyTypeChecker", "return", "ParamFunctions", "(", "help_string", "=", "help_string", ",", "default", "...
Create an int parameter :param help_string: :param default: :return:
[ "Create", "an", "int", "parameter", ":", "param", "help_string", ":", ":", "param", "default", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L620-L636
veltzer/pytconf
pytconf/config.py
ParamCreator.create_list_int
def create_list_int(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[List[int], NO_DEFAULT_TYPE]) -> List[int] """ Create a List[int] parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamF...
python
def create_list_int(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[List[int], NO_DEFAULT_TYPE]) -> List[int] """ Create a List[int] parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamF...
[ "def", "create_list_int", "(", "help_string", "=", "NO_HELP", ",", "default", "=", "NO_DEFAULT", ")", ":", "# type: (str, Union[List[int], NO_DEFAULT_TYPE]) -> List[int]", "# noinspection PyTypeChecker", "return", "ParamFunctions", "(", "help_string", "=", "help_string", ",",...
Create a List[int] parameter :param help_string: :param default: :return:
[ "Create", "a", "List", "[", "int", "]", "parameter", ":", "param", "help_string", ":", ":", "param", "default", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L639-L654
veltzer/pytconf
pytconf/config.py
ParamCreator.create_list_str
def create_list_str(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[List[str], NO_DEFAULT_TYPE]) -> List[str] """ Create a List[str] parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamF...
python
def create_list_str(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[List[str], NO_DEFAULT_TYPE]) -> List[str] """ Create a List[str] parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamF...
[ "def", "create_list_str", "(", "help_string", "=", "NO_HELP", ",", "default", "=", "NO_DEFAULT", ")", ":", "# type: (str, Union[List[str], NO_DEFAULT_TYPE]) -> List[str]", "# noinspection PyTypeChecker", "return", "ParamFunctions", "(", "help_string", "=", "help_string", ",",...
Create a List[str] parameter :param help_string: :param default: :return:
[ "Create", "a", "List", "[", "str", "]", "parameter", ":", "param", "help_string", ":", ":", "param", "default", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L657-L672
veltzer/pytconf
pytconf/config.py
ParamCreator.create_int_or_none
def create_int_or_none(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[int, None, NO_DEFAULT_TYPE]) -> Union[int, None] """ Create an int parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return P...
python
def create_int_or_none(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[int, None, NO_DEFAULT_TYPE]) -> Union[int, None] """ Create an int parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return P...
[ "def", "create_int_or_none", "(", "help_string", "=", "NO_HELP", ",", "default", "=", "NO_DEFAULT", ")", ":", "# type: (str, Union[int, None, NO_DEFAULT_TYPE]) -> Union[int, None]", "# noinspection PyTypeChecker", "return", "ParamFunctions", "(", "help_string", "=", "help_strin...
Create an int parameter :param help_string: :param default: :return:
[ "Create", "an", "int", "parameter", ":", "param", "help_string", ":", ":", "param", "default", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L675-L690
veltzer/pytconf
pytconf/config.py
ParamCreator.create_str
def create_str(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[str, NO_DEFAULT_TYPE]) -> str """ Create a string parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamFunctions( ...
python
def create_str(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[str, NO_DEFAULT_TYPE]) -> str """ Create a string parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamFunctions( ...
[ "def", "create_str", "(", "help_string", "=", "NO_HELP", ",", "default", "=", "NO_DEFAULT", ")", ":", "# type: (str, Union[str, NO_DEFAULT_TYPE]) -> str", "# noinspection PyTypeChecker", "return", "ParamFunctions", "(", "help_string", "=", "help_string", ",", "default", "...
Create a string parameter :param help_string: :param default: :return:
[ "Create", "a", "string", "parameter", ":", "param", "help_string", ":", ":", "param", "default", ":", ":", "return", ":" ]
train
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L693-L708