repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
Kortemme-Lab/klab
klab/biblio/doi.py
DOI.get_info
def get_info(self): 'Retrieve the data from CrossRef.' escaped_doi = urllib2.quote(self.doi, '') html = get_resource("www.crossref.org", '/guestquery?queryType=doi&restype=unixref&doi=%s&doi_search=Search' % escaped_doi) xml_matches = [] for m in re.finditer('(<doi_records>.*?</...
python
def get_info(self): 'Retrieve the data from CrossRef.' escaped_doi = urllib2.quote(self.doi, '') html = get_resource("www.crossref.org", '/guestquery?queryType=doi&restype=unixref&doi=%s&doi_search=Search' % escaped_doi) xml_matches = [] for m in re.finditer('(<doi_records>.*?</...
[ "def", "get_info", "(", "self", ")", ":", "'Retrieve the data from CrossRef.'", "escaped_doi", "=", "urllib2", ".", "quote", "(", "self", ".", "doi", ",", "''", ")", "html", "=", "get_resource", "(", "\"www.crossref.org\"", ",", "'/guestquery?queryType=doi&restype=u...
Retrieve the data from CrossRef.
[ "Retrieve", "the", "data", "from", "CrossRef", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/biblio/doi.py#L103-L117
train
Kortemme-Lab/klab
klab/bio/spackle.py
Spackler.add_backbone_atoms_linearly_from_loop_filepaths
def add_backbone_atoms_linearly_from_loop_filepaths(self, loop_json_filepath, fasta_filepath, residue_ids): '''A utility wrapper around add_backbone_atoms_linearly. Adds backbone atoms in a straight line from the first to the last residue of residue_ids. loop_json_filepath is a path to a ...
python
def add_backbone_atoms_linearly_from_loop_filepaths(self, loop_json_filepath, fasta_filepath, residue_ids): '''A utility wrapper around add_backbone_atoms_linearly. Adds backbone atoms in a straight line from the first to the last residue of residue_ids. loop_json_filepath is a path to a ...
[ "def", "add_backbone_atoms_linearly_from_loop_filepaths", "(", "self", ",", "loop_json_filepath", ",", "fasta_filepath", ",", "residue_ids", ")", ":", "loop_def", "=", "json", ".", "loads", "(", "read_file", "(", "loop_json_filepath", ")", ")", "assert", "(", "len",...
A utility wrapper around add_backbone_atoms_linearly. Adds backbone atoms in a straight line from the first to the last residue of residue_ids. loop_json_filepath is a path to a JSON file using the JSON format for Rosetta loops files. This file identifies the insertion points of the se...
[ "A", "utility", "wrapper", "around", "add_backbone_atoms_linearly", ".", "Adds", "backbone", "atoms", "in", "a", "straight", "line", "from", "the", "first", "to", "the", "last", "residue", "of", "residue_ids", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/spackle.py#L46-L106
train
Kortemme-Lab/klab
klab/bio/spackle.py
Spackler.add_atoms_linearly
def add_atoms_linearly(self, start_atom, end_atom, new_atoms, jitterbug = 0.2): '''A low-level function which adds new_atoms between start_atom and end_atom. This function does not validate the input i.e. the calling functions are responsible for ensuring that the insertion makes sense. R...
python
def add_atoms_linearly(self, start_atom, end_atom, new_atoms, jitterbug = 0.2): '''A low-level function which adds new_atoms between start_atom and end_atom. This function does not validate the input i.e. the calling functions are responsible for ensuring that the insertion makes sense. R...
[ "def", "add_atoms_linearly", "(", "self", ",", "start_atom", ",", "end_atom", ",", "new_atoms", ",", "jitterbug", "=", "0.2", ")", ":", "atom_name_map", "=", "{", "'CA'", ":", "' CA '", ",", "'C'", ":", "' C '", ",", "'N'", ":", "' N '", ",", "'O'", ...
A low-level function which adds new_atoms between start_atom and end_atom. This function does not validate the input i.e. the calling functions are responsible for ensuring that the insertion makes sense. Returns the PDB file content with the new atoms added. These atoms are given fresh serial nu...
[ "A", "low", "-", "level", "function", "which", "adds", "new_atoms", "between", "start_atom", "and", "end_atom", ".", "This", "function", "does", "not", "validate", "the", "input", "i", ".", "e", ".", "the", "calling", "functions", "are", "responsible", "for"...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/spackle.py#L222-L291
train
PBR/MQ2
MQ2/qtl.py
QTL.to_string
def to_string(self): """ Return the string as it should be presented in a MapChart input file. """ return '%s %s %s %s %s' % ( self.trait, self.start_position, self.peak_start_position, self.peak_stop_position, self.stop_position)
python
def to_string(self): """ Return the string as it should be presented in a MapChart input file. """ return '%s %s %s %s %s' % ( self.trait, self.start_position, self.peak_start_position, self.peak_stop_position, self.stop_position)
[ "def", "to_string", "(", "self", ")", ":", "return", "'%s %s %s %s %s'", "%", "(", "self", ".", "trait", ",", "self", ".", "start_position", ",", "self", ".", "peak_start_position", ",", "self", ".", "peak_stop_position", ",", "self", ".", "stop_position", ...
Return the string as it should be presented in a MapChart input file.
[ "Return", "the", "string", "as", "it", "should", "be", "presented", "in", "a", "MapChart", "input", "file", "." ]
6d84dea47e6751333004743f588f03158e35c28d
https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/qtl.py#L50-L57
train
aacanakin/glim
glim/cli.py
main
def main(): """ The single entry point to glim command line interface.Main method is called from pypi console_scripts key or by glim.py on root.This function initializes a new app given the glim commands and app commands if app exists. Usage ----- $ python glim/cli.py start $ py...
python
def main(): """ The single entry point to glim command line interface.Main method is called from pypi console_scripts key or by glim.py on root.This function initializes a new app given the glim commands and app commands if app exists. Usage ----- $ python glim/cli.py start $ py...
[ "def", "main", "(", ")", ":", "preparser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "description", ",", "add_help", "=", "False", ")", "preparser", ".", "add_argument", "(", "'--env'", ",", "'-e'", ",", "dest", "=", "'env'", ",", ...
The single entry point to glim command line interface.Main method is called from pypi console_scripts key or by glim.py on root.This function initializes a new app given the glim commands and app commands if app exists. Usage ----- $ python glim/cli.py start $ python glim.py start (on r...
[ "The", "single", "entry", "point", "to", "glim", "command", "line", "interface", ".", "Main", "method", "is", "called", "from", "pypi", "console_scripts", "key", "or", "by", "glim", ".", "py", "on", "root", ".", "This", "function", "initializes", "a", "new...
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/cli.py#L35-L96
train
aacanakin/glim
glim/cli.py
make_app
def make_app(env, commandadapter=None): """ Function creates an app given environment """ mconfig = import_module('app.config.%s' % env, pass_errors=True) if mconfig is None and paths.app_exists(): print(colored('Configuration for "%s" environment is not found' % env, 'red')) return ...
python
def make_app(env, commandadapter=None): """ Function creates an app given environment """ mconfig = import_module('app.config.%s' % env, pass_errors=True) if mconfig is None and paths.app_exists(): print(colored('Configuration for "%s" environment is not found' % env, 'red')) return ...
[ "def", "make_app", "(", "env", ",", "commandadapter", "=", "None", ")", ":", "mconfig", "=", "import_module", "(", "'app.config.%s'", "%", "env", ",", "pass_errors", "=", "True", ")", "if", "mconfig", "is", "None", "and", "paths", ".", "app_exists", "(", ...
Function creates an app given environment
[ "Function", "creates", "an", "app", "given", "environment" ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/cli.py#L98-L111
train
projectshift/shift-boiler
boiler/user/views_social.py
BaseSocial.callback
def callback(self): """ Generate callback url for provider """ next = request.args.get('next') or None endpoint = 'social.{}.handle'.format(self.provider) return url_for(endpoint, _external=True, next=next)
python
def callback(self): """ Generate callback url for provider """ next = request.args.get('next') or None endpoint = 'social.{}.handle'.format(self.provider) return url_for(endpoint, _external=True, next=next)
[ "def", "callback", "(", "self", ")", ":", "next", "=", "request", ".", "args", ".", "get", "(", "'next'", ")", "or", "None", "endpoint", "=", "'social.{}.handle'", ".", "format", "(", "self", ".", "provider", ")", "return", "url_for", "(", "endpoint", ...
Generate callback url for provider
[ "Generate", "callback", "url", "for", "provider" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/views_social.py#L48-L52
train
projectshift/shift-boiler
boiler/user/views_social.py
BaseSocial.next
def next(self): """ Where to redirect after authorization """ next = request.args.get('next') if next is None: params = self.default_redirect_params next = url_for(self.default_redirect_endpoint, **params) return next
python
def next(self): """ Where to redirect after authorization """ next = request.args.get('next') if next is None: params = self.default_redirect_params next = url_for(self.default_redirect_endpoint, **params) return next
[ "def", "next", "(", "self", ")", ":", "next", "=", "request", ".", "args", ".", "get", "(", "'next'", ")", "if", "next", "is", "None", ":", "params", "=", "self", ".", "default_redirect_params", "next", "=", "url_for", "(", "self", ".", "default_redire...
Where to redirect after authorization
[ "Where", "to", "redirect", "after", "authorization" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/views_social.py#L60-L66
train
projectshift/shift-boiler
boiler/user/views_social.py
BaseHandle.dispatch_request
def dispatch_request(self): """ Handle redirect back from provider """ if current_user.is_authenticated: return redirect(self.next) # clear previous! if 'social_data' in session: del session['social_data'] res = self.app.authorized_response() if ...
python
def dispatch_request(self): """ Handle redirect back from provider """ if current_user.is_authenticated: return redirect(self.next) # clear previous! if 'social_data' in session: del session['social_data'] res = self.app.authorized_response() if ...
[ "def", "dispatch_request", "(", "self", ")", ":", "if", "current_user", ".", "is_authenticated", ":", "return", "redirect", "(", "self", ".", "next", ")", "if", "'social_data'", "in", "session", ":", "del", "session", "[", "'social_data'", "]", "res", "=", ...
Handle redirect back from provider
[ "Handle", "redirect", "back", "from", "provider" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/views_social.py#L106-L176
train
tech-pi/doufo
src/python/doufo/tensor/binary.py
project
def project(v, n): """ Project Vector v onto plane with normal vector n. """ return v - matmul(v, n) * n / (norm(n) ** 2.0)
python
def project(v, n): """ Project Vector v onto plane with normal vector n. """ return v - matmul(v, n) * n / (norm(n) ** 2.0)
[ "def", "project", "(", "v", ",", "n", ")", ":", "return", "v", "-", "matmul", "(", "v", ",", "n", ")", "*", "n", "/", "(", "norm", "(", "n", ")", "**", "2.0", ")" ]
Project Vector v onto plane with normal vector n.
[ "Project", "Vector", "v", "onto", "plane", "with", "normal", "vector", "n", "." ]
3d375fef30670597768a6eef809b75b4b1b5a3fd
https://github.com/tech-pi/doufo/blob/3d375fef30670597768a6eef809b75b4b1b5a3fd/src/python/doufo/tensor/binary.py#L36-L40
train
46elks/elkme
elkme/main.py
main
def main(): """Executed on run""" args = parse_args() if args.version: from .__init__ import __version__, __release_date__ print('elkme %s (release date %s)' % (__version__, __release_date__)) print('(c) 2015-2017 46elks AB <hello@46elks.com>') print(small_elk) exit(...
python
def main(): """Executed on run""" args = parse_args() if args.version: from .__init__ import __version__, __release_date__ print('elkme %s (release date %s)' % (__version__, __release_date__)) print('(c) 2015-2017 46elks AB <hello@46elks.com>') print(small_elk) exit(...
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "if", "args", ".", "version", ":", "from", ".", "__init__", "import", "__version__", ",", "__release_date__", "print", "(", "'elkme %s (release date %s)'", "%", "(", "__version__", ",", "__re...
Executed on run
[ "Executed", "on", "run" ]
6ebdce6f8ac852fc6f714d1f1b836f2777fece4e
https://github.com/46elks/elkme/blob/6ebdce6f8ac852fc6f714d1f1b836f2777fece4e/elkme/main.py#L48-L93
train
clement-alexandre/TotemBionet
totembionet/src/ggea/ggea.py
Graph._build_graph
def _build_graph(self) -> nx.DiGraph: """ Private method to build the graph from the model. """ digraph = nx.DiGraph() for state in self.model.all_states(): self._number_of_states += 1 for next_state in self.model.available_state(state): self._number_of_tr...
python
def _build_graph(self) -> nx.DiGraph: """ Private method to build the graph from the model. """ digraph = nx.DiGraph() for state in self.model.all_states(): self._number_of_states += 1 for next_state in self.model.available_state(state): self._number_of_tr...
[ "def", "_build_graph", "(", "self", ")", "->", "nx", ".", "DiGraph", ":", "digraph", "=", "nx", ".", "DiGraph", "(", ")", "for", "state", "in", "self", ".", "model", ".", "all_states", "(", ")", ":", "self", ".", "_number_of_states", "+=", "1", "for"...
Private method to build the graph from the model.
[ "Private", "method", "to", "build", "the", "graph", "from", "the", "model", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/ggea/ggea.py#L22-L33
train
clement-alexandre/TotemBionet
totembionet/src/ggea/ggea.py
Graph._transform_state_to_string
def _transform_state_to_string(self, state: State) -> str: """ Private method which transform a state to a string. Examples -------- The model contains 2 genes: operon = {0, 1, 2} mucuB = {0, 1} >>> graph._transform_state_to_string({...
python
def _transform_state_to_string(self, state: State) -> str: """ Private method which transform a state to a string. Examples -------- The model contains 2 genes: operon = {0, 1, 2} mucuB = {0, 1} >>> graph._transform_state_to_string({...
[ "def", "_transform_state_to_string", "(", "self", ",", "state", ":", "State", ")", "->", "str", ":", "return", "''", ".", "join", "(", "str", "(", "state", "[", "gene", "]", ")", "for", "gene", "in", "self", ".", "model", ".", "genes", ")" ]
Private method which transform a state to a string. Examples -------- The model contains 2 genes: operon = {0, 1, 2} mucuB = {0, 1} >>> graph._transform_state_to_string({operon: 1, mucuB: 0}) "10" >>> graph._transform_state_to_string...
[ "Private", "method", "which", "transform", "a", "state", "to", "a", "string", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/ggea/ggea.py#L35-L51
train
clement-alexandre/TotemBionet
totembionet/src/ggea/ggea.py
Graph.as_dot
def as_dot(self) -> str: """ Return as a string the dot version of the graph. """ return nx.drawing.nx_pydot.to_pydot(self._graph).to_string()
python
def as_dot(self) -> str: """ Return as a string the dot version of the graph. """ return nx.drawing.nx_pydot.to_pydot(self._graph).to_string()
[ "def", "as_dot", "(", "self", ")", "->", "str", ":", "return", "nx", ".", "drawing", ".", "nx_pydot", ".", "to_pydot", "(", "self", ".", "_graph", ")", ".", "to_string", "(", ")" ]
Return as a string the dot version of the graph.
[ "Return", "as", "a", "string", "the", "dot", "version", "of", "the", "graph", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/ggea/ggea.py#L65-L67
train
clement-alexandre/TotemBionet
totembionet/src/ggea/ggea.py
Graph.export_to_dot
def export_to_dot(self, filename: str = 'output') -> None: """ Export the graph to the dot file "filename.dot". """ with open(filename + '.dot', 'w') as output: output.write(self.as_dot())
python
def export_to_dot(self, filename: str = 'output') -> None: """ Export the graph to the dot file "filename.dot". """ with open(filename + '.dot', 'w') as output: output.write(self.as_dot())
[ "def", "export_to_dot", "(", "self", ",", "filename", ":", "str", "=", "'output'", ")", "->", "None", ":", "with", "open", "(", "filename", "+", "'.dot'", ",", "'w'", ")", "as", "output", ":", "output", ".", "write", "(", "self", ".", "as_dot", "(", ...
Export the graph to the dot file "filename.dot".
[ "Export", "the", "graph", "to", "the", "dot", "file", "filename", ".", "dot", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/ggea/ggea.py#L69-L72
train
speechinformaticslab/vfclust
vfclust/vfclust.py
get_duration_measures
def get_duration_measures(source_file_path, output_path=None, phonemic=False, semantic=False, quiet=False, similarity_file = None, threshold = None): """Parses ...
python
def get_duration_measures(source_file_path, output_path=None, phonemic=False, semantic=False, quiet=False, similarity_file = None, threshold = None): """Parses ...
[ "def", "get_duration_measures", "(", "source_file_path", ",", "output_path", "=", "None", ",", "phonemic", "=", "False", ",", "semantic", "=", "False", ",", "quiet", "=", "False", ",", "similarity_file", "=", "None", ",", "threshold", "=", "None", ")", ":", ...
Parses input arguments and runs clustering algorithm. :param source_file_path: Required. Location of the .csv or .TextGrid file to be analyzed. :param output_path: Path to which to write the resultant csv file. If left None, path will be set to the source_file_path. If set to False, no file wi...
[ "Parses", "input", "arguments", "and", "runs", "clustering", "algorithm", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1597-L1666
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.create_from_textgrid
def create_from_textgrid(self,word_list): """ Fills the ParsedResponse object with a list of TextGrid.Word objects originally from a .TextGrid file. :param list word_list: List of TextGrid.Word objects corresponding to words/tokens in the subject response. Modifies: - self.timing_i...
python
def create_from_textgrid(self,word_list): """ Fills the ParsedResponse object with a list of TextGrid.Word objects originally from a .TextGrid file. :param list word_list: List of TextGrid.Word objects corresponding to words/tokens in the subject response. Modifies: - self.timing_i...
[ "def", "create_from_textgrid", "(", "self", ",", "word_list", ")", ":", "self", ".", "timing_included", "=", "True", "for", "i", ",", "entry", "in", "enumerate", "(", "word_list", ")", ":", "self", ".", "unit_list", ".", "append", "(", "Unit", "(", "entr...
Fills the ParsedResponse object with a list of TextGrid.Word objects originally from a .TextGrid file. :param list word_list: List of TextGrid.Word objects corresponding to words/tokens in the subject response. Modifies: - self.timing_included: TextGrid files include timing information ...
[ "Fills", "the", "ParsedResponse", "object", "with", "a", "list", "of", "TextGrid", ".", "Word", "objects", "originally", "from", "a", ".", "TextGrid", "file", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L191-L211
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.lemmatize
def lemmatize(self): """Lemmatize all Units in self.unit_list. Modifies: - self.unit_list: converts the .text property into its lemmatized form. This method lemmatizes all inflected variants of permissible words to those words' respective canonical forms. This is done to en...
python
def lemmatize(self): """Lemmatize all Units in self.unit_list. Modifies: - self.unit_list: converts the .text property into its lemmatized form. This method lemmatizes all inflected variants of permissible words to those words' respective canonical forms. This is done to en...
[ "def", "lemmatize", "(", "self", ")", ":", "for", "unit", "in", "self", ".", "unit_list", ":", "if", "lemmatizer", ".", "lemmatize", "(", "unit", ".", "text", ")", "in", "self", ".", "lemmas", ":", "unit", ".", "text", "=", "lemmatizer", ".", "lemmat...
Lemmatize all Units in self.unit_list. Modifies: - self.unit_list: converts the .text property into its lemmatized form. This method lemmatizes all inflected variants of permissible words to those words' respective canonical forms. This is done to ensure that each instance ...
[ "Lemmatize", "all", "Units", "in", "self", ".", "unit_list", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L213-L229
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.tokenize
def tokenize(self): """Tokenizes all multiword names in the list of Units. Modifies: - (indirectly) self.unit_list, by combining words into compound words. This is done because many names may be composed of multiple words, e.g., 'grizzly bear'. In order to count the number ...
python
def tokenize(self): """Tokenizes all multiword names in the list of Units. Modifies: - (indirectly) self.unit_list, by combining words into compound words. This is done because many names may be composed of multiple words, e.g., 'grizzly bear'. In order to count the number ...
[ "def", "tokenize", "(", "self", ")", ":", "if", "not", "self", ".", "quiet", ":", "print", "print", "\"Finding compound words...\"", "compound_word_dict", "=", "{", "}", "for", "compound_length", "in", "range", "(", "5", ",", "1", ",", "-", "1", ")", ":"...
Tokenizes all multiword names in the list of Units. Modifies: - (indirectly) self.unit_list, by combining words into compound words. This is done because many names may be composed of multiple words, e.g., 'grizzly bear'. In order to count the number of permissible words ge...
[ "Tokenizes", "all", "multiword", "names", "in", "the", "list", "of", "Units", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L232-L273
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.make_compound_word
def make_compound_word(self, start_index, how_many): """Combines two Units in self.unit_list to make a compound word token. :param int start_index: Index of first Unit in self.unit_list to be combined :param int how_many: Index of how many Units in self.unit_list to be combined. Modifi...
python
def make_compound_word(self, start_index, how_many): """Combines two Units in self.unit_list to make a compound word token. :param int start_index: Index of first Unit in self.unit_list to be combined :param int how_many: Index of how many Units in self.unit_list to be combined. Modifi...
[ "def", "make_compound_word", "(", "self", ",", "start_index", ",", "how_many", ")", ":", "if", "not", "self", ".", "quiet", ":", "compound_word", "=", "\"\"", "for", "word", "in", "self", ".", "unit_list", "[", "start_index", ":", "start_index", "+", "how_...
Combines two Units in self.unit_list to make a compound word token. :param int start_index: Index of first Unit in self.unit_list to be combined :param int how_many: Index of how many Units in self.unit_list to be combined. Modifies: - self.unit_list: Modifies the Unit correspo...
[ "Combines", "two", "Units", "in", "self", ".", "unit_list", "to", "make", "a", "compound", "word", "token", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L275-L310
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.remove_unit
def remove_unit(self, index): '''Removes the unit at the given index in self.unit_list. Does not modify any other units.''' if not self.quiet: print "Removing", self.unit_list[index].text self.unit_list.pop(index)
python
def remove_unit(self, index): '''Removes the unit at the given index in self.unit_list. Does not modify any other units.''' if not self.quiet: print "Removing", self.unit_list[index].text self.unit_list.pop(index)
[ "def", "remove_unit", "(", "self", ",", "index", ")", ":", "if", "not", "self", ".", "quiet", ":", "print", "\"Removing\"", ",", "self", ".", "unit_list", "[", "index", "]", ".", "text", "self", ".", "unit_list", ".", "pop", "(", "index", ")" ]
Removes the unit at the given index in self.unit_list. Does not modify any other units.
[ "Removes", "the", "unit", "at", "the", "given", "index", "in", "self", ".", "unit_list", ".", "Does", "not", "modify", "any", "other", "units", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L312-L316
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.combine_same_stem_units
def combine_same_stem_units(self, index): """Combines adjacent words with the same stem into a single unit. :param int index: Index of Unit in self.unit_list to be combined with the subsequent Unit. Modifies: - self.unit_list: Modifies the .original_text property of...
python
def combine_same_stem_units(self, index): """Combines adjacent words with the same stem into a single unit. :param int index: Index of Unit in self.unit_list to be combined with the subsequent Unit. Modifies: - self.unit_list: Modifies the .original_text property of...
[ "def", "combine_same_stem_units", "(", "self", ",", "index", ")", ":", "if", "not", "self", ".", "quiet", ":", "combined_word", "=", "\"\"", "for", "word", "in", "self", ".", "unit_list", "[", "index", ":", "index", "+", "2", "]", ":", "for", "original...
Combines adjacent words with the same stem into a single unit. :param int index: Index of Unit in self.unit_list to be combined with the subsequent Unit. Modifies: - self.unit_list: Modifies the .original_text property of the Unit corresponding to the in...
[ "Combines", "adjacent", "words", "with", "the", "same", "stem", "into", "a", "single", "unit", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L318-L347
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.display
def display(self): """Pretty-prints the ParsedResponse to the screen.""" table_list = [] table_list.append(("Text","Orig. Text","Start time","End time", "Phonetic")) for unit in self.unit_list: table_list.append((unit.text, "/".join(unit.origin...
python
def display(self): """Pretty-prints the ParsedResponse to the screen.""" table_list = [] table_list.append(("Text","Orig. Text","Start time","End time", "Phonetic")) for unit in self.unit_list: table_list.append((unit.text, "/".join(unit.origin...
[ "def", "display", "(", "self", ")", ":", "table_list", "=", "[", "]", "table_list", ".", "append", "(", "(", "\"Text\"", ",", "\"Orig. Text\"", ",", "\"Start time\"", ",", "\"End time\"", ",", "\"Phonetic\"", ")", ")", "for", "unit", "in", "self", ".", "...
Pretty-prints the ParsedResponse to the screen.
[ "Pretty", "-", "prints", "the", "ParsedResponse", "to", "the", "screen", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L350-L361
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.generate_phonetic_representation
def generate_phonetic_representation(self, word): """ Returns a generated phonetic representation for a word. :param str word: a word to be phoneticized. :return: A list of phonemes representing the phoneticized word. This method is used for words for which there is no pronunic...
python
def generate_phonetic_representation(self, word): """ Returns a generated phonetic representation for a word. :param str word: a word to be phoneticized. :return: A list of phonemes representing the phoneticized word. This method is used for words for which there is no pronunic...
[ "def", "generate_phonetic_representation", "(", "self", ",", "word", ")", ":", "with", "NamedTemporaryFile", "(", ")", "as", "temp_file", ":", "temp_file", ".", "write", "(", "word", ")", "t2pargs", "=", "[", "os", ".", "path", ".", "abspath", "(", "os", ...
Returns a generated phonetic representation for a word. :param str word: a word to be phoneticized. :return: A list of phonemes representing the phoneticized word. This method is used for words for which there is no pronunication entry in the CMU dictionary. The function generates a ...
[ "Returns", "a", "generated", "phonetic", "representation", "for", "a", "word", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L363-L392
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.modify_phonetic_representation
def modify_phonetic_representation(self, phonetic_representation): """ Returns a compact phonetic representation given a CMUdict-formatted representation. :param list phonetic_representation: a phonetic representation in standard CMUdict formatting, i.e. a list of phonemes like ['HH', 'EH0'...
python
def modify_phonetic_representation(self, phonetic_representation): """ Returns a compact phonetic representation given a CMUdict-formatted representation. :param list phonetic_representation: a phonetic representation in standard CMUdict formatting, i.e. a list of phonemes like ['HH', 'EH0'...
[ "def", "modify_phonetic_representation", "(", "self", ",", "phonetic_representation", ")", ":", "for", "i", "in", "range", "(", "len", "(", "phonetic_representation", ")", ")", ":", "phonetic_representation", "[", "i", "]", "=", "re", ".", "sub", "(", "'\\d+'"...
Returns a compact phonetic representation given a CMUdict-formatted representation. :param list phonetic_representation: a phonetic representation in standard CMUdict formatting, i.e. a list of phonemes like ['HH', 'EH0', 'L', 'OW1'] :returns: A string representing a custom phonetic represe...
[ "Returns", "a", "compact", "phonetic", "representation", "given", "a", "CMUdict", "-", "formatted", "representation", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L394-L424
train
speechinformaticslab/vfclust
vfclust/vfclust.py
ParsedResponse.clean
def clean(self): """ Removes any Units that are not applicable given the current semantic or phonetic category. Modifies: - self.unit_list: Removes Units from this list that do not fit into the clustering category. it does by by either combining units to make compound words,...
python
def clean(self): """ Removes any Units that are not applicable given the current semantic or phonetic category. Modifies: - self.unit_list: Removes Units from this list that do not fit into the clustering category. it does by by either combining units to make compound words,...
[ "def", "clean", "(", "self", ")", ":", "if", "not", "self", ".", "quiet", ":", "print", "print", "\"Preprocessing input...\"", "print", "\"Raw response:\"", "print", "self", ".", "display", "(", ")", "if", "not", "self", ".", "quiet", ":", "print", "print"...
Removes any Units that are not applicable given the current semantic or phonetic category. Modifies: - self.unit_list: Removes Units from this list that do not fit into the clustering category. it does by by either combining units to make compound words, combining units with the ...
[ "Removes", "any", "Units", "that", "are", "not", "applicable", "given", "the", "current", "semantic", "or", "phonetic", "category", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L426-L504
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.load_lsa_information
def load_lsa_information(self): """Loads a dictionary from disk that maps permissible words to their LSA term vectors.""" if not (49 < int(self.clustering_parameter) < 101): raise Exception('Only LSA dimensionalities in the range 50-100' + ' are supported.') ...
python
def load_lsa_information(self): """Loads a dictionary from disk that maps permissible words to their LSA term vectors.""" if not (49 < int(self.clustering_parameter) < 101): raise Exception('Only LSA dimensionalities in the range 50-100' + ' are supported.') ...
[ "def", "load_lsa_information", "(", "self", ")", ":", "if", "not", "(", "49", "<", "int", "(", "self", ".", "clustering_parameter", ")", "<", "101", ")", ":", "raise", "Exception", "(", "'Only LSA dimensionalities in the range 50-100'", "+", "' are supported.'", ...
Loads a dictionary from disk that maps permissible words to their LSA term vectors.
[ "Loads", "a", "dictionary", "from", "disk", "that", "maps", "permissible", "words", "to", "their", "LSA", "term", "vectors", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L766-L780
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.get_similarity_measures
def get_similarity_measures(self): """Helper function for computing similarity measures.""" if not self.quiet: print print "Computing", self.current_similarity_measure, "similarity..." self.compute_similarity_scores()
python
def get_similarity_measures(self): """Helper function for computing similarity measures.""" if not self.quiet: print print "Computing", self.current_similarity_measure, "similarity..." self.compute_similarity_scores()
[ "def", "get_similarity_measures", "(", "self", ")", ":", "if", "not", "self", ".", "quiet", ":", "print", "print", "\"Computing\"", ",", "self", ".", "current_similarity_measure", ",", "\"similarity...\"", "self", ".", "compute_similarity_scores", "(", ")" ]
Helper function for computing similarity measures.
[ "Helper", "function", "for", "computing", "similarity", "measures", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L783-L789
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.get_raw_counts
def get_raw_counts(self): """Determines counts for unique words, repetitions, etc using the raw text response. Adds the following measures to the self.measures dictionary: - COUNT_total_words: count of words (i.e. utterances with semantic content) spoken by the subject. Fill...
python
def get_raw_counts(self): """Determines counts for unique words, repetitions, etc using the raw text response. Adds the following measures to the self.measures dictionary: - COUNT_total_words: count of words (i.e. utterances with semantic content) spoken by the subject. Fill...
[ "def", "get_raw_counts", "(", "self", ")", ":", "words", "=", "[", "]", "labels", "=", "[", "]", "words_said", "=", "set", "(", ")", "for", "unit", "in", "self", ".", "parsed_response", ":", "word", "=", "unit", ".", "text", "test", "=", "False", "...
Determines counts for unique words, repetitions, etc using the raw text response. Adds the following measures to the self.measures dictionary: - COUNT_total_words: count of words (i.e. utterances with semantic content) spoken by the subject. Filled pauses, silences, coughs, breaths,...
[ "Determines", "counts", "for", "unique", "words", "repetitions", "etc", "using", "the", "raw", "text", "response", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L836-L934
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_similarity_score
def compute_similarity_score(self, unit1, unit2): """ Returns the similarity score between two words. The type of similarity scoring method used depends on the currently active method and clustering type. :param unit1: Unit object corresponding to the first word. :type unit1:...
python
def compute_similarity_score(self, unit1, unit2): """ Returns the similarity score between two words. The type of similarity scoring method used depends on the currently active method and clustering type. :param unit1: Unit object corresponding to the first word. :type unit1:...
[ "def", "compute_similarity_score", "(", "self", ",", "unit1", ",", "unit2", ")", ":", "if", "self", ".", "type", "==", "\"PHONETIC\"", ":", "word1", "=", "unit1", ".", "phonetic_representation", "word2", "=", "unit2", ".", "phonetic_representation", "if", "sel...
Returns the similarity score between two words. The type of similarity scoring method used depends on the currently active method and clustering type. :param unit1: Unit object corresponding to the first word. :type unit1: Unit :param unit2: Unit object corresponding to the s...
[ "Returns", "the", "similarity", "score", "between", "two", "words", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L943-L1042
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_similarity_scores
def compute_similarity_scores(self): """ Produce a list of similarity scores for each contiguous pair in a response. Calls compute_similarity_score method for every adjacent pair of words. The results are not used in clustering; this is merely to provide a visual representation to print...
python
def compute_similarity_scores(self): """ Produce a list of similarity scores for each contiguous pair in a response. Calls compute_similarity_score method for every adjacent pair of words. The results are not used in clustering; this is merely to provide a visual representation to print...
[ "def", "compute_similarity_scores", "(", "self", ")", ":", "for", "i", ",", "unit", "in", "enumerate", "(", "self", ".", "parsed_response", ")", ":", "if", "i", "<", "len", "(", "self", ".", "parsed_response", ")", "-", "1", ":", "next_unit", "=", "sel...
Produce a list of similarity scores for each contiguous pair in a response. Calls compute_similarity_score method for every adjacent pair of words. The results are not used in clustering; this is merely to provide a visual representation to print to the screen. Modifies: - ...
[ "Produce", "a", "list", "of", "similarity", "scores", "for", "each", "contiguous", "pair", "in", "a", "response", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1044-L1067
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_pairwise_similarity_score
def compute_pairwise_similarity_score(self): """Computes the average pairwise similarity score between all pairs of Units. The pairwise similarity is calculated as the sum of similarity scores for all pairwise word pairs in a response -- except any pair composed of a word and itself -- ...
python
def compute_pairwise_similarity_score(self): """Computes the average pairwise similarity score between all pairs of Units. The pairwise similarity is calculated as the sum of similarity scores for all pairwise word pairs in a response -- except any pair composed of a word and itself -- ...
[ "def", "compute_pairwise_similarity_score", "(", "self", ")", ":", "pairs", "=", "[", "]", "all_scores", "=", "[", "]", "for", "i", ",", "unit", "in", "enumerate", "(", "self", ".", "parsed_response", ")", ":", "for", "j", ",", "other_unit", "in", "enume...
Computes the average pairwise similarity score between all pairs of Units. The pairwise similarity is calculated as the sum of similarity scores for all pairwise word pairs in a response -- except any pair composed of a word and itself -- divided by the total number of words in an attempt. I.e....
[ "Computes", "the", "average", "pairwise", "similarity", "score", "between", "all", "pairs", "of", "Units", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1231-L1261
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_collection_measures
def compute_collection_measures(self, no_singletons=False): """ Computes summaries of measures using the discovered collections. :param no_singletons: if True, omits collections of length 1 from all measures and includes "no_singletons_" in the measure name. Adds the following meas...
python
def compute_collection_measures(self, no_singletons=False): """ Computes summaries of measures using the discovered collections. :param no_singletons: if True, omits collections of length 1 from all measures and includes "no_singletons_" in the measure name. Adds the following meas...
[ "def", "compute_collection_measures", "(", "self", ",", "no_singletons", "=", "False", ")", ":", "prefix", "=", "\"COLLECTION_\"", "+", "self", ".", "current_similarity_measure", "+", "\"_\"", "+", "self", ".", "current_collection_type", "+", "\"_\"", "if", "no_si...
Computes summaries of measures using the discovered collections. :param no_singletons: if True, omits collections of length 1 from all measures and includes "no_singletons_" in the measure name. Adds the following measures to the self.measures dictionary, prefaced by COLLECTION_(si...
[ "Computes", "summaries", "of", "measures", "using", "the", "discovered", "collections", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1264-L1296
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_duration_measures
def compute_duration_measures(self): """ Helper function for computing measures derived from timing information. These are only computed if the response is textgrid with timing information. All times are in seconds. """ prefix = "TIMING_" + self.current_similarity_measure + "_...
python
def compute_duration_measures(self): """ Helper function for computing measures derived from timing information. These are only computed if the response is textgrid with timing information. All times are in seconds. """ prefix = "TIMING_" + self.current_similarity_measure + "_...
[ "def", "compute_duration_measures", "(", "self", ")", ":", "prefix", "=", "\"TIMING_\"", "+", "self", ".", "current_similarity_measure", "+", "\"_\"", "+", "self", ".", "current_collection_type", "+", "\"_\"", "if", "self", ".", "response_format", "==", "'TextGrid...
Helper function for computing measures derived from timing information. These are only computed if the response is textgrid with timing information. All times are in seconds.
[ "Helper", "function", "for", "computing", "measures", "derived", "from", "timing", "information", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1305-L1326
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_response_vowel_duration
def compute_response_vowel_duration(self, prefix): """Computes mean vowel duration in entire response. :param str prefix: Prefix for the key entry in self.measures. Adds the following measures to the self.measures dictionary: - TIMING_(similarity_measure)_(collection_type)_response...
python
def compute_response_vowel_duration(self, prefix): """Computes mean vowel duration in entire response. :param str prefix: Prefix for the key entry in self.measures. Adds the following measures to the self.measures dictionary: - TIMING_(similarity_measure)_(collection_type)_response...
[ "def", "compute_response_vowel_duration", "(", "self", ",", "prefix", ")", ":", "durations", "=", "[", "]", "for", "word", "in", "self", ".", "full_timed_response", ":", "if", "word", ".", "phones", ":", "for", "phone", "in", "word", ".", "phones", ":", ...
Computes mean vowel duration in entire response. :param str prefix: Prefix for the key entry in self.measures. Adds the following measures to the self.measures dictionary: - TIMING_(similarity_measure)_(collection_type)_response_vowel_duration_mean: average vowel duration o...
[ "Computes", "mean", "vowel", "duration", "in", "entire", "response", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1329-L1349
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_between_collection_interval_duration
def compute_between_collection_interval_duration(self, prefix): """Calculates BETWEEN-collection intervals for the current collection and measure type and takes their mean. :param str prefix: Prefix for the key entry in self.measures. Negative intervals (for overlapping clusters) a...
python
def compute_between_collection_interval_duration(self, prefix): """Calculates BETWEEN-collection intervals for the current collection and measure type and takes their mean. :param str prefix: Prefix for the key entry in self.measures. Negative intervals (for overlapping clusters) a...
[ "def", "compute_between_collection_interval_duration", "(", "self", ",", "prefix", ")", ":", "durations", "=", "[", "]", "for", "collection", "in", "self", ".", "collection_list", ":", "start", "=", "collection", "[", "0", "]", ".", "start_time", "end", "=", ...
Calculates BETWEEN-collection intervals for the current collection and measure type and takes their mean. :param str prefix: Prefix for the key entry in self.measures. Negative intervals (for overlapping clusters) are counted as 0 seconds. Intervals are calculated as being the dif...
[ "Calculates", "BETWEEN", "-", "collection", "intervals", "for", "the", "current", "collection", "and", "measure", "type", "and", "takes", "their", "mean", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1377-L1425
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_within_collection_interval_duration
def compute_within_collection_interval_duration(self, prefix): """Calculates mean between-word duration WITHIN collections. :param str prefix: Prefix for the key entry in self.measures. Calculates the mean time between the end of each word in the collection and the beginning of the nex...
python
def compute_within_collection_interval_duration(self, prefix): """Calculates mean between-word duration WITHIN collections. :param str prefix: Prefix for the key entry in self.measures. Calculates the mean time between the end of each word in the collection and the beginning of the nex...
[ "def", "compute_within_collection_interval_duration", "(", "self", ",", "prefix", ")", ":", "interstices", "=", "[", "]", "for", "cluster", "in", "self", ".", "collection_list", ":", "if", "len", "(", "cluster", ")", ">", "1", ":", "for", "i", "in", "range...
Calculates mean between-word duration WITHIN collections. :param str prefix: Prefix for the key entry in self.measures. Calculates the mean time between the end of each word in the collection and the beginning of the next word. Note that these times do not necessarily reflect pauses, ...
[ "Calculates", "mean", "between", "-", "word", "duration", "WITHIN", "collections", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1430-L1457
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.compute_within_collection_vowel_duration
def compute_within_collection_vowel_duration(self, prefix, no_singletons=False): """ Computes the mean duration of vowels from Units within clusters. :param str prefix: Prefix for the key entry in self.measures :param bool no_singletons: If False, excludes collections of length 1 from calculati...
python
def compute_within_collection_vowel_duration(self, prefix, no_singletons=False): """ Computes the mean duration of vowels from Units within clusters. :param str prefix: Prefix for the key entry in self.measures :param bool no_singletons: If False, excludes collections of length 1 from calculati...
[ "def", "compute_within_collection_vowel_duration", "(", "self", ",", "prefix", ",", "no_singletons", "=", "False", ")", ":", "if", "no_singletons", ":", "min_size", "=", "2", "else", ":", "prefix", "+=", "\"no_singletons_\"", "min_size", "=", "1", "durations", "...
Computes the mean duration of vowels from Units within clusters. :param str prefix: Prefix for the key entry in self.measures :param bool no_singletons: If False, excludes collections of length 1 from calculations and adds "no_singletons" to the prefix Adds the following measures t...
[ "Computes", "the", "mean", "duration", "of", "vowels", "from", "Units", "within", "clusters", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1461-L1498
train
speechinformaticslab/vfclust
vfclust/vfclust.py
VFClustEngine.print_output
def print_output(self): """ Outputs final list of measures to screen a csv file. The .csv file created has the same name as the input file, with "vfclust_TYPE_CATEGORY" appended to the filename, where TYPE indicates the type of task performed done (SEMANTIC or PHONETIC) and CATEGORY ...
python
def print_output(self): """ Outputs final list of measures to screen a csv file. The .csv file created has the same name as the input file, with "vfclust_TYPE_CATEGORY" appended to the filename, where TYPE indicates the type of task performed done (SEMANTIC or PHONETIC) and CATEGORY ...
[ "def", "print_output", "(", "self", ")", ":", "if", "self", ".", "response_format", "==", "\"csv\"", ":", "for", "key", "in", "self", ".", "measures", ":", "if", "\"TIMING_\"", "in", "key", ":", "self", ".", "measures", "[", "key", "]", "=", "\"NA\"", ...
Outputs final list of measures to screen a csv file. The .csv file created has the same name as the input file, with "vfclust_TYPE_CATEGORY" appended to the filename, where TYPE indicates the type of task performed done (SEMANTIC or PHONETIC) and CATEGORY indicates the category requirem...
[ "Outputs", "final", "list", "of", "measures", "to", "screen", "a", "csv", "file", "." ]
7ca733dea4782c828024765726cce65de095d33c
https://github.com/speechinformaticslab/vfclust/blob/7ca733dea4782c828024765726cce65de095d33c/vfclust/vfclust.py#L1546-L1593
train
inveniosoftware/invenio-pidrelations
invenio_pidrelations/contrib/versioning.py
PIDNodeVersioning.insert_child
def insert_child(self, child_pid, index=-1): """Insert a Version child PID.""" if child_pid.status != PIDStatus.REGISTERED: raise PIDRelationConsistencyError( "Version PIDs should have status 'REGISTERED'. Use " "insert_draft_child to insert 'RESERVED' draft P...
python
def insert_child(self, child_pid, index=-1): """Insert a Version child PID.""" if child_pid.status != PIDStatus.REGISTERED: raise PIDRelationConsistencyError( "Version PIDs should have status 'REGISTERED'. Use " "insert_draft_child to insert 'RESERVED' draft P...
[ "def", "insert_child", "(", "self", ",", "child_pid", ",", "index", "=", "-", "1", ")", ":", "if", "child_pid", ".", "status", "!=", "PIDStatus", ".", "REGISTERED", ":", "raise", "PIDRelationConsistencyError", "(", "\"Version PIDs should have status 'REGISTERED'. Us...
Insert a Version child PID.
[ "Insert", "a", "Version", "child", "PID", "." ]
a49f3725cf595b663c5b04814280b231f88bc333
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/contrib/versioning.py#L79-L92
train
inveniosoftware/invenio-pidrelations
invenio_pidrelations/contrib/versioning.py
PIDNodeVersioning.remove_child
def remove_child(self, child_pid): """Remove a Version child PID. Extends the base method call by redirecting from the parent to the last child. """ if child_pid.status == PIDStatus.RESERVED: raise PIDRelationConsistencyError( "Version PIDs should not...
python
def remove_child(self, child_pid): """Remove a Version child PID. Extends the base method call by redirecting from the parent to the last child. """ if child_pid.status == PIDStatus.RESERVED: raise PIDRelationConsistencyError( "Version PIDs should not...
[ "def", "remove_child", "(", "self", ",", "child_pid", ")", ":", "if", "child_pid", ".", "status", "==", "PIDStatus", ".", "RESERVED", ":", "raise", "PIDRelationConsistencyError", "(", "\"Version PIDs should not have status 'RESERVED'. Use \"", "\"remove_draft_child to remov...
Remove a Version child PID. Extends the base method call by redirecting from the parent to the last child.
[ "Remove", "a", "Version", "child", "PID", "." ]
a49f3725cf595b663c5b04814280b231f88bc333
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/contrib/versioning.py#L94-L107
train
inveniosoftware/invenio-pidrelations
invenio_pidrelations/contrib/versioning.py
PIDNodeVersioning.insert_draft_child
def insert_draft_child(self, child_pid): """Insert a draft child to versioning.""" if child_pid.status != PIDStatus.RESERVED: raise PIDRelationConsistencyError( "Draft child should have status 'RESERVED'") if not self.draft_child: with db.session.begin_ne...
python
def insert_draft_child(self, child_pid): """Insert a draft child to versioning.""" if child_pid.status != PIDStatus.RESERVED: raise PIDRelationConsistencyError( "Draft child should have status 'RESERVED'") if not self.draft_child: with db.session.begin_ne...
[ "def", "insert_draft_child", "(", "self", ",", "child_pid", ")", ":", "if", "child_pid", ".", "status", "!=", "PIDStatus", ".", "RESERVED", ":", "raise", "PIDRelationConsistencyError", "(", "\"Draft child should have status 'RESERVED'\"", ")", "if", "not", "self", "...
Insert a draft child to versioning.
[ "Insert", "a", "draft", "child", "to", "versioning", "." ]
a49f3725cf595b663c5b04814280b231f88bc333
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/contrib/versioning.py#L127-L140
train
inveniosoftware/invenio-pidrelations
invenio_pidrelations/contrib/versioning.py
PIDNodeVersioning.remove_draft_child
def remove_draft_child(self): """Remove the draft child from versioning.""" if self.draft_child: with db.session.begin_nested(): super(PIDNodeVersioning, self).remove_child(self.draft_child, reorder=True)
python
def remove_draft_child(self): """Remove the draft child from versioning.""" if self.draft_child: with db.session.begin_nested(): super(PIDNodeVersioning, self).remove_child(self.draft_child, reorder=True)
[ "def", "remove_draft_child", "(", "self", ")", ":", "if", "self", ".", "draft_child", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "super", "(", "PIDNodeVersioning", ",", "self", ")", ".", "remove_child", "(", "self", ".", "draf...
Remove the draft child from versioning.
[ "Remove", "the", "draft", "child", "from", "versioning", "." ]
a49f3725cf595b663c5b04814280b231f88bc333
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/contrib/versioning.py#L142-L147
train
inveniosoftware/invenio-pidrelations
invenio_pidrelations/contrib/versioning.py
PIDNodeVersioning.update_redirect
def update_redirect(self): """Update the parent redirect to the current last child. This method should be called on the parent PID node. Use this method when the status of a PID changed (ex: draft changed from RESERVED to REGISTERED) """ if self.last_child: ...
python
def update_redirect(self): """Update the parent redirect to the current last child. This method should be called on the parent PID node. Use this method when the status of a PID changed (ex: draft changed from RESERVED to REGISTERED) """ if self.last_child: ...
[ "def", "update_redirect", "(", "self", ")", ":", "if", "self", ".", "last_child", ":", "self", ".", "_resolved_pid", ".", "redirect", "(", "self", ".", "last_child", ")", "elif", "any", "(", "map", "(", "lambda", "pid", ":", "pid", ".", "status", "not"...
Update the parent redirect to the current last child. This method should be called on the parent PID node. Use this method when the status of a PID changed (ex: draft changed from RESERVED to REGISTERED)
[ "Update", "the", "parent", "redirect", "to", "the", "current", "last", "child", "." ]
a49f3725cf595b663c5b04814280b231f88bc333
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/contrib/versioning.py#L149-L166
train
adaptive-learning/proso-apps
proso_feedback/views.py
feedback
def feedback(request): """ Send feedback to the authors of the system. GET parameters: html turn on the HTML version of the API POST parameters (JSON): text: the main feedback content email (optional): user's e-mail username (optional...
python
def feedback(request): """ Send feedback to the authors of the system. GET parameters: html turn on the HTML version of the API POST parameters (JSON): text: the main feedback content email (optional): user's e-mail username (optional...
[ "def", "feedback", "(", "request", ")", ":", "if", "request", ".", "method", "==", "'GET'", ":", "return", "render", "(", "request", ",", "'feedback_feedback.html'", ",", "{", "}", ",", "help_text", "=", "feedback", ".", "__doc__", ")", "if", "request", ...
Send feedback to the authors of the system. GET parameters: html turn on the HTML version of the API POST parameters (JSON): text: the main feedback content email (optional): user's e-mail username (optional): user's name
[ "Send", "feedback", "to", "the", "authors", "of", "the", "system", "." ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_feedback/views.py#L23-L79
train
adaptive-learning/proso-apps
proso_feedback/views.py
rating
def rating(request): """ Rate the current practice. GET parameters: html turn on the HTML version of the API POST parameters (JSON): value: one of the following numbers (how difficult questions are?): (1) too easy, (2) appropriate...
python
def rating(request): """ Rate the current practice. GET parameters: html turn on the HTML version of the API POST parameters (JSON): value: one of the following numbers (how difficult questions are?): (1) too easy, (2) appropriate...
[ "def", "rating", "(", "request", ")", ":", "if", "request", ".", "method", "==", "'GET'", ":", "return", "render", "(", "request", ",", "'feedback_rating.html'", ",", "{", "}", ",", "help_text", "=", "rating", ".", "__doc__", ")", "if", "request", ".", ...
Rate the current practice. GET parameters: html turn on the HTML version of the API POST parameters (JSON): value: one of the following numbers (how difficult questions are?): (1) too easy, (2) appropriate, (3) too difficu...
[ "Rate", "the", "current", "practice", "." ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_feedback/views.py#L83-L121
train
projectshift/shift-boiler
boiler/cli/colors.py
colour
def colour(colour, message, bold=False): """ Color a message """ return style(fg=colour, text=message, bold=bold)
python
def colour(colour, message, bold=False): """ Color a message """ return style(fg=colour, text=message, bold=bold)
[ "def", "colour", "(", "colour", ",", "message", ",", "bold", "=", "False", ")", ":", "return", "style", "(", "fg", "=", "colour", ",", "text", "=", "message", ",", "bold", "=", "bold", ")" ]
Color a message
[ "Color", "a", "message" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/cli/colors.py#L4-L6
train
kata198/QueryableList
QueryableList/Base.py
QueryableListBase.customFilter
def customFilter(self, filterFunc): ''' customFilter - Apply a custom filter to elements and return a QueryableList of matches @param filterFunc <lambda/function< - A lambda/function that is passed an item, and returns True if the item matches (will be returned), otherwis...
python
def customFilter(self, filterFunc): ''' customFilter - Apply a custom filter to elements and return a QueryableList of matches @param filterFunc <lambda/function< - A lambda/function that is passed an item, and returns True if the item matches (will be returned), otherwis...
[ "def", "customFilter", "(", "self", ",", "filterFunc", ")", ":", "ret", "=", "self", ".", "__class__", "(", ")", "for", "item", "in", "self", ":", "if", "filterFunc", "(", "item", ")", ":", "ret", ".", "append", "(", "item", ")", "return", "ret" ]
customFilter - Apply a custom filter to elements and return a QueryableList of matches @param filterFunc <lambda/function< - A lambda/function that is passed an item, and returns True if the item matches (will be returned), otherwise False. @return - A QueryableList object of th...
[ "customFilter", "-", "Apply", "a", "custom", "filter", "to", "elements", "and", "return", "a", "QueryableList", "of", "matches" ]
279286d46205ce8268af42e03b75820a7483fddb
https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Base.py#L152-L166
train
kata198/QueryableList
QueryableList/Base.py
QueryableListBase.sort_by
def sort_by(self, fieldName, reverse=False): ''' sort_by - Return a copy of this collection, sorted by the given fieldName. The fieldName is accessed the same way as other filtering, so it supports custom properties, etc. @param fieldName <str> - The name of the field o...
python
def sort_by(self, fieldName, reverse=False): ''' sort_by - Return a copy of this collection, sorted by the given fieldName. The fieldName is accessed the same way as other filtering, so it supports custom properties, etc. @param fieldName <str> - The name of the field o...
[ "def", "sort_by", "(", "self", ",", "fieldName", ",", "reverse", "=", "False", ")", ":", "return", "self", ".", "__class__", "(", "sorted", "(", "self", ",", "key", "=", "lambda", "item", ":", "self", ".", "_get_item_value", "(", "item", ",", "fieldNam...
sort_by - Return a copy of this collection, sorted by the given fieldName. The fieldName is accessed the same way as other filtering, so it supports custom properties, etc. @param fieldName <str> - The name of the field on which to sort by @param reverse <bool> Default False...
[ "sort_by", "-", "Return", "a", "copy", "of", "this", "collection", "sorted", "by", "the", "given", "fieldName", "." ]
279286d46205ce8268af42e03b75820a7483fddb
https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Base.py#L180-L194
train
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
Credential.uri
def uri(self): """ Return sqlalchemy connect string URI. """ return self.uri_template.format( host=self.host, port="" if self.port is None else self.port, database=self.database, username=self.username, password="" if self.passw...
python
def uri(self): """ Return sqlalchemy connect string URI. """ return self.uri_template.format( host=self.host, port="" if self.port is None else self.port, database=self.database, username=self.username, password="" if self.passw...
[ "def", "uri", "(", "self", ")", ":", "return", "self", ".", "uri_template", ".", "format", "(", "host", "=", "self", ".", "host", ",", "port", "=", "\"\"", "if", "self", ".", "port", "is", "None", "else", "self", ".", "port", ",", "database", "=", ...
Return sqlalchemy connect string URI.
[ "Return", "sqlalchemy", "connect", "string", "URI", "." ]
946754744c8870f083fd7b4339fca15d1d6128b2
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L46-L58
train
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
Credential.from_json
def from_json(cls, json_file, json_path=None, key_mapping=None): """ Load connection credential from json file. :param json_file: str, path to json file :param json_path: str, dot notation of the path to the credential dict. :param key_mapping: dict, map 'host', 'port', 'databas...
python
def from_json(cls, json_file, json_path=None, key_mapping=None): """ Load connection credential from json file. :param json_file: str, path to json file :param json_path: str, dot notation of the path to the credential dict. :param key_mapping: dict, map 'host', 'port', 'databas...
[ "def", "from_json", "(", "cls", ",", "json_file", ",", "json_path", "=", "None", ",", "key_mapping", "=", "None", ")", ":", "cls", ".", "_validate_key_mapping", "(", "key_mapping", ")", "with", "open", "(", "json_file", ",", "\"rb\"", ")", "as", "f", ":"...
Load connection credential from json file. :param json_file: str, path to json file :param json_path: str, dot notation of the path to the credential dict. :param key_mapping: dict, map 'host', 'port', 'database', 'username', 'password' to custom alias, for example ``{'host': 'h', '...
[ "Load", "connection", "credential", "from", "json", "file", "." ]
946754744c8870f083fd7b4339fca15d1d6128b2
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L86-L127
train
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
Credential.from_s3_json
def from_s3_json(cls, bucket_name, key, json_path=None, key_mapping=None, aws_profile=None, aws_access_key_id=None, aws_secret_access_key=None, region_name=None): # pragma: no cover """ Load databas...
python
def from_s3_json(cls, bucket_name, key, json_path=None, key_mapping=None, aws_profile=None, aws_access_key_id=None, aws_secret_access_key=None, region_name=None): # pragma: no cover """ Load databas...
[ "def", "from_s3_json", "(", "cls", ",", "bucket_name", ",", "key", ",", "json_path", "=", "None", ",", "key_mapping", "=", "None", ",", "aws_profile", "=", "None", ",", "aws_access_key_id", "=", "None", ",", "aws_secret_access_key", "=", "None", ",", "region...
Load database credential from json on s3. :param bucket_name: str :param key: str :param aws_profile: if None, assume that you are using this from AWS cloud. (service on the same cloud doesn't need profile name) :param aws_access_key_id: str, not recommend to use :pa...
[ "Load", "database", "credential", "from", "json", "on", "s3", "." ]
946754744c8870f083fd7b4339fca15d1d6128b2
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L159-L188
train
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
Credential.from_env
def from_env(cls, prefix, kms_decrypt=False, aws_profile=None): """ Load database credential from env variable. - host: ENV.{PREFIX}_HOST - port: ENV.{PREFIX}_PORT - database: ENV.{PREFIX}_DATABASE - username: ENV.{PREFIX}_USERNAME - password: ENV.{PREFIX}_PASSWO...
python
def from_env(cls, prefix, kms_decrypt=False, aws_profile=None): """ Load database credential from env variable. - host: ENV.{PREFIX}_HOST - port: ENV.{PREFIX}_PORT - database: ENV.{PREFIX}_DATABASE - username: ENV.{PREFIX}_USERNAME - password: ENV.{PREFIX}_PASSWO...
[ "def", "from_env", "(", "cls", ",", "prefix", ",", "kms_decrypt", "=", "False", ",", "aws_profile", "=", "None", ")", ":", "if", "len", "(", "prefix", ")", "<", "1", ":", "raise", "ValueError", "(", "\"prefix can't be empty\"", ")", "if", "len", "(", "...
Load database credential from env variable. - host: ENV.{PREFIX}_HOST - port: ENV.{PREFIX}_PORT - database: ENV.{PREFIX}_DATABASE - username: ENV.{PREFIX}_USERNAME - password: ENV.{PREFIX}_PASSWORD :param prefix: str :param kms_decrypt: bool :param aws_p...
[ "Load", "database", "credential", "from", "env", "variable", "." ]
946754744c8870f083fd7b4339fca15d1d6128b2
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L191-L241
train
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/credential.py
Credential.to_dict
def to_dict(self): """ Convert credentials into a dict. """ return dict( host=self.host, port=self.port, database=self.database, username=self.username, password=self.password, )
python
def to_dict(self): """ Convert credentials into a dict. """ return dict( host=self.host, port=self.port, database=self.database, username=self.username, password=self.password, )
[ "def", "to_dict", "(", "self", ")", ":", "return", "dict", "(", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ",", "database", "=", "self", ".", "database", ",", "username", "=", "self", ".", "username", ",", "password", ...
Convert credentials into a dict.
[ "Convert", "credentials", "into", "a", "dict", "." ]
946754744c8870f083fd7b4339fca15d1d6128b2
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/credential.py#L243-L253
train
gregoil/ipdbugger
ipdbugger/__init__.py
start_debugging
def start_debugging(): """Start a debugging session after catching an exception. This prints the traceback and start ipdb session in the frame of the error. """ exc_type, exc_value, exc_tb = sys.exc_info() # If the exception has been annotated to be re-raised, raise the exception if hasattr(ex...
python
def start_debugging(): """Start a debugging session after catching an exception. This prints the traceback and start ipdb session in the frame of the error. """ exc_type, exc_value, exc_tb = sys.exc_info() # If the exception has been annotated to be re-raised, raise the exception if hasattr(ex...
[ "def", "start_debugging", "(", ")", ":", "exc_type", ",", "exc_value", ",", "exc_tb", "=", "sys", ".", "exc_info", "(", ")", "if", "hasattr", "(", "exc_value", ",", "'_ipdbugger_let_raise'", ")", ":", "raise_", "(", "*", "sys", ".", "exc_info", "(", ")",...
Start a debugging session after catching an exception. This prints the traceback and start ipdb session in the frame of the error.
[ "Start", "a", "debugging", "session", "after", "catching", "an", "exception", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L85-L105
train
gregoil/ipdbugger
ipdbugger/__init__.py
get_last_lineno
def get_last_lineno(node): """Recursively find the last line number of the ast node.""" max_lineno = 0 if hasattr(node, "lineno"): max_lineno = node.lineno for _, field in ast.iter_fields(node): if isinstance(field, list): for value in field: if isinstance(v...
python
def get_last_lineno(node): """Recursively find the last line number of the ast node.""" max_lineno = 0 if hasattr(node, "lineno"): max_lineno = node.lineno for _, field in ast.iter_fields(node): if isinstance(field, list): for value in field: if isinstance(v...
[ "def", "get_last_lineno", "(", "node", ")", ":", "max_lineno", "=", "0", "if", "hasattr", "(", "node", ",", "\"lineno\"", ")", ":", "max_lineno", "=", "node", ".", "lineno", "for", "_", ",", "field", "in", "ast", ".", "iter_fields", "(", "node", ")", ...
Recursively find the last line number of the ast node.
[ "Recursively", "find", "the", "last", "line", "number", "of", "the", "ast", "node", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L271-L287
train
gregoil/ipdbugger
ipdbugger/__init__.py
IPDBugger.do_raise
def do_raise(self, arg): """Raise the last exception caught.""" self.do_continue(arg) # Annotating the exception for a continual re-raise _, exc_value, _ = self.exc_info exc_value._ipdbugger_let_raise = True raise_(*self.exc_info)
python
def do_raise(self, arg): """Raise the last exception caught.""" self.do_continue(arg) # Annotating the exception for a continual re-raise _, exc_value, _ = self.exc_info exc_value._ipdbugger_let_raise = True raise_(*self.exc_info)
[ "def", "do_raise", "(", "self", ",", "arg", ")", ":", "self", ".", "do_continue", "(", "arg", ")", "_", ",", "exc_value", ",", "_", "=", "self", ".", "exc_info", "exc_value", ".", "_ipdbugger_let_raise", "=", "True", "raise_", "(", "*", "self", ".", ...
Raise the last exception caught.
[ "Raise", "the", "last", "exception", "caught", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L48-L56
train
gregoil/ipdbugger
ipdbugger/__init__.py
IPDBugger.do_retry
def do_retry(self, arg): """Rerun the previous command.""" prev_line = self.curframe.f_lineno - 1 # Make sure not to jump to the middle of the previous statement while True: try: self.curframe.f_lineno = prev_line break except Valu...
python
def do_retry(self, arg): """Rerun the previous command.""" prev_line = self.curframe.f_lineno - 1 # Make sure not to jump to the middle of the previous statement while True: try: self.curframe.f_lineno = prev_line break except Valu...
[ "def", "do_retry", "(", "self", ",", "arg", ")", ":", "prev_line", "=", "self", ".", "curframe", ".", "f_lineno", "-", "1", "while", "True", ":", "try", ":", "self", ".", "curframe", ".", "f_lineno", "=", "prev_line", "break", "except", "ValueError", "...
Rerun the previous command.
[ "Rerun", "the", "previous", "command", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L58-L72
train
gregoil/ipdbugger
ipdbugger/__init__.py
IPDBugger.dispatch_line
def dispatch_line(self, frame): """Handle line action and return the next line callback.""" callback = TerminalPdb.dispatch_line(self, frame) # If the ipdb session ended, don't return a callback for the next line if self.stoplineno == -1: return None return callback
python
def dispatch_line(self, frame): """Handle line action and return the next line callback.""" callback = TerminalPdb.dispatch_line(self, frame) # If the ipdb session ended, don't return a callback for the next line if self.stoplineno == -1: return None return callback
[ "def", "dispatch_line", "(", "self", ",", "frame", ")", ":", "callback", "=", "TerminalPdb", ".", "dispatch_line", "(", "self", ",", "frame", ")", "if", "self", ".", "stoplineno", "==", "-", "1", ":", "return", "None", "return", "callback" ]
Handle line action and return the next line callback.
[ "Handle", "line", "action", "and", "return", "the", "next", "line", "callback", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L74-L82
train
gregoil/ipdbugger
ipdbugger/__init__.py
ErrorsCatchTransformer.wrap_with_try
def wrap_with_try(self, node): """Wrap an ast node in a 'try' node to enter debug on exception.""" handlers = [] if self.ignore_exceptions is None: handlers.append(ast.ExceptHandler(type=None, name=None, ...
python
def wrap_with_try(self, node): """Wrap an ast node in a 'try' node to enter debug on exception.""" handlers = [] if self.ignore_exceptions is None: handlers.append(ast.ExceptHandler(type=None, name=None, ...
[ "def", "wrap_with_try", "(", "self", ",", "node", ")", ":", "handlers", "=", "[", "]", "if", "self", ".", "ignore_exceptions", "is", "None", ":", "handlers", ".", "append", "(", "ast", ".", "ExceptHandler", "(", "type", "=", "None", ",", "name", "=", ...
Wrap an ast node in a 'try' node to enter debug on exception.
[ "Wrap", "an", "ast", "node", "in", "a", "try", "node", "to", "enter", "debug", "on", "exception", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L134-L175
train
gregoil/ipdbugger
ipdbugger/__init__.py
ErrorsCatchTransformer.try_except_handler
def try_except_handler(self, node): """Handler for try except statement to ignore excepted exceptions.""" # List all excepted exception's names excepted_types = [] for handler in node.handlers: if handler.type is None: excepted_types = None bre...
python
def try_except_handler(self, node): """Handler for try except statement to ignore excepted exceptions.""" # List all excepted exception's names excepted_types = [] for handler in node.handlers: if handler.type is None: excepted_types = None bre...
[ "def", "try_except_handler", "(", "self", ",", "node", ")", ":", "excepted_types", "=", "[", "]", "for", "handler", "in", "node", ".", "handlers", ":", "if", "handler", ".", "type", "is", "None", ":", "excepted_types", "=", "None", "break", "if", "isinst...
Handler for try except statement to ignore excepted exceptions.
[ "Handler", "for", "try", "except", "statement", "to", "ignore", "excepted", "exceptions", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L177-L210
train
gregoil/ipdbugger
ipdbugger/__init__.py
ErrorsCatchTransformer.visit_Call
def visit_Call(self, node): """Propagate 'debug' wrapper into inner function calls if needed. Args: node (ast.AST): node statement to surround. """ if self.depth == 0: return node if self.ignore_exceptions is None: ignore_exceptions = ast.Nam...
python
def visit_Call(self, node): """Propagate 'debug' wrapper into inner function calls if needed. Args: node (ast.AST): node statement to surround. """ if self.depth == 0: return node if self.ignore_exceptions is None: ignore_exceptions = ast.Nam...
[ "def", "visit_Call", "(", "self", ",", "node", ")", ":", "if", "self", ".", "depth", "==", "0", ":", "return", "node", "if", "self", ".", "ignore_exceptions", "is", "None", ":", "ignore_exceptions", "=", "ast", ".", "Name", "(", "\"None\"", ",", "ast",...
Propagate 'debug' wrapper into inner function calls if needed. Args: node (ast.AST): node statement to surround.
[ "Propagate", "debug", "wrapper", "into", "inner", "function", "calls", "if", "needed", "." ]
9575734ec26f6be86ae263496d50eb60bb988b21
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L213-L241
train
PBR/MQ2
MQ2/plugins/csv_plugin.py
get_qtls_from_rqtl_data
def get_qtls_from_rqtl_data(matrix, lod_threshold): """ Retrieve the list of significants QTLs for the given input matrix and using the specified LOD threshold. This assumes one QTL per linkage group. :arg matrix, the MapQTL file read in memory :arg threshold, threshold used to determine if a given...
python
def get_qtls_from_rqtl_data(matrix, lod_threshold): """ Retrieve the list of significants QTLs for the given input matrix and using the specified LOD threshold. This assumes one QTL per linkage group. :arg matrix, the MapQTL file read in memory :arg threshold, threshold used to determine if a given...
[ "def", "get_qtls_from_rqtl_data", "(", "matrix", ",", "lod_threshold", ")", ":", "t_matrix", "=", "list", "(", "zip", "(", "*", "matrix", ")", ")", "qtls", "=", "[", "[", "'Trait'", ",", "'Linkage Group'", ",", "'Position'", ",", "'Exact marker'", ",", "'L...
Retrieve the list of significants QTLs for the given input matrix and using the specified LOD threshold. This assumes one QTL per linkage group. :arg matrix, the MapQTL file read in memory :arg threshold, threshold used to determine if a given LOD value is reflective the presence of a QTL.
[ "Retrieve", "the", "list", "of", "significants", "QTLs", "for", "the", "given", "input", "matrix", "and", "using", "the", "specified", "LOD", "threshold", ".", "This", "assumes", "one", "QTL", "per", "linkage", "group", "." ]
6d84dea47e6751333004743f588f03158e35c28d
https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/plugins/csv_plugin.py#L55-L100
train
projectshift/shift-boiler
boiler/user/session_interface.py
BoilerSessionInterface.save_session
def save_session(self, *args, **kwargs): """ Save session Skip setting session cookie if requested via g.stateless_sessions """ # do not send session cookie if g.get('stateless_sessions'): return # send cookie return super(BoilerSessionInterf...
python
def save_session(self, *args, **kwargs): """ Save session Skip setting session cookie if requested via g.stateless_sessions """ # do not send session cookie if g.get('stateless_sessions'): return # send cookie return super(BoilerSessionInterf...
[ "def", "save_session", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "g", ".", "get", "(", "'stateless_sessions'", ")", ":", "return", "return", "super", "(", "BoilerSessionInterface", ",", "self", ")", ".", "save_session", "(", "*"...
Save session Skip setting session cookie if requested via g.stateless_sessions
[ "Save", "session", "Skip", "setting", "session", "cookie", "if", "requested", "via", "g", ".", "stateless_sessions" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/session_interface.py#L45-L59
train
brunato/lograptor
lograptor/channels.py
FileChannel.prune_old
def prune_old(self): """ Removes the directories that are older than a certain date. """ path = self.pubdir dirmask = self.dirmask expire = self.expire expire_limit = int(time.time()) - (86400 * expire) logger.info('Pruning directories older than %d days'...
python
def prune_old(self): """ Removes the directories that are older than a certain date. """ path = self.pubdir dirmask = self.dirmask expire = self.expire expire_limit = int(time.time()) - (86400 * expire) logger.info('Pruning directories older than %d days'...
[ "def", "prune_old", "(", "self", ")", ":", "path", "=", "self", ".", "pubdir", "dirmask", "=", "self", ".", "dirmask", "expire", "=", "self", ".", "expire", "expire_limit", "=", "int", "(", "time", ".", "time", "(", ")", ")", "-", "(", "86400", "*"...
Removes the directories that are older than a certain date.
[ "Removes", "the", "directories", "that", "are", "older", "than", "a", "certain", "date", "." ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/channels.py#L512-L545
train
brunato/lograptor
lograptor/channels.py
FileChannel.send_report
def send_report(self, report_parts): """ Publish the report parts to local files. Each report part is a text with a title and specific extension. For html and plaintext sending the report part is unique, for csv send also the stats and unparsed string are plain text and report it...
python
def send_report(self, report_parts): """ Publish the report parts to local files. Each report part is a text with a title and specific extension. For html and plaintext sending the report part is unique, for csv send also the stats and unparsed string are plain text and report it...
[ "def", "send_report", "(", "self", ",", "report_parts", ")", ":", "logger", ".", "info", "(", "'Checking and creating the report directory'", ")", "report_parts", "=", "sorted", "(", "filter", "(", "lambda", "x", ":", "x", ".", "fmt", "in", "self", ".", "for...
Publish the report parts to local files. Each report part is a text with a title and specific extension. For html and plaintext sending the report part is unique, for csv send also the stats and unparsed string are plain text and report items are csv texts.
[ "Publish", "the", "report", "parts", "to", "local", "files", ".", "Each", "report", "part", "is", "a", "text", "with", "a", "title", "and", "specific", "extension", ".", "For", "html", "and", "plaintext", "sending", "the", "report", "part", "is", "unique",...
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/channels.py#L562-L623
train
mardix/Mocha
mocha/utils.py
_InspectMethodsDecorators.parse
def parse(self): """ Return the list of string of all the decorators found """ self._parse(self.method) return list(set([deco for deco in self.decos if deco]))
python
def parse(self): """ Return the list of string of all the decorators found """ self._parse(self.method) return list(set([deco for deco in self.decos if deco]))
[ "def", "parse", "(", "self", ")", ":", "self", ".", "_parse", "(", "self", ".", "method", ")", "return", "list", "(", "set", "(", "[", "deco", "for", "deco", "in", "self", ".", "decos", "if", "deco", "]", ")", ")" ]
Return the list of string of all the decorators found
[ "Return", "the", "list", "of", "string", "of", "all", "the", "decorators", "found" ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/utils.py#L365-L370
train
trendels/rhino
rhino/response.py
filter_304_headers
def filter_304_headers(headers): """Filter a list of headers to include in a "304 Not Modified" response.""" return [(k, v) for k, v in headers if k.lower() not in _filter_from_304]
python
def filter_304_headers(headers): """Filter a list of headers to include in a "304 Not Modified" response.""" return [(k, v) for k, v in headers if k.lower() not in _filter_from_304]
[ "def", "filter_304_headers", "(", "headers", ")", ":", "return", "[", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "headers", "if", "k", ".", "lower", "(", ")", "not", "in", "_filter_from_304", "]" ]
Filter a list of headers to include in a "304 Not Modified" response.
[ "Filter", "a", "list", "of", "headers", "to", "include", "in", "a", "304", "Not", "Modified", "response", "." ]
f1f0ef21b6080a2bd130b38b5bef163074c94aed
https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/response.py#L41-L43
train
trendels/rhino
rhino/response.py
response
def response(code, body='', etag=None, last_modified=None, expires=None, **kw): """Helper to build an HTTP response. Parameters: code : An integer status code. body : The response body. See `Response.__init__` for details. etag : A value for the ETag header. Double quotes will be...
python
def response(code, body='', etag=None, last_modified=None, expires=None, **kw): """Helper to build an HTTP response. Parameters: code : An integer status code. body : The response body. See `Response.__init__` for details. etag : A value for the ETag header. Double quotes will be...
[ "def", "response", "(", "code", ",", "body", "=", "''", ",", "etag", "=", "None", ",", "last_modified", "=", "None", ",", "expires", "=", "None", ",", "**", "kw", ")", ":", "if", "etag", "is", "not", "None", ":", "if", "not", "(", "etag", "[", ...
Helper to build an HTTP response. Parameters: code : An integer status code. body : The response body. See `Response.__init__` for details. etag : A value for the ETag header. Double quotes will be added unless the string starts and ends with a double quote. last_modified...
[ "Helper", "to", "build", "an", "HTTP", "response", "." ]
f1f0ef21b6080a2bd130b38b5bef163074c94aed
https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/response.py#L362-L404
train
trendels/rhino
rhino/response.py
Response.body
def body(self): """Seralizes and returns the response body. On subsequent access, returns the cached value.""" if self._body is None: raw_body = self._raw_body if self._body_writer is None: self._body = raw_body() if callable(raw_body) else raw_body ...
python
def body(self): """Seralizes and returns the response body. On subsequent access, returns the cached value.""" if self._body is None: raw_body = self._raw_body if self._body_writer is None: self._body = raw_body() if callable(raw_body) else raw_body ...
[ "def", "body", "(", "self", ")", ":", "if", "self", ".", "_body", "is", "None", ":", "raw_body", "=", "self", ".", "_raw_body", "if", "self", ".", "_body_writer", "is", "None", ":", "self", ".", "_body", "=", "raw_body", "(", ")", "if", "callable", ...
Seralizes and returns the response body. On subsequent access, returns the cached value.
[ "Seralizes", "and", "returns", "the", "response", "body", "." ]
f1f0ef21b6080a2bd130b38b5bef163074c94aed
https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/response.py#L189-L200
train
trendels/rhino
rhino/response.py
Response.set_cookie
def set_cookie(self, key, value='', max_age=None, path='/', domain=None, secure=False, httponly=False, expires=None): """Set a response cookie. Parameters: key : The cookie name. value : The cookie value. max_age : The maximum ag...
python
def set_cookie(self, key, value='', max_age=None, path='/', domain=None, secure=False, httponly=False, expires=None): """Set a response cookie. Parameters: key : The cookie name. value : The cookie value. max_age : The maximum ag...
[ "def", "set_cookie", "(", "self", ",", "key", ",", "value", "=", "''", ",", "max_age", "=", "None", ",", "path", "=", "'/'", ",", "domain", "=", "None", ",", "secure", "=", "False", ",", "httponly", "=", "False", ",", "expires", "=", "None", ")", ...
Set a response cookie. Parameters: key : The cookie name. value : The cookie value. max_age : The maximum age of the cookie in seconds, or as a datetime.timedelta object. path : Restrict the cookie to this path (default: '/')....
[ "Set", "a", "response", "cookie", "." ]
f1f0ef21b6080a2bd130b38b5bef163074c94aed
https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/response.py#L210-L259
train
trendels/rhino
rhino/response.py
Response.conditional_to
def conditional_to(self, request): """Return a response that is conditional to a given request. Returns the Response object unchanged, or a new Response object with a "304 Not Modified" status code. """ if not self.code == 200: return self request_headers = ...
python
def conditional_to(self, request): """Return a response that is conditional to a given request. Returns the Response object unchanged, or a new Response object with a "304 Not Modified" status code. """ if not self.code == 200: return self request_headers = ...
[ "def", "conditional_to", "(", "self", ",", "request", ")", ":", "if", "not", "self", ".", "code", "==", "200", ":", "return", "self", "request_headers", "=", "request", ".", "headers", "response_headers", "=", "self", ".", "headers", "if_none_match", "=", ...
Return a response that is conditional to a given request. Returns the Response object unchanged, or a new Response object with a "304 Not Modified" status code.
[ "Return", "a", "response", "that", "is", "conditional", "to", "a", "given", "request", "." ]
f1f0ef21b6080a2bd130b38b5bef163074c94aed
https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/response.py#L269-L311
train
assamite/creamas
creamas/examples/grid/ukko.py
_get_ukko_report
def _get_ukko_report(): '''Get Ukko's report from the fixed URL. ''' with urllib.request.urlopen(URL_UKKO_REPORT) as response: ret = str(response.read()) return ret
python
def _get_ukko_report(): '''Get Ukko's report from the fixed URL. ''' with urllib.request.urlopen(URL_UKKO_REPORT) as response: ret = str(response.read()) return ret
[ "def", "_get_ukko_report", "(", ")", ":", "with", "urllib", ".", "request", ".", "urlopen", "(", "URL_UKKO_REPORT", ")", "as", "response", ":", "ret", "=", "str", "(", "response", ".", "read", "(", ")", ")", "return", "ret" ]
Get Ukko's report from the fixed URL.
[ "Get", "Ukko", "s", "report", "from", "the", "fixed", "URL", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/ukko.py#L41-L46
train
assamite/creamas
creamas/examples/grid/ukko.py
get_nodes
def get_nodes(n=8, exclude=[], loop=None): '''Get Ukko nodes with the least amount of load. May return less than *n* nodes if there are not as many nodes available, the nodes are reserved or the nodes are on the exclude list. :param int n: Number of Ukko nodes to return. :param list exclude: Nodes...
python
def get_nodes(n=8, exclude=[], loop=None): '''Get Ukko nodes with the least amount of load. May return less than *n* nodes if there are not as many nodes available, the nodes are reserved or the nodes are on the exclude list. :param int n: Number of Ukko nodes to return. :param list exclude: Nodes...
[ "def", "get_nodes", "(", "n", "=", "8", ",", "exclude", "=", "[", "]", ",", "loop", "=", "None", ")", ":", "report", "=", "_get_ukko_report", "(", ")", "nodes", "=", "_parse_ukko_report", "(", "report", ")", "ret", "=", "[", "]", "while", "len", "(...
Get Ukko nodes with the least amount of load. May return less than *n* nodes if there are not as many nodes available, the nodes are reserved or the nodes are on the exclude list. :param int n: Number of Ukko nodes to return. :param list exclude: Nodes to exclude from the returned list. :param loo...
[ "Get", "Ukko", "nodes", "with", "the", "least", "amount", "of", "load", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/ukko.py#L60-L88
train
brunato/lograptor
lograptor/tui.py
get_unix_ioctl_terminal_size
def get_unix_ioctl_terminal_size(): """Get the terminal size of a UNIX terminal using the ioctl UNIX command.""" def ioctl_gwinsz(fd): try: import fcntl import termios import struct return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) ...
python
def get_unix_ioctl_terminal_size(): """Get the terminal size of a UNIX terminal using the ioctl UNIX command.""" def ioctl_gwinsz(fd): try: import fcntl import termios import struct return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) ...
[ "def", "get_unix_ioctl_terminal_size", "(", ")", ":", "def", "ioctl_gwinsz", "(", "fd", ")", ":", "try", ":", "import", "fcntl", "import", "termios", "import", "struct", "return", "struct", ".", "unpack", "(", "'hh'", ",", "fcntl", ".", "ioctl", "(", "fd",...
Get the terminal size of a UNIX terminal using the ioctl UNIX command.
[ "Get", "the", "terminal", "size", "of", "a", "UNIX", "terminal", "using", "the", "ioctl", "UNIX", "command", "." ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/tui.py#L94-L118
train
PBR/MQ2
MQ2/add_marker_to_qtls.py
add_marker_to_qtl
def add_marker_to_qtl(qtl, map_list): """Add the closest marker to the given QTL. :arg qtl: a row of the QTL list. :arg map_list: the genetic map containing the list of markers. """ closest = '' diff = None for marker in map_list: if qtl[1] == marker[1]: tmp_diff = floa...
python
def add_marker_to_qtl(qtl, map_list): """Add the closest marker to the given QTL. :arg qtl: a row of the QTL list. :arg map_list: the genetic map containing the list of markers. """ closest = '' diff = None for marker in map_list: if qtl[1] == marker[1]: tmp_diff = floa...
[ "def", "add_marker_to_qtl", "(", "qtl", ",", "map_list", ")", ":", "closest", "=", "''", "diff", "=", "None", "for", "marker", "in", "map_list", ":", "if", "qtl", "[", "1", "]", "==", "marker", "[", "1", "]", ":", "tmp_diff", "=", "float", "(", "qt...
Add the closest marker to the given QTL. :arg qtl: a row of the QTL list. :arg map_list: the genetic map containing the list of markers.
[ "Add", "the", "closest", "marker", "to", "the", "given", "QTL", "." ]
6d84dea47e6751333004743f588f03158e35c28d
https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/add_marker_to_qtls.py#L38-L55
train
PBR/MQ2
MQ2/add_marker_to_qtls.py
add_marker_to_qtls
def add_marker_to_qtls(qtlfile, mapfile, outputfile='qtls_with_mk.csv'): """This function adds to a list of QTLs, the closest marker to the QTL peak. :arg qtlfile: a CSV list of all the QTLs found. The file should be structured as follow:: Trait, Linkage group, position, other columns ...
python
def add_marker_to_qtls(qtlfile, mapfile, outputfile='qtls_with_mk.csv'): """This function adds to a list of QTLs, the closest marker to the QTL peak. :arg qtlfile: a CSV list of all the QTLs found. The file should be structured as follow:: Trait, Linkage group, position, other columns ...
[ "def", "add_marker_to_qtls", "(", "qtlfile", ",", "mapfile", ",", "outputfile", "=", "'qtls_with_mk.csv'", ")", ":", "qtl_list", "=", "read_input_file", "(", "qtlfile", ",", "','", ")", "map_list", "=", "read_input_file", "(", "mapfile", ",", "','", ")", "if",...
This function adds to a list of QTLs, the closest marker to the QTL peak. :arg qtlfile: a CSV list of all the QTLs found. The file should be structured as follow:: Trait, Linkage group, position, other columns The other columns will not matter as long as the first three col...
[ "This", "function", "adds", "to", "a", "list", "of", "QTLs", "the", "closest", "marker", "to", "the", "QTL", "peak", "." ]
6d84dea47e6751333004743f588f03158e35c28d
https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/add_marker_to_qtls.py#L58-L87
train
kata198/QueryableList
QueryableList/Builder.py
QueryBuilder.addFilter
def addFilter(self, filterMethod=FILTER_METHOD_AND, **kwargs): ''' addFilter - Add a filter to this query. @param filterMethod <str> - The filter method to use (AND or OR), default: 'AND' @param additional args - Filter arguments. @see QueryableListBase.filter ...
python
def addFilter(self, filterMethod=FILTER_METHOD_AND, **kwargs): ''' addFilter - Add a filter to this query. @param filterMethod <str> - The filter method to use (AND or OR), default: 'AND' @param additional args - Filter arguments. @see QueryableListBase.filter ...
[ "def", "addFilter", "(", "self", ",", "filterMethod", "=", "FILTER_METHOD_AND", ",", "**", "kwargs", ")", ":", "filterMethod", "=", "filterMethod", ".", "upper", "(", ")", "if", "filterMethod", "not", "in", "FILTER_METHODS", ":", "raise", "ValueError", "(", ...
addFilter - Add a filter to this query. @param filterMethod <str> - The filter method to use (AND or OR), default: 'AND' @param additional args - Filter arguments. @see QueryableListBase.filter @raises ValueError if filterMethod is not one of known methods.
[ "addFilter", "-", "Add", "a", "filter", "to", "this", "query", "." ]
279286d46205ce8268af42e03b75820a7483fddb
https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L33-L47
train
kata198/QueryableList
QueryableList/Builder.py
QueryBuilder.execute
def execute(self, lst): ''' execute - Execute the series of filters, in order, on the provided list. @param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within the list, you can pick a QueryableList implementing class to g...
python
def execute(self, lst): ''' execute - Execute the series of filters, in order, on the provided list. @param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within the list, you can pick a QueryableList implementing class to g...
[ "def", "execute", "(", "self", ",", "lst", ")", ":", "from", ".", "import", "QueryableListMixed", "if", "not", "issubclass", "(", "lst", ".", "__class__", ",", "QueryableListBase", ")", ":", "lst", "=", "QueryableListMixed", "(", "lst", ")", "filters", "="...
execute - Execute the series of filters, in order, on the provided list. @param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within the list, you can pick a QueryableList implementing class to get faster results. Otherwise, if a list type tha...
[ "execute", "-", "Execute", "the", "series", "of", "filters", "in", "order", "on", "the", "provided", "list", "." ]
279286d46205ce8268af42e03b75820a7483fddb
https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L65-L90
train
kata198/QueryableList
QueryableList/Builder.py
QueryBuilder.copy
def copy(self): ''' copy - Create a copy of this query. @return <QueryBuilder> - a copy of this query ''' ret = QueryBuilder() ret.filters = copy.copy(self.filters) return ret
python
def copy(self): ''' copy - Create a copy of this query. @return <QueryBuilder> - a copy of this query ''' ret = QueryBuilder() ret.filters = copy.copy(self.filters) return ret
[ "def", "copy", "(", "self", ")", ":", "ret", "=", "QueryBuilder", "(", ")", "ret", ".", "filters", "=", "copy", ".", "copy", "(", "self", ".", "filters", ")", "return", "ret" ]
copy - Create a copy of this query. @return <QueryBuilder> - a copy of this query
[ "copy", "-", "Create", "a", "copy", "of", "this", "query", "." ]
279286d46205ce8268af42e03b75820a7483fddb
https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L92-L100
train
kata198/QueryableList
QueryableList/Builder.py
QueryBuilder._applyFilter
def _applyFilter(lst, filterMethod, filterArgs): ''' _applyFilter - Applies the given filter method on a set of args private method - used by execute @return QueryableList - a QueryableList containing the elements of the resulting filter ''' if filterMetho...
python
def _applyFilter(lst, filterMethod, filterArgs): ''' _applyFilter - Applies the given filter method on a set of args private method - used by execute @return QueryableList - a QueryableList containing the elements of the resulting filter ''' if filterMetho...
[ "def", "_applyFilter", "(", "lst", ",", "filterMethod", ",", "filterArgs", ")", ":", "if", "filterMethod", "==", "FILTER_METHOD_AND", ":", "return", "lst", ".", "filterAnd", "(", "**", "filterArgs", ")", "else", ":", "return", "lst", ".", "filterOr", "(", ...
_applyFilter - Applies the given filter method on a set of args private method - used by execute @return QueryableList - a QueryableList containing the elements of the resulting filter
[ "_applyFilter", "-", "Applies", "the", "given", "filter", "method", "on", "a", "set", "of", "args" ]
279286d46205ce8268af42e03b75820a7483fddb
https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L103-L114
train
Fire-Proof/cuepy
cuepy/cuepy.py
CorsairSDK._raise_corsair_error
def _raise_corsair_error(self, error=None, message=""): """ Raise error message based on the last reported error from the SDK :param error: specify error type :type error: int :param message: specify error message :type message: str """ if error is None: ...
python
def _raise_corsair_error(self, error=None, message=""): """ Raise error message based on the last reported error from the SDK :param error: specify error type :type error: int :param message: specify error message :type message: str """ if error is None: ...
[ "def", "_raise_corsair_error", "(", "self", ",", "error", "=", "None", ",", "message", "=", "\"\"", ")", ":", "if", "error", "is", "None", ":", "error", "=", "self", ".", "last_error", "(", ")", "raise", "error", "(", "message", ")" ]
Raise error message based on the last reported error from the SDK :param error: specify error type :type error: int :param message: specify error message :type message: str
[ "Raise", "error", "message", "based", "on", "the", "last", "reported", "error", "from", "the", "SDK" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L26-L37
train
Fire-Proof/cuepy
cuepy/cuepy.py
CorsairSDK.device_count
def device_count(self): """ Find amount of CUE devices :returns: amount of CUE devices :rtype: int """ device_count = get_device_count(self.corsair_sdk) if device_count == -1: self._raise_corsair_error() return device_count
python
def device_count(self): """ Find amount of CUE devices :returns: amount of CUE devices :rtype: int """ device_count = get_device_count(self.corsair_sdk) if device_count == -1: self._raise_corsair_error() return device_count
[ "def", "device_count", "(", "self", ")", ":", "device_count", "=", "get_device_count", "(", "self", ".", "corsair_sdk", ")", "if", "device_count", "==", "-", "1", ":", "self", ".", "_raise_corsair_error", "(", ")", "return", "device_count" ]
Find amount of CUE devices :returns: amount of CUE devices :rtype: int
[ "Find", "amount", "of", "CUE", "devices" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L48-L58
train
Fire-Proof/cuepy
cuepy/cuepy.py
CorsairSDK.led_id_from_char
def led_id_from_char(self, char): """ Get id of a led by the letter Only between A-Z :param char: Character to find led_id from :type char: str :returns: id for led :rtype: int """ led_id = get_led_id_for_key_name(self.corsair_sdk, bytes(char)) ...
python
def led_id_from_char(self, char): """ Get id of a led by the letter Only between A-Z :param char: Character to find led_id from :type char: str :returns: id for led :rtype: int """ led_id = get_led_id_for_key_name(self.corsair_sdk, bytes(char)) ...
[ "def", "led_id_from_char", "(", "self", ",", "char", ")", ":", "led_id", "=", "get_led_id_for_key_name", "(", "self", ".", "corsair_sdk", ",", "bytes", "(", "char", ")", ")", "if", "led_id", "==", "0", ":", "self", ".", "_raise_corsair_error", "(", ")", ...
Get id of a led by the letter Only between A-Z :param char: Character to find led_id from :type char: str :returns: id for led :rtype: int
[ "Get", "id", "of", "a", "led", "by", "the", "letter", "Only", "between", "A", "-", "Z" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L60-L73
train
Fire-Proof/cuepy
cuepy/cuepy.py
CorsairSDK.set_led
def set_led(self, led_id, color): """ Set color of an led :param led_id: id of led to set color :type led_id: int :param color: list of rgb values of new colors. eg. [255, 255, 255] :type color: list :returns: true if successful :rtype: bool """ ...
python
def set_led(self, led_id, color): """ Set color of an led :param led_id: id of led to set color :type led_id: int :param color: list of rgb values of new colors. eg. [255, 255, 255] :type color: list :returns: true if successful :rtype: bool """ ...
[ "def", "set_led", "(", "self", ",", "led_id", ",", "color", ")", ":", "if", "not", "set_leds_color", "(", "self", ".", "corsair_sdk", ",", "LedColor", "(", "led_id", ",", "*", "color", ")", ")", ":", "self", ".", "_raise_corsair_error", "(", ")", "retu...
Set color of an led :param led_id: id of led to set color :type led_id: int :param color: list of rgb values of new colors. eg. [255, 255, 255] :type color: list :returns: true if successful :rtype: bool
[ "Set", "color", "of", "an", "led" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L75-L88
train
Fire-Proof/cuepy
cuepy/cuepy.py
CorsairSDK.request_control
def request_control(self, device_id, access_mode=True): """ Request exclusive control of device :param device_id: id of device :type device_id: int :param access_mode: True=exclusive, False=shared :type access_mode: bool :returns: true if successful :rtyp...
python
def request_control(self, device_id, access_mode=True): """ Request exclusive control of device :param device_id: id of device :type device_id: int :param access_mode: True=exclusive, False=shared :type access_mode: bool :returns: true if successful :rtyp...
[ "def", "request_control", "(", "self", ",", "device_id", ",", "access_mode", "=", "True", ")", ":", "if", "access_mode", ":", "if", "not", "request_control", "(", "self", ".", "corsair_sdk", ",", "device_id", ")", ":", "self", ".", "_raise_corsair_error", "(...
Request exclusive control of device :param device_id: id of device :type device_id: int :param access_mode: True=exclusive, False=shared :type access_mode: bool :returns: true if successful :rtype: bool
[ "Request", "exclusive", "control", "of", "device" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L101-L117
train
Fire-Proof/cuepy
cuepy/cuepy.py
CorsairSDK.device
def device(self, device_id, *args, **kwargs): """ Return a Device object based on id :param device_id: id of device :type device_id: int :param args: extra parameters :param kwargs: extra parameters :returns: Device object :rtype: Device """ ...
python
def device(self, device_id, *args, **kwargs): """ Return a Device object based on id :param device_id: id of device :type device_id: int :param args: extra parameters :param kwargs: extra parameters :returns: Device object :rtype: Device """ ...
[ "def", "device", "(", "self", ",", "device_id", ",", "*", "args", ",", "**", "kwargs", ")", ":", "return", "Device", "(", "device_id", ",", "self", ".", "corsair_sdk", ",", "self", ".", "_corsair_sdk_path", ",", "*", "args", ",", "**", "kwargs", ")" ]
Return a Device object based on id :param device_id: id of device :type device_id: int :param args: extra parameters :param kwargs: extra parameters :returns: Device object :rtype: Device
[ "Return", "a", "Device", "object", "based", "on", "id" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L146-L157
train
Fire-Proof/cuepy
cuepy/cuepy.py
Device.device_info
def device_info(self, device_id=None): """ Return device information, if device_id is not specified, return for this device :param device_id: id of device :type device_id: int :returns: dict containing information about device :rtype: dict """ if device_i...
python
def device_info(self, device_id=None): """ Return device information, if device_id is not specified, return for this device :param device_id: id of device :type device_id: int :returns: dict containing information about device :rtype: dict """ if device_i...
[ "def", "device_info", "(", "self", ",", "device_id", "=", "None", ")", ":", "if", "device_id", "is", "None", ":", "device_id", "=", "self", ".", "device_id", "return", "get_device_info", "(", "self", ".", "corsair_sdk", ",", "device_id", ")" ]
Return device information, if device_id is not specified, return for this device :param device_id: id of device :type device_id: int :returns: dict containing information about device :rtype: dict
[ "Return", "device", "information", "if", "device_id", "is", "not", "specified", "return", "for", "this", "device" ]
5add7d62a31589bcdc7d2103c9c482bf718556ec
https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L187-L198
train
Kortemme-Lab/klab
klab/bio/uniprot.py
get_obsolete_acc_to_uniparc
def get_obsolete_acc_to_uniparc(acc): ''' Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map. :param acc: The UniProt accession number. :return: The corresponding UniParc ID. Warning: This is a fragile function as the underlying website generation ...
python
def get_obsolete_acc_to_uniparc(acc): ''' Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map. :param acc: The UniProt accession number. :return: The corresponding UniParc ID. Warning: This is a fragile function as the underlying website generation ...
[ "def", "get_obsolete_acc_to_uniparc", "(", "acc", ")", ":", "contents", "=", "http_get", "(", "'www.uniprot.org/uniparc/?query={0}'", ".", "format", "(", "acc", ")", ")", "mtchs", "=", "re", ".", "findall", "(", "r'\"UPI[A-Z0-9]+?\"'", ",", "contents", ",", "re"...
Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map. :param acc: The UniProt accession number. :return: The corresponding UniParc ID. Warning: This is a fragile function as the underlying website generation or URL could change.
[ "Tries", "to", "determine", "the", "UniParc", "ID", "for", "obsolete", "ACCs", "which", "are", "not", "returned", "using", "uniprot_map", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L34-L49
train
Kortemme-Lab/klab
klab/bio/uniprot.py
get_common_PDB_IDs
def get_common_PDB_IDs(pdb_id, cache_dir = None, exception_on_failure = True): '''This function takes a PDB ID, maps it to UniProt ACCs, then returns the common set of PDB IDs related to those ACCs. The purpose is to find any PDB files related to pdb_id, particularly for complexes, such that the other PDB fi...
python
def get_common_PDB_IDs(pdb_id, cache_dir = None, exception_on_failure = True): '''This function takes a PDB ID, maps it to UniProt ACCs, then returns the common set of PDB IDs related to those ACCs. The purpose is to find any PDB files related to pdb_id, particularly for complexes, such that the other PDB fi...
[ "def", "get_common_PDB_IDs", "(", "pdb_id", ",", "cache_dir", "=", "None", ",", "exception_on_failure", "=", "True", ")", ":", "m", "=", "pdb_to_uniparc", "(", "[", "pdb_id", "]", ",", "cache_dir", "=", "cache_dir", ")", "UniProtACs", "=", "[", "]", "if", ...
This function takes a PDB ID, maps it to UniProt ACCs, then returns the common set of PDB IDs related to those ACCs. The purpose is to find any PDB files related to pdb_id, particularly for complexes, such that the other PDB files contain identical sequences or mutant complexes.
[ "This", "function", "takes", "a", "PDB", "ID", "maps", "it", "to", "UniProt", "ACCs", "then", "returns", "the", "common", "set", "of", "PDB", "IDs", "related", "to", "those", "ACCs", ".", "The", "purpose", "is", "to", "find", "any", "PDB", "files", "re...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L892-L915
train
Kortemme-Lab/klab
klab/bio/uniprot.py
UniProtACEntry._parse_sequence_tag
def _parse_sequence_tag(self): '''Parses the sequence and atomic mass.''' #main_tags = self._dom.getElementsByTagName("uniprot") #assert(len(main_tags) == 1) #entry_tags = main_tags[0].getElementsByTagName("entry") #assert(len(entry_tags) == 1) #entry_tags[0] ent...
python
def _parse_sequence_tag(self): '''Parses the sequence and atomic mass.''' #main_tags = self._dom.getElementsByTagName("uniprot") #assert(len(main_tags) == 1) #entry_tags = main_tags[0].getElementsByTagName("entry") #assert(len(entry_tags) == 1) #entry_tags[0] ent...
[ "def", "_parse_sequence_tag", "(", "self", ")", ":", "entry_tag", "=", "self", ".", "entry_tag", "sequence_tags", "=", "[", "child", "for", "child", "in", "entry_tag", ".", "childNodes", "if", "child", ".", "nodeType", "==", "child", ".", "ELEMENT_NODE", "an...
Parses the sequence and atomic mass.
[ "Parses", "the", "sequence", "and", "atomic", "mass", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L542-L560
train
joe513/django-cool-pagination
django_cool_paginator/templatetags/cool_paginate.py
cool_paginate
def cool_paginate(context, **kwargs) -> dict: """Main function for pagination process.""" names = ( 'size', 'next_name', 'previous_name', 'elastic', 'page_obj', ) return_dict = {name: value for name, value in zip(names, map(kwargs.get, names))} if context.g...
python
def cool_paginate(context, **kwargs) -> dict: """Main function for pagination process.""" names = ( 'size', 'next_name', 'previous_name', 'elastic', 'page_obj', ) return_dict = {name: value for name, value in zip(names, map(kwargs.get, names))} if context.g...
[ "def", "cool_paginate", "(", "context", ",", "**", "kwargs", ")", "->", "dict", ":", "names", "=", "(", "'size'", ",", "'next_name'", ",", "'previous_name'", ",", "'elastic'", ",", "'page_obj'", ",", ")", "return_dict", "=", "{", "name", ":", "value", "f...
Main function for pagination process.
[ "Main", "function", "for", "pagination", "process", "." ]
ed75a151a016aef0f5216fdb1e3610597872a3ef
https://github.com/joe513/django-cool-pagination/blob/ed75a151a016aef0f5216fdb1e3610597872a3ef/django_cool_paginator/templatetags/cool_paginate.py#L32-L65
train
projectshift/shift-boiler
boiler/timer/restart_timer.py
time_restarts
def time_restarts(data_path): """ When called will create a file and measure its mtime on restarts """ path = os.path.join(data_path, 'last_restarted') if not os.path.isfile(path): with open(path, 'a'): os.utime(path, None) last_modified = os.stat(path).st_mtime with open(path,...
python
def time_restarts(data_path): """ When called will create a file and measure its mtime on restarts """ path = os.path.join(data_path, 'last_restarted') if not os.path.isfile(path): with open(path, 'a'): os.utime(path, None) last_modified = os.stat(path).st_mtime with open(path,...
[ "def", "time_restarts", "(", "data_path", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "data_path", ",", "'last_restarted'", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "with", "open", "(", "path", ",", ...
When called will create a file and measure its mtime on restarts
[ "When", "called", "will", "create", "a", "file", "and", "measure", "its", "mtime", "on", "restarts" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/timer/restart_timer.py#L6-L22
train
MacHu-GWU/sqlalchemy_mate-project
sqlalchemy_mate/pt.py
from_stmt
def from_stmt(stmt, engine, **kwargs): """ Execute a query in form of texture clause, return the result in form of :class:`PrettyTable`. :type stmt: TextClause :param stmt: :type engine: Engine :param engine: :rtype: PrettyTable """ result_proxy = engine.execute(stmt, **kwarg...
python
def from_stmt(stmt, engine, **kwargs): """ Execute a query in form of texture clause, return the result in form of :class:`PrettyTable`. :type stmt: TextClause :param stmt: :type engine: Engine :param engine: :rtype: PrettyTable """ result_proxy = engine.execute(stmt, **kwarg...
[ "def", "from_stmt", "(", "stmt", ",", "engine", ",", "**", "kwargs", ")", ":", "result_proxy", "=", "engine", ".", "execute", "(", "stmt", ",", "**", "kwargs", ")", "return", "from_db_cursor", "(", "result_proxy", ".", "cursor", ")" ]
Execute a query in form of texture clause, return the result in form of :class:`PrettyTable`. :type stmt: TextClause :param stmt: :type engine: Engine :param engine: :rtype: PrettyTable
[ "Execute", "a", "query", "in", "form", "of", "texture", "clause", "return", "the", "result", "in", "form", "of" ]
946754744c8870f083fd7b4339fca15d1d6128b2
https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/pt.py#L34-L49
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
BenchmarkRun.compute_stability_classification
def compute_stability_classification(self, predicted_data, record, dataframe_record): '''Calculate the stability classification for this case.''' stability_classification, stability_classication_x_cutoff, stability_classication_y_cutoff = None, self.stability_classication_x_cutoff, self.stability_classi...
python
def compute_stability_classification(self, predicted_data, record, dataframe_record): '''Calculate the stability classification for this case.''' stability_classification, stability_classication_x_cutoff, stability_classication_y_cutoff = None, self.stability_classication_x_cutoff, self.stability_classi...
[ "def", "compute_stability_classification", "(", "self", ",", "predicted_data", ",", "record", ",", "dataframe_record", ")", ":", "stability_classification", ",", "stability_classication_x_cutoff", ",", "stability_classication_y_cutoff", "=", "None", ",", "self", ".", "sta...
Calculate the stability classification for this case.
[ "Calculate", "the", "stability", "classification", "for", "this", "case", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L595-L602
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
BenchmarkRun.compute_absolute_error
def compute_absolute_error(self, predicted_data, record, dataframe_record): '''Calculate the absolute error for this case.''' absolute_error = abs(record['DDG'] - predicted_data[self.ddg_analysis_type]) dataframe_record['AbsoluteError'] = absolute_error
python
def compute_absolute_error(self, predicted_data, record, dataframe_record): '''Calculate the absolute error for this case.''' absolute_error = abs(record['DDG'] - predicted_data[self.ddg_analysis_type]) dataframe_record['AbsoluteError'] = absolute_error
[ "def", "compute_absolute_error", "(", "self", ",", "predicted_data", ",", "record", ",", "dataframe_record", ")", ":", "absolute_error", "=", "abs", "(", "record", "[", "'DDG'", "]", "-", "predicted_data", "[", "self", ".", "ddg_analysis_type", "]", ")", "data...
Calculate the absolute error for this case.
[ "Calculate", "the", "absolute", "error", "for", "this", "case", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L605-L608
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
BenchmarkRun.count_residues
def count_residues(self, record, pdb_record): '''Count the number of residues in the chains for the case.''' mutations = self.get_record_mutations(record) pdb_chains = set([m['Chain'] for m in mutations]) assert(len(pdb_chains) == 1) # we expect monomeric cases pdb_chain = pdb_ch...
python
def count_residues(self, record, pdb_record): '''Count the number of residues in the chains for the case.''' mutations = self.get_record_mutations(record) pdb_chains = set([m['Chain'] for m in mutations]) assert(len(pdb_chains) == 1) # we expect monomeric cases pdb_chain = pdb_ch...
[ "def", "count_residues", "(", "self", ",", "record", ",", "pdb_record", ")", ":", "mutations", "=", "self", ".", "get_record_mutations", "(", "record", ")", "pdb_chains", "=", "set", "(", "[", "m", "[", "'Chain'", "]", "for", "m", "in", "mutations", "]",...
Count the number of residues in the chains for the case.
[ "Count", "the", "number", "of", "residues", "in", "the", "chains", "for", "the", "case", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L615-L621
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
BenchmarkRun.full_analysis
def full_analysis(self, analysis_set, output_directory, verbose = True, compile_pdf = True, quick_plots = False): '''Combines calculate_metrics, write_dataframe_to_csv, and plot''' if not os.path.isdir(output_directory): os.makedirs(output_directory) self.analysis_directory = output_...
python
def full_analysis(self, analysis_set, output_directory, verbose = True, compile_pdf = True, quick_plots = False): '''Combines calculate_metrics, write_dataframe_to_csv, and plot''' if not os.path.isdir(output_directory): os.makedirs(output_directory) self.analysis_directory = output_...
[ "def", "full_analysis", "(", "self", ",", "analysis_set", ",", "output_directory", ",", "verbose", "=", "True", ",", "compile_pdf", "=", "True", ",", "quick_plots", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "output_director...
Combines calculate_metrics, write_dataframe_to_csv, and plot
[ "Combines", "calculate_metrics", "write_dataframe_to_csv", "and", "plot" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L792-L801
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
BenchmarkRun.get_unique_ajps
def get_unique_ajps( benchmark_runs ): """ Determines which join parameters are unique """ br_ajps = {} for br in benchmark_runs: for ajp in br.additional_join_parameters: if ajp not in br_ajps: br_ajps[ajp] = set() ...
python
def get_unique_ajps( benchmark_runs ): """ Determines which join parameters are unique """ br_ajps = {} for br in benchmark_runs: for ajp in br.additional_join_parameters: if ajp not in br_ajps: br_ajps[ajp] = set() ...
[ "def", "get_unique_ajps", "(", "benchmark_runs", ")", ":", "br_ajps", "=", "{", "}", "for", "br", "in", "benchmark_runs", ":", "for", "ajp", "in", "br", ".", "additional_join_parameters", ":", "if", "ajp", "not", "in", "br_ajps", ":", "br_ajps", "[", "ajp"...
Determines which join parameters are unique
[ "Determines", "which", "join", "parameters", "are", "unique" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L822-L836
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py
BenchmarkRun.plot_optimum_prediction_fraction_correct_cutoffs_over_range
def plot_optimum_prediction_fraction_correct_cutoffs_over_range(self, analysis_set, min_stability_classication_x_cutoff, max_stability_classication_x_cutoff, suppress_plot = False, analysis_file_prefix = None, verbose = True): '''Plots the optimum cutoff for the predictions to maximize the fraction correct metr...
python
def plot_optimum_prediction_fraction_correct_cutoffs_over_range(self, analysis_set, min_stability_classication_x_cutoff, max_stability_classication_x_cutoff, suppress_plot = False, analysis_file_prefix = None, verbose = True): '''Plots the optimum cutoff for the predictions to maximize the fraction correct metr...
[ "def", "plot_optimum_prediction_fraction_correct_cutoffs_over_range", "(", "self", ",", "analysis_set", ",", "min_stability_classication_x_cutoff", ",", "max_stability_classication_x_cutoff", ",", "suppress_plot", "=", "False", ",", "analysis_file_prefix", "=", "None", ",", "ve...
Plots the optimum cutoff for the predictions to maximize the fraction correct metric over a range of experimental cutoffs. Returns the average scalar corresponding to the best value of fraction correct over a range of cutoff values for the experimental cutoffs.
[ "Plots", "the", "optimum", "cutoff", "for", "the", "predictions", "to", "maximize", "the", "fraction", "correct", "metric", "over", "a", "range", "of", "experimental", "cutoffs", ".", "Returns", "the", "average", "scalar", "corresponding", "to", "the", "best", ...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L1759-L1833
train