repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
jreese/dotlink
dotlink/dotlink.py
Dotlink.deploy_local
def deploy_local(self, dotfiles, target_root=None): """Deploy dotfiles to a local path.""" if target_root is None: target_root = self.args.path for source_path, target_path in dotfiles.items(): source_path = path.join(self.source, source_path) target_path = p...
python
def deploy_local(self, dotfiles, target_root=None): """Deploy dotfiles to a local path.""" if target_root is None: target_root = self.args.path for source_path, target_path in dotfiles.items(): source_path = path.join(self.source, source_path) target_path = p...
[ "def", "deploy_local", "(", "self", ",", "dotfiles", ",", "target_root", "=", "None", ")", ":", "if", "target_root", "is", "None", ":", "target_root", "=", "self", ".", "args", ".", "path", "for", "source_path", ",", "target_path", "in", "dotfiles", ".", ...
Deploy dotfiles to a local path.
[ "Deploy", "dotfiles", "to", "a", "local", "path", "." ]
5e48c1493c20fc6df4ad0144e80563915ce339b6
https://github.com/jreese/dotlink/blob/5e48c1493c20fc6df4ad0144e80563915ce339b6/dotlink/dotlink.py#L366-L400
train
Deploy dotfiles to a local path.
inveniosoftware-contrib/json-merger
json_merger/utils.py
dedupe_list
def dedupe_list(l): """Remove duplicates from a list preserving the order. We might be tempted to use the list(set(l)) idiom, but it doesn't preserve the order, which hinders testability and does not work for lists with unhashable elements. """ result = [] for el in l: if el not in...
python
def dedupe_list(l): """Remove duplicates from a list preserving the order. We might be tempted to use the list(set(l)) idiom, but it doesn't preserve the order, which hinders testability and does not work for lists with unhashable elements. """ result = [] for el in l: if el not in...
[ "def", "dedupe_list", "(", "l", ")", ":", "result", "=", "[", "]", "for", "el", "in", "l", ":", "if", "el", "not", "in", "result", ":", "result", ".", "append", "(", "el", ")", "return", "result" ]
Remove duplicates from a list preserving the order. We might be tempted to use the list(set(l)) idiom, but it doesn't preserve the order, which hinders testability and does not work for lists with unhashable elements.
[ "Remove", "duplicates", "from", "a", "list", "preserving", "the", "order", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/utils.py#L107-L120
train
Remove duplicates from a list preserving the order.
ldomic/lintools
lintools/plots.py
Plots.plot_amino_diagrams
def plot_amino_diagrams(self): """ Plotting of amino diagrams - circles with residue name and id, colored according to the residue type. If the protein has more than one chain, chain identity is also included in the plot. The plot is saved as svg file with residue id and chain id as file...
python
def plot_amino_diagrams(self): """ Plotting of amino diagrams - circles with residue name and id, colored according to the residue type. If the protein has more than one chain, chain identity is also included in the plot. The plot is saved as svg file with residue id and chain id as file...
[ "def", "plot_amino_diagrams", "(", "self", ")", ":", "for", "res", "in", "self", ".", "topology_data", ".", "dict_of_plotted_res", ":", "try", ":", "color", "=", "[", "self", ".", "colors_amino_acids", "[", "self", ".", "amino_acids", "[", "res", "[", "0",...
Plotting of amino diagrams - circles with residue name and id, colored according to the residue type. If the protein has more than one chain, chain identity is also included in the plot. The plot is saved as svg file with residue id and chain id as filename for more certain identification.
[ "Plotting", "of", "amino", "diagrams", "-", "circles", "with", "residue", "name", "and", "id", "colored", "according", "to", "the", "residue", "type", ".", "If", "the", "protein", "has", "more", "than", "one", "chain", "chain", "identity", "is", "also", "i...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/plots.py#L47-L71
train
Plots the amino diagrams for the amino acid.
ldomic/lintools
lintools/plots.py
Plots.plot_domain_diagrams
def plot_domain_diagrams(self): """ Plotting domain diagrams - a ring around the residue name and id and chain id. The colors are determined by the chain id and are extracted from matplotlib colormap "terrain" (ver. "09.2016") The plot is saved as svg file with residue id and chain id as...
python
def plot_domain_diagrams(self): """ Plotting domain diagrams - a ring around the residue name and id and chain id. The colors are determined by the chain id and are extracted from matplotlib colormap "terrain" (ver. "09.2016") The plot is saved as svg file with residue id and chain id as...
[ "def", "plot_domain_diagrams", "(", "self", ")", ":", "# width of the circle around plot", "width", "=", "0.20", "# define color library", "cmap", "=", "plt", ".", "get_cmap", "(", "'terrain'", ")", "colors", "=", "[", "cmap", "(", "i", ")", "for", "i", "in", ...
Plotting domain diagrams - a ring around the residue name and id and chain id. The colors are determined by the chain id and are extracted from matplotlib colormap "terrain" (ver. "09.2016") The plot is saved as svg file with residue id and chain id as filename for more certain identification.
[ "Plotting", "domain", "diagrams", "-", "a", "ring", "around", "the", "residue", "name", "and", "id", "and", "chain", "id", ".", "The", "colors", "are", "determined", "by", "the", "chain", "id", "and", "are", "extracted", "from", "matplotlib", "colormap", "...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/plots.py#L74-L103
train
Plots the domain diagrams for each amino acid.
ldomic/lintools
lintools/plots.py
Plots.plot_clock_diagrams
def plot_clock_diagrams(self, colormap="summer"): """ Ploting clock diagrams - one or more rings around residue name and id (and chain id). The rings show the fraction of simulation time this residue has spent in the vicinity of the ligand - characterised by distance. """ ...
python
def plot_clock_diagrams(self, colormap="summer"): """ Ploting clock diagrams - one or more rings around residue name and id (and chain id). The rings show the fraction of simulation time this residue has spent in the vicinity of the ligand - characterised by distance. """ ...
[ "def", "plot_clock_diagrams", "(", "self", ",", "colormap", "=", "\"summer\"", ")", ":", "cmap", "=", "plt", ".", "get_cmap", "(", "colormap", ")", "for", "res", "in", "self", ".", "topology_data", ".", "dict_of_plotted_res", ":", "colors", "=", "[", "cmap...
Ploting clock diagrams - one or more rings around residue name and id (and chain id). The rings show the fraction of simulation time this residue has spent in the vicinity of the ligand - characterised by distance.
[ "Ploting", "clock", "diagrams", "-", "one", "or", "more", "rings", "around", "residue", "name", "and", "id", "(", "and", "chain", "id", ")", ".", "The", "rings", "show", "the", "fraction", "of", "simulation", "time", "this", "residue", "has", "spent", "i...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/plots.py#L105-L133
train
Plots the clock diagrams of the ligand rings.
robinandeer/puzzle
puzzle/utils/ped.py
get_cases
def get_cases(variant_source, case_lines=None, case_type='ped', variant_type='snv', variant_mode='vcf'): """Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines ...
python
def get_cases(variant_source, case_lines=None, case_type='ped', variant_type='snv', variant_mode='vcf'): """Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines ...
[ "def", "get_cases", "(", "variant_source", ",", "case_lines", "=", "None", ",", "case_type", "=", "'ped'", ",", "variant_type", "=", "'snv'", ",", "variant_mode", "=", "'vcf'", ")", ":", "individuals", "=", "get_individuals", "(", "variant_source", "=", "varia...
Create a cases and populate it with individuals Args: variant_source (str): Path to vcf files case_lines (Iterable): Ped like lines case_type (str): Format of case lines Returns: case_objs (list(puzzle.models.Case))
[ "Create", "a", "cases", "and", "populate", "it", "with", "individuals" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/utils/ped.py#L20-L80
train
Create a list of cases and populate it with individuals
robinandeer/puzzle
puzzle/utils/ped.py
get_individuals
def get_individuals(variant_source, case_lines=None, case_type='ped', variant_mode='vcf'): """Get the individuals from a vcf file, gemini database, and/or a ped file. Args: variant_source (str): Path to a variant source case_lines(Iterable): Ped like lines ...
python
def get_individuals(variant_source, case_lines=None, case_type='ped', variant_mode='vcf'): """Get the individuals from a vcf file, gemini database, and/or a ped file. Args: variant_source (str): Path to a variant source case_lines(Iterable): Ped like lines ...
[ "def", "get_individuals", "(", "variant_source", ",", "case_lines", "=", "None", ",", "case_type", "=", "'ped'", ",", "variant_mode", "=", "'vcf'", ")", ":", "individuals", "=", "[", "]", "ind_dict", "=", "{", "}", "if", "variant_mode", "==", "'vcf'", ":",...
Get the individuals from a vcf file, gemini database, and/or a ped file. Args: variant_source (str): Path to a variant source case_lines(Iterable): Ped like lines case_type(str): Format of ped lines Returns: individuals (generator...
[ "Get", "the", "individuals", "from", "a", "vcf", "file", "gemini", "database", "and", "/", "or", "a", "ped", "file", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/utils/ped.py#L83-L177
train
Get the individuals from a vcf file gemini database and ped file.
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.handle_message
def handle_message(self, message): """Process UDP messages""" if self._yamaha: if 'power' in message: _LOGGER.debug("Power: %s", message.get('power')) self._yamaha.power = ( STATE_ON if message.get('power') == "on" else STATE_OFF) ...
python
def handle_message(self, message): """Process UDP messages""" if self._yamaha: if 'power' in message: _LOGGER.debug("Power: %s", message.get('power')) self._yamaha.power = ( STATE_ON if message.get('power') == "on" else STATE_OFF) ...
[ "def", "handle_message", "(", "self", ",", "message", ")", ":", "if", "self", ".", "_yamaha", ":", "if", "'power'", "in", "message", ":", "_LOGGER", ".", "debug", "(", "\"Power: %s\"", ",", "message", ".", "get", "(", "'power'", ")", ")", "self", ".", ...
Process UDP messages
[ "Process", "UDP", "messages" ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L54-L80
train
Process UDP messages.
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.update_status
def update_status(self, new_status=None): """Updates the zone status.""" _LOGGER.debug("update_status: Zone %s", self.zone_id) if self.status and new_status is None: _LOGGER.debug("Zone: healthy.") else: old_status = self.status or {} if new_status: ...
python
def update_status(self, new_status=None): """Updates the zone status.""" _LOGGER.debug("update_status: Zone %s", self.zone_id) if self.status and new_status is None: _LOGGER.debug("Zone: healthy.") else: old_status = self.status or {} if new_status: ...
[ "def", "update_status", "(", "self", ",", "new_status", "=", "None", ")", ":", "_LOGGER", ".", "debug", "(", "\"update_status: Zone %s\"", ",", "self", ".", "zone_id", ")", "if", "self", ".", "status", "and", "new_status", "is", "None", ":", "_LOGGER", "."...
Updates the zone status.
[ "Updates", "the", "zone", "status", "." ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L82-L117
train
Updates the status of the current object.
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.get_status
def get_status(self): """Get status from device""" req_url = ENDPOINTS["getStatus"].format(self.ip_address, self.zone_id) return request(req_url)
python
def get_status(self): """Get status from device""" req_url = ENDPOINTS["getStatus"].format(self.ip_address, self.zone_id) return request(req_url)
[ "def", "get_status", "(", "self", ")", ":", "req_url", "=", "ENDPOINTS", "[", "\"getStatus\"", "]", ".", "format", "(", "self", ".", "ip_address", ",", "self", ".", "zone_id", ")", "return", "request", "(", "req_url", ")" ]
Get status from device
[ "Get", "status", "from", "device" ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L123-L126
train
Get status from device
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.set_power
def set_power(self, power): """Send Power command.""" req_url = ENDPOINTS["setPower"].format(self.ip_address, self.zone_id) params = {"power": "on" if power else "standby"} return request(req_url, params=params)
python
def set_power(self, power): """Send Power command.""" req_url = ENDPOINTS["setPower"].format(self.ip_address, self.zone_id) params = {"power": "on" if power else "standby"} return request(req_url, params=params)
[ "def", "set_power", "(", "self", ",", "power", ")", ":", "req_url", "=", "ENDPOINTS", "[", "\"setPower\"", "]", ".", "format", "(", "self", ".", "ip_address", ",", "self", ".", "zone_id", ")", "params", "=", "{", "\"power\"", ":", "\"on\"", "if", "powe...
Send Power command.
[ "Send", "Power", "command", "." ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L133-L137
train
Send Power command.
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.set_mute
def set_mute(self, mute): """Send mute command.""" req_url = ENDPOINTS["setMute"].format(self.ip_address, self.zone_id) params = {"enable": "true" if mute else "false"} return request(req_url, params=params)
python
def set_mute(self, mute): """Send mute command.""" req_url = ENDPOINTS["setMute"].format(self.ip_address, self.zone_id) params = {"enable": "true" if mute else "false"} return request(req_url, params=params)
[ "def", "set_mute", "(", "self", ",", "mute", ")", ":", "req_url", "=", "ENDPOINTS", "[", "\"setMute\"", "]", ".", "format", "(", "self", ".", "ip_address", ",", "self", ".", "zone_id", ")", "params", "=", "{", "\"enable\"", ":", "\"true\"", "if", "mute...
Send mute command.
[ "Send", "mute", "command", "." ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L139-L143
train
Send mute command.
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.set_volume
def set_volume(self, volume): """Send Volume command.""" req_url = ENDPOINTS["setVolume"].format(self.ip_address, self.zone_id) params = {"volume": int(volume)} return request(req_url, params=params)
python
def set_volume(self, volume): """Send Volume command.""" req_url = ENDPOINTS["setVolume"].format(self.ip_address, self.zone_id) params = {"volume": int(volume)} return request(req_url, params=params)
[ "def", "set_volume", "(", "self", ",", "volume", ")", ":", "req_url", "=", "ENDPOINTS", "[", "\"setVolume\"", "]", ".", "format", "(", "self", ".", "ip_address", ",", "self", ".", "zone_id", ")", "params", "=", "{", "\"volume\"", ":", "int", "(", "volu...
Send Volume command.
[ "Send", "Volume", "command", "." ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L145-L149
train
Send Volume command.
jalmeroth/pymusiccast
pymusiccast/zone.py
Zone.set_input
def set_input(self, input_id): """Send Input command.""" req_url = ENDPOINTS["setInput"].format(self.ip_address, self.zone_id) params = {"input": input_id} return request(req_url, params=params)
python
def set_input(self, input_id): """Send Input command.""" req_url = ENDPOINTS["setInput"].format(self.ip_address, self.zone_id) params = {"input": input_id} return request(req_url, params=params)
[ "def", "set_input", "(", "self", ",", "input_id", ")", ":", "req_url", "=", "ENDPOINTS", "[", "\"setInput\"", "]", ".", "format", "(", "self", ".", "ip_address", ",", "self", ".", "zone_id", ")", "params", "=", "{", "\"input\"", ":", "input_id", "}", "...
Send Input command.
[ "Send", "Input", "command", "." ]
616379ae22d6b518c61042d58be6d18a46242168
https://github.com/jalmeroth/pymusiccast/blob/616379ae22d6b518c61042d58be6d18a46242168/pymusiccast/zone.py#L151-L155
train
Send Input command.
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/annotations.py
AnnotationExtras._add_compounds
def _add_compounds(self, variant_obj, info_dict): """Check if there are any compounds and add them to the variant The compounds that are added should be sorted on rank score """ compound_list = [] compound_entry = info_dict.get('Compounds') if compound_entry:...
python
def _add_compounds(self, variant_obj, info_dict): """Check if there are any compounds and add them to the variant The compounds that are added should be sorted on rank score """ compound_list = [] compound_entry = info_dict.get('Compounds') if compound_entry:...
[ "def", "_add_compounds", "(", "self", ",", "variant_obj", ",", "info_dict", ")", ":", "compound_list", "=", "[", "]", "compound_entry", "=", "info_dict", ".", "get", "(", "'Compounds'", ")", "if", "compound_entry", ":", "for", "family_annotation", "in", "compo...
Check if there are any compounds and add them to the variant The compounds that are added should be sorted on rank score
[ "Check", "if", "there", "are", "any", "compounds", "and", "add", "them", "to", "the", "variant", "The", "compounds", "that", "are", "added", "should", "be", "sorted", "on", "rank", "score" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/annotations.py#L11-L39
train
Add compounds to the variant object
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/annotations.py
AnnotationExtras._add_cadd_score
def _add_cadd_score(self, variant_obj, info_dict): """Add the cadd score to the variant Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary """ cadd_score = info_dict.get('CADD') if cadd_score: log...
python
def _add_cadd_score(self, variant_obj, info_dict): """Add the cadd score to the variant Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary """ cadd_score = info_dict.get('CADD') if cadd_score: log...
[ "def", "_add_cadd_score", "(", "self", ",", "variant_obj", ",", "info_dict", ")", ":", "cadd_score", "=", "info_dict", ".", "get", "(", "'CADD'", ")", "if", "cadd_score", ":", "logger", ".", "debug", "(", "\"Updating cadd_score to: {0}\"", ".", "format", "(", ...
Add the cadd score to the variant Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary
[ "Add", "the", "cadd", "score", "to", "the", "variant", "Args", ":", "variant_obj", "(", "puzzle", ".", "models", ".", "Variant", ")", "info_dict", "(", "dict", ")", ":", "A", "info", "dictionary" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/annotations.py#L41-L52
train
Updates the cadd score of the cadd_score attribute of the variant object.
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/annotations.py
AnnotationExtras._add_genetic_models
def _add_genetic_models(self, variant_obj, info_dict): """Add the genetic models found Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary """ genetic_models_entry = info_dict.get('GeneticModels') if genetic_mode...
python
def _add_genetic_models(self, variant_obj, info_dict): """Add the genetic models found Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary """ genetic_models_entry = info_dict.get('GeneticModels') if genetic_mode...
[ "def", "_add_genetic_models", "(", "self", ",", "variant_obj", ",", "info_dict", ")", ":", "genetic_models_entry", "=", "info_dict", ".", "get", "(", "'GeneticModels'", ")", "if", "genetic_models_entry", ":", "genetic_models", "=", "[", "]", "for", "family_annotat...
Add the genetic models found Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary
[ "Add", "the", "genetic", "models", "found", "Args", ":", "variant_obj", "(", "puzzle", ".", "models", ".", "Variant", ")", "info_dict", "(", "dict", ")", ":", "A", "info", "dictionary" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/annotations.py#L56-L73
train
Adds the genetic models to the variant object.
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/annotations.py
AnnotationExtras._add_rank_score
def _add_rank_score(self, variant_obj, info_dict): """Add the rank score if found Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary """ rank_score_entry = info_dict.get('RankScore') if rank_score_entry: ...
python
def _add_rank_score(self, variant_obj, info_dict): """Add the rank score if found Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary """ rank_score_entry = info_dict.get('RankScore') if rank_score_entry: ...
[ "def", "_add_rank_score", "(", "self", ",", "variant_obj", ",", "info_dict", ")", ":", "rank_score_entry", "=", "info_dict", ".", "get", "(", "'RankScore'", ")", "if", "rank_score_entry", ":", "for", "family_annotation", "in", "rank_score_entry", ".", "split", "...
Add the rank score if found Args: variant_obj (puzzle.models.Variant) info_dict (dict): A info dictionary
[ "Add", "the", "rank", "score", "if", "found", "Args", ":", "variant_obj", "(", "puzzle", ".", "models", ".", "Variant", ")", "info_dict", "(", "dict", ")", ":", "A", "info", "dictionary" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/annotations.py#L75-L89
train
Adds the rank score to the variant if it exists.
jwodder/javaproperties
javaproperties/xmlprops.py
load_xml
def load_xml(fp, object_pairs_hook=dict): r""" Parse the contents of the file-like object ``fp`` as an XML properties file and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `load_xml` only checks that the root element is named "``properties``" and that all of its ``<entr...
python
def load_xml(fp, object_pairs_hook=dict): r""" Parse the contents of the file-like object ``fp`` as an XML properties file and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `load_xml` only checks that the root element is named "``properties``" and that all of its ``<entr...
[ "def", "load_xml", "(", "fp", ",", "object_pairs_hook", "=", "dict", ")", ":", "tree", "=", "ET", ".", "parse", "(", "fp", ")", "return", "object_pairs_hook", "(", "_fromXML", "(", "tree", ".", "getroot", "(", ")", ")", ")" ]
r""" Parse the contents of the file-like object ``fp`` as an XML properties file and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `load_xml` only checks that the root element is named "``properties``" and that all of its ``<entry>`` children have ``key`` attributes. No...
[ "r", "Parse", "the", "contents", "of", "the", "file", "-", "like", "object", "fp", "as", "an", "XML", "properties", "file", "and", "return", "a", "dict", "of", "the", "key", "-", "value", "pairs", "." ]
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/xmlprops.py#L7-L41
train
r Loads the contents of the file - like object fp as an XML properties file containing the key - value pairs of the key - value pairs of the key - value pairs of the key - value pairs of the children of the root node of the a .
jwodder/javaproperties
javaproperties/xmlprops.py
loads_xml
def loads_xml(s, object_pairs_hook=dict): r""" Parse the contents of the string ``s`` as an XML properties document and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `loads_xml` only checks that the root element is named "``properties``" and that all of its ``<entry>`` c...
python
def loads_xml(s, object_pairs_hook=dict): r""" Parse the contents of the string ``s`` as an XML properties document and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `loads_xml` only checks that the root element is named "``properties``" and that all of its ``<entry>`` c...
[ "def", "loads_xml", "(", "s", ",", "object_pairs_hook", "=", "dict", ")", ":", "elem", "=", "ET", ".", "fromstring", "(", "s", ")", "return", "object_pairs_hook", "(", "_fromXML", "(", "elem", ")", ")" ]
r""" Parse the contents of the string ``s`` as an XML properties document and return a `dict` of the key-value pairs. Beyond basic XML well-formedness, `loads_xml` only checks that the root element is named "``properties``" and that all of its ``<entry>`` children have ``key`` attributes. No furth...
[ "r", "Parse", "the", "contents", "of", "the", "string", "s", "as", "an", "XML", "properties", "document", "and", "return", "a", "dict", "of", "the", "key", "-", "value", "pairs", "." ]
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/xmlprops.py#L43-L77
train
r Parses the contents of the string s as an XML properties document and returns a dict of the key - value pairs.
jwodder/javaproperties
javaproperties/xmlprops.py
dump_xml
def dump_xml(props, fp, comment=None, encoding='UTF-8', sort_keys=False): """ Write a series ``props`` of key-value pairs to a binary filehandle ``fp`` in the format of an XML properties file. The file will include both an XML declaration and a doctype declaration. :param props: A mapping or itera...
python
def dump_xml(props, fp, comment=None, encoding='UTF-8', sort_keys=False): """ Write a series ``props`` of key-value pairs to a binary filehandle ``fp`` in the format of an XML properties file. The file will include both an XML declaration and a doctype declaration. :param props: A mapping or itera...
[ "def", "dump_xml", "(", "props", ",", "fp", ",", "comment", "=", "None", ",", "encoding", "=", "'UTF-8'", ",", "sort_keys", "=", "False", ")", ":", "fp", "=", "codecs", ".", "lookup", "(", "encoding", ")", ".", "streamwriter", "(", "fp", ",", "errors...
Write a series ``props`` of key-value pairs to a binary filehandle ``fp`` in the format of an XML properties file. The file will include both an XML declaration and a doctype declaration. :param props: A mapping or iterable of ``(key, value)`` pairs to write to ``fp``. All keys and values in ``pr...
[ "Write", "a", "series", "props", "of", "key", "-", "value", "pairs", "to", "a", "binary", "filehandle", "fp", "in", "the", "format", "of", "an", "XML", "properties", "file", ".", "The", "file", "will", "include", "both", "an", "XML", "declaration", "and"...
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/xmlprops.py#L88-L112
train
Dump a series of key - value pairs to a binary filehandle fp.
jwodder/javaproperties
javaproperties/xmlprops.py
dumps_xml
def dumps_xml(props, comment=None, sort_keys=False): """ Convert a series ``props`` of key-value pairs to a text string containing an XML properties document. The document will include a doctype declaration but not an XML declaration. :param props: A mapping or iterable of ``(key, value)`` pairs t...
python
def dumps_xml(props, comment=None, sort_keys=False): """ Convert a series ``props`` of key-value pairs to a text string containing an XML properties document. The document will include a doctype declaration but not an XML declaration. :param props: A mapping or iterable of ``(key, value)`` pairs t...
[ "def", "dumps_xml", "(", "props", ",", "comment", "=", "None", ",", "sort_keys", "=", "False", ")", ":", "return", "''", ".", "join", "(", "s", "+", "'\\n'", "for", "s", "in", "_stream_xml", "(", "props", ",", "comment", ",", "sort_keys", ")", ")" ]
Convert a series ``props`` of key-value pairs to a text string containing an XML properties document. The document will include a doctype declaration but not an XML declaration. :param props: A mapping or iterable of ``(key, value)`` pairs to serialize. All keys and values in ``props`` must be tex...
[ "Convert", "a", "series", "props", "of", "key", "-", "value", "pairs", "to", "a", "text", "string", "containing", "an", "XML", "properties", "document", ".", "The", "document", "will", "include", "a", "doctype", "declaration", "but", "not", "an", "XML", "d...
8b48f040305217ebeb80c98c4354691bbb01429b
https://github.com/jwodder/javaproperties/blob/8b48f040305217ebeb80c98c4354691bbb01429b/javaproperties/xmlprops.py#L114-L130
train
Serializes a series of key - value pairs into an XML properties document.
robinandeer/puzzle
puzzle/plugins/sql/store.py
Store.connect
def connect(self, db_uri, debug=False): """Configure connection to a SQL database. Args: db_uri (str): path/URI to the database to connect to debug (Optional[bool]): whether to output logging information """ kwargs = {'echo': debug, 'convert_unicode': True} ...
python
def connect(self, db_uri, debug=False): """Configure connection to a SQL database. Args: db_uri (str): path/URI to the database to connect to debug (Optional[bool]): whether to output logging information """ kwargs = {'echo': debug, 'convert_unicode': True} ...
[ "def", "connect", "(", "self", ",", "db_uri", ",", "debug", "=", "False", ")", ":", "kwargs", "=", "{", "'echo'", ":", "debug", ",", "'convert_unicode'", ":", "True", "}", "# connect to the SQL database", "if", "'mysql'", "in", "db_uri", ":", "kwargs", "["...
Configure connection to a SQL database. Args: db_uri (str): path/URI to the database to connect to debug (Optional[bool]): whether to output logging information
[ "Configure", "connection", "to", "a", "SQL", "database", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/store.py#L62-L86
train
Configure connection to a SQL database.
robinandeer/puzzle
puzzle/plugins/sql/store.py
Store.set_up
def set_up(self, reset=False): """Initialize a new database with the default tables and columns. Returns: Store: self """ if reset: self.tear_down() logger.info("Creating database") # create the tables BASE.metadata.create_all(self.engine)...
python
def set_up(self, reset=False): """Initialize a new database with the default tables and columns. Returns: Store: self """ if reset: self.tear_down() logger.info("Creating database") # create the tables BASE.metadata.create_all(self.engine)...
[ "def", "set_up", "(", "self", ",", "reset", "=", "False", ")", ":", "if", "reset", ":", "self", ".", "tear_down", "(", ")", "logger", ".", "info", "(", "\"Creating database\"", ")", "# create the tables", "BASE", ".", "metadata", ".", "create_all", "(", ...
Initialize a new database with the default tables and columns. Returns: Store: self
[ "Initialize", "a", "new", "database", "with", "the", "default", "tables", "and", "columns", ".", "Returns", ":", "Store", ":", "self" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/store.py#L97-L108
train
Initialize a new database with the default tables and columns.
robinandeer/puzzle
puzzle/plugins/sql/store.py
Store.tear_down
def tear_down(self): """Tear down a database (tables and columns). Returns: Store: self """ # drop/delete the tables logger.info('resetting database...') BASE.metadata.drop_all(self.engine) return self
python
def tear_down(self): """Tear down a database (tables and columns). Returns: Store: self """ # drop/delete the tables logger.info('resetting database...') BASE.metadata.drop_all(self.engine) return self
[ "def", "tear_down", "(", "self", ")", ":", "# drop/delete the tables", "logger", ".", "info", "(", "'resetting database...'", ")", "BASE", ".", "metadata", ".", "drop_all", "(", "self", ".", "engine", ")", "return", "self" ]
Tear down a database (tables and columns). Returns: Store: self
[ "Tear", "down", "a", "database", "(", "tables", "and", "columns", ")", ".", "Returns", ":", "Store", ":", "self" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/store.py#L110-L118
train
Tear down a database.
robinandeer/puzzle
puzzle/plugins/sql/store.py
Store.select_plugin
def select_plugin(self, case_obj): """Select and initialize the correct plugin for the case.""" if case_obj.variant_mode == 'vcf': logger.debug("Using vcf plugin") plugin = VcfPlugin(case_obj.variant_type) elif case_obj.variant_mode == 'gemini': logger.debug("...
python
def select_plugin(self, case_obj): """Select and initialize the correct plugin for the case.""" if case_obj.variant_mode == 'vcf': logger.debug("Using vcf plugin") plugin = VcfPlugin(case_obj.variant_type) elif case_obj.variant_mode == 'gemini': logger.debug("...
[ "def", "select_plugin", "(", "self", ",", "case_obj", ")", ":", "if", "case_obj", ".", "variant_mode", "==", "'vcf'", ":", "logger", ".", "debug", "(", "\"Using vcf plugin\"", ")", "plugin", "=", "VcfPlugin", "(", "case_obj", ".", "variant_type", ")", "elif"...
Select and initialize the correct plugin for the case.
[ "Select", "and", "initialize", "the", "correct", "plugin", "for", "the", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/store.py#L131-L146
train
Select and initialize the correct plugin for the case.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
index
def index(): """Show the landing page.""" gene_lists = app.db.gene_lists() if app.config['STORE_ENABLED'] else [] queries = app.db.gemini_queries() if app.config['STORE_ENABLED'] else [] case_groups = {} for case in app.db.cases(): key = (case.variant_source, case.variant_type, case.variant...
python
def index(): """Show the landing page.""" gene_lists = app.db.gene_lists() if app.config['STORE_ENABLED'] else [] queries = app.db.gemini_queries() if app.config['STORE_ENABLED'] else [] case_groups = {} for case in app.db.cases(): key = (case.variant_source, case.variant_type, case.variant...
[ "def", "index", "(", ")", ":", "gene_lists", "=", "app", ".", "db", ".", "gene_lists", "(", ")", "if", "app", ".", "config", "[", "'STORE_ENABLED'", "]", "else", "[", "]", "queries", "=", "app", ".", "db", ".", "gemini_queries", "(", ")", "if", "ap...
Show the landing page.
[ "Show", "the", "landing", "page", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L18-L31
train
Show the landing page.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
case
def case(case_id): """Show the overview for a case.""" case_obj = app.db.case(case_id) return render_template('case.html', case=case_obj, case_id=case_id)
python
def case(case_id): """Show the overview for a case.""" case_obj = app.db.case(case_id) return render_template('case.html', case=case_obj, case_id=case_id)
[ "def", "case", "(", "case_id", ")", ":", "case_obj", "=", "app", ".", "db", ".", "case", "(", "case_id", ")", "return", "render_template", "(", "'case.html'", ",", "case", "=", "case_obj", ",", "case_id", "=", "case_id", ")" ]
Show the overview for a case.
[ "Show", "the", "overview", "for", "a", "case", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L35-L38
train
Show the overview for a case.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
phenotypes
def phenotypes(): """Add phenotype(s) to the case model.""" ind_id = request.form['ind_id'] phenotype_id = request.form['phenotype_id'] if not phenotype_id: return abort(500, 'no phenotype_id submitted') ind_obj = app.db.individual(ind_id) try: added_terms = app.db.add_phenotyp...
python
def phenotypes(): """Add phenotype(s) to the case model.""" ind_id = request.form['ind_id'] phenotype_id = request.form['phenotype_id'] if not phenotype_id: return abort(500, 'no phenotype_id submitted') ind_obj = app.db.individual(ind_id) try: added_terms = app.db.add_phenotyp...
[ "def", "phenotypes", "(", ")", ":", "ind_id", "=", "request", ".", "form", "[", "'ind_id'", "]", "phenotype_id", "=", "request", ".", "form", "[", "'phenotype_id'", "]", "if", "not", "phenotype_id", ":", "return", "abort", "(", "500", ",", "'no phenotype_i...
Add phenotype(s) to the case model.
[ "Add", "phenotype", "(", "s", ")", "to", "the", "case", "model", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L42-L62
train
Add phenotype to the case model.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
delete_phenotype
def delete_phenotype(phenotype_id): """Delete phenotype from an individual.""" ind_id = request.form['ind_id'] ind_obj = app.db.individual(ind_id) try: app.db.remove_phenotype(ind_obj, phenotype_id) except RuntimeError as error: return abort(500, error.message) return redirect(re...
python
def delete_phenotype(phenotype_id): """Delete phenotype from an individual.""" ind_id = request.form['ind_id'] ind_obj = app.db.individual(ind_id) try: app.db.remove_phenotype(ind_obj, phenotype_id) except RuntimeError as error: return abort(500, error.message) return redirect(re...
[ "def", "delete_phenotype", "(", "phenotype_id", ")", ":", "ind_id", "=", "request", ".", "form", "[", "'ind_id'", "]", "ind_obj", "=", "app", ".", "db", ".", "individual", "(", "ind_id", ")", "try", ":", "app", ".", "db", ".", "remove_phenotype", "(", ...
Delete phenotype from an individual.
[ "Delete", "phenotype", "from", "an", "individual", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L66-L74
train
Delete a phenotype from an individual.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
gene_list
def gene_list(list_id=None): """Display or add a gene list.""" all_case_ids = [case.case_id for case in app.db.cases()] if list_id: genelist_obj = app.db.gene_list(list_id) case_ids = [case.case_id for case in app.db.cases() if case not in genelist_obj.cases] if g...
python
def gene_list(list_id=None): """Display or add a gene list.""" all_case_ids = [case.case_id for case in app.db.cases()] if list_id: genelist_obj = app.db.gene_list(list_id) case_ids = [case.case_id for case in app.db.cases() if case not in genelist_obj.cases] if g...
[ "def", "gene_list", "(", "list_id", "=", "None", ")", ":", "all_case_ids", "=", "[", "case", ".", "case_id", "for", "case", "in", "app", ".", "db", ".", "cases", "(", ")", "]", "if", "list_id", ":", "genelist_obj", "=", "app", ".", "db", ".", "gene...
Display or add a gene list.
[ "Display", "or", "add", "a", "gene", "list", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L79-L123
train
Display or add a gene list.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
delete_genelist
def delete_genelist(list_id, case_id=None): """Delete a whole gene list with links to cases or a link.""" if case_id: # unlink a case from a gene list case_obj = app.db.case(case_id) app.db.remove_genelist(list_id, case_obj=case_obj) return redirect(request.referrer) else: ...
python
def delete_genelist(list_id, case_id=None): """Delete a whole gene list with links to cases or a link.""" if case_id: # unlink a case from a gene list case_obj = app.db.case(case_id) app.db.remove_genelist(list_id, case_obj=case_obj) return redirect(request.referrer) else: ...
[ "def", "delete_genelist", "(", "list_id", ",", "case_id", "=", "None", ")", ":", "if", "case_id", ":", "# unlink a case from a gene list", "case_obj", "=", "app", ".", "db", ".", "case", "(", "case_id", ")", "app", ".", "db", ".", "remove_genelist", "(", "...
Delete a whole gene list with links to cases or a link.
[ "Delete", "a", "whole", "gene", "list", "with", "links", "to", "cases", "or", "a", "link", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L128-L138
train
Delete a whole gene list with links to cases or a link.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
resources
def resources(): """Upload a new resource for an individual.""" ind_id = request.form['ind_id'] upload_dir = os.path.abspath(app.config['UPLOAD_DIR']) req_file = request.files['file'] filename = secure_filename(req_file.filename) file_path = os.path.join(upload_dir, filename) name = request...
python
def resources(): """Upload a new resource for an individual.""" ind_id = request.form['ind_id'] upload_dir = os.path.abspath(app.config['UPLOAD_DIR']) req_file = request.files['file'] filename = secure_filename(req_file.filename) file_path = os.path.join(upload_dir, filename) name = request...
[ "def", "resources", "(", ")", ":", "ind_id", "=", "request", ".", "form", "[", "'ind_id'", "]", "upload_dir", "=", "os", ".", "path", ".", "abspath", "(", "app", ".", "config", "[", "'UPLOAD_DIR'", "]", ")", "req_file", "=", "request", ".", "files", ...
Upload a new resource for an individual.
[ "Upload", "a", "new", "resource", "for", "an", "individual", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L142-L155
train
Upload a new resource for an individual.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
resource
def resource(resource_id): """Show a resource.""" resource_obj = app.db.resource(resource_id) if 'raw' in request.args: return send_from_directory(os.path.dirname(resource_obj.path), os.path.basename(resource_obj.path)) return render_template('resource.html',...
python
def resource(resource_id): """Show a resource.""" resource_obj = app.db.resource(resource_id) if 'raw' in request.args: return send_from_directory(os.path.dirname(resource_obj.path), os.path.basename(resource_obj.path)) return render_template('resource.html',...
[ "def", "resource", "(", "resource_id", ")", ":", "resource_obj", "=", "app", ".", "db", ".", "resource", "(", "resource_id", ")", "if", "'raw'", "in", "request", ".", "args", ":", "return", "send_from_directory", "(", "os", ".", "path", ".", "dirname", "...
Show a resource.
[ "Show", "a", "resource", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L159-L167
train
Show a resource.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
delete_resource
def delete_resource(resource_id): """Delete a resource.""" resource_obj = app.db.resource(resource_id) try: os.remove(resource_obj.path) except OSError as err: app.logger.debug(err.message) app.db.delete_resource(resource_id) return redirect(request.referrer)
python
def delete_resource(resource_id): """Delete a resource.""" resource_obj = app.db.resource(resource_id) try: os.remove(resource_obj.path) except OSError as err: app.logger.debug(err.message) app.db.delete_resource(resource_id) return redirect(request.referrer)
[ "def", "delete_resource", "(", "resource_id", ")", ":", "resource_obj", "=", "app", ".", "db", ".", "resource", "(", "resource_id", ")", "try", ":", "os", ".", "remove", "(", "resource_obj", ".", "path", ")", "except", "OSError", "as", "err", ":", "app",...
Delete a resource.
[ "Delete", "a", "resource", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L171-L180
train
Delete a resource.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
comments
def comments(case_id): """Upload a new comment.""" text = request.form['text'] variant_id = request.form.get('variant_id') username = request.form.get('username') case_obj = app.db.case(case_id) app.db.add_comment(case_obj, text, variant_id=variant_id, username=username) return redirect(requ...
python
def comments(case_id): """Upload a new comment.""" text = request.form['text'] variant_id = request.form.get('variant_id') username = request.form.get('username') case_obj = app.db.case(case_id) app.db.add_comment(case_obj, text, variant_id=variant_id, username=username) return redirect(requ...
[ "def", "comments", "(", "case_id", ")", ":", "text", "=", "request", ".", "form", "[", "'text'", "]", "variant_id", "=", "request", ".", "form", ".", "get", "(", "'variant_id'", ")", "username", "=", "request", ".", "form", ".", "get", "(", "'username'...
Upload a new comment.
[ "Upload", "a", "new", "comment", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L184-L191
train
Upload a new comment.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
individual
def individual(ind_id): """Show details for a specific individual.""" individual_obj = app.db.individual(ind_id) return render_template('individual.html', individual=individual_obj)
python
def individual(ind_id): """Show details for a specific individual.""" individual_obj = app.db.individual(ind_id) return render_template('individual.html', individual=individual_obj)
[ "def", "individual", "(", "ind_id", ")", ":", "individual_obj", "=", "app", ".", "db", ".", "individual", "(", "ind_id", ")", "return", "render_template", "(", "'individual.html'", ",", "individual", "=", "individual_obj", ")" ]
Show details for a specific individual.
[ "Show", "details", "for", "a", "specific", "individual", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L209-L212
train
Show details for a specific individual.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
synopsis
def synopsis(case_id): """Update the case synopsis.""" text = request.form['text'] case_obj = app.db.case(case_id) app.db.update_synopsis(case_obj, text) return redirect(request.referrer)
python
def synopsis(case_id): """Update the case synopsis.""" text = request.form['text'] case_obj = app.db.case(case_id) app.db.update_synopsis(case_obj, text) return redirect(request.referrer)
[ "def", "synopsis", "(", "case_id", ")", ":", "text", "=", "request", ".", "form", "[", "'text'", "]", "case_obj", "=", "app", ".", "db", ".", "case", "(", "case_id", ")", "app", ".", "db", ".", "update_synopsis", "(", "case_obj", ",", "text", ")", ...
Update the case synopsis.
[ "Update", "the", "case", "synopsis", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L216-L221
train
Update the case synopsis.
robinandeer/puzzle
puzzle/server/blueprints/public/views.py
add_case
def add_case(): """Make a new case out of a list of individuals.""" ind_ids = request.form.getlist('ind_id') case_id = request.form['case_id'] source = request.form['source'] variant_type = request.form['type'] if len(ind_ids) == 0: return abort(400, "must add at least one member of cas...
python
def add_case(): """Make a new case out of a list of individuals.""" ind_ids = request.form.getlist('ind_id') case_id = request.form['case_id'] source = request.form['source'] variant_type = request.form['type'] if len(ind_ids) == 0: return abort(400, "must add at least one member of cas...
[ "def", "add_case", "(", ")", ":", "ind_ids", "=", "request", ".", "form", ".", "getlist", "(", "'ind_id'", ")", "case_id", "=", "request", ".", "form", "[", "'case_id'", "]", "source", "=", "request", ".", "form", "[", "'source'", "]", "variant_type", ...
Make a new case out of a list of individuals.
[ "Make", "a", "new", "case", "out", "of", "a", "list", "of", "individuals", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/server/blueprints/public/views.py#L225-L247
train
Make a new case out of a list of individuals.
eleme/meepo
meepo/sub/dummy.py
print_sub
def print_sub(tables): """Dummy print sub. :param tables: print events of tables. """ logger = logging.getLogger("meepo.sub.print_sub") logger.info("print_sub tables: %s" % ", ".join(tables)) if not isinstance(tables, (list, set)): raise ValueError("tables should be list or set") ...
python
def print_sub(tables): """Dummy print sub. :param tables: print events of tables. """ logger = logging.getLogger("meepo.sub.print_sub") logger.info("print_sub tables: %s" % ", ".join(tables)) if not isinstance(tables, (list, set)): raise ValueError("tables should be list or set") ...
[ "def", "print_sub", "(", "tables", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "\"meepo.sub.print_sub\"", ")", "logger", ".", "info", "(", "\"print_sub tables: %s\"", "%", "\", \"", ".", "join", "(", "tables", ")", ")", "if", "not", "isinstanc...
Dummy print sub. :param tables: print events of tables.
[ "Dummy", "print", "sub", "." ]
8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a
https://github.com/eleme/meepo/blob/8212f0fe9b1d44be0c5de72d221a31c1d24bfe7a/meepo/sub/dummy.py#L11-L26
train
Dummy print sub.
okeuday/erlang_py
erlang.py
binary_to_term
def binary_to_term(data): """ Decode Erlang terms within binary data into Python types """ if not isinstance(data, bytes): raise ParseException('not bytes input') size = len(data) if size <= 1: raise ParseException('null input') if b_ord(data[0]) != _TAG_VERSION: rais...
python
def binary_to_term(data): """ Decode Erlang terms within binary data into Python types """ if not isinstance(data, bytes): raise ParseException('not bytes input') size = len(data) if size <= 1: raise ParseException('null input') if b_ord(data[0]) != _TAG_VERSION: rais...
[ "def", "binary_to_term", "(", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "bytes", ")", ":", "raise", "ParseException", "(", "'not bytes input'", ")", "size", "=", "len", "(", "data", ")", "if", "size", "<=", "1", ":", "raise", "Pars...
Decode Erlang terms within binary data into Python types
[ "Decode", "Erlang", "terms", "within", "binary", "data", "into", "Python", "types" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L440-L459
train
Decode binary data into a sequence of Erlang terms.
okeuday/erlang_py
erlang.py
term_to_binary
def term_to_binary(term, compressed=False): """ Encode Python types into Erlang terms in binary data """ data_uncompressed = _term_to_binary(term) if compressed is False: return b_chr(_TAG_VERSION) + data_uncompressed else: if compressed is True: compressed = 6 ...
python
def term_to_binary(term, compressed=False): """ Encode Python types into Erlang terms in binary data """ data_uncompressed = _term_to_binary(term) if compressed is False: return b_chr(_TAG_VERSION) + data_uncompressed else: if compressed is True: compressed = 6 ...
[ "def", "term_to_binary", "(", "term", ",", "compressed", "=", "False", ")", ":", "data_uncompressed", "=", "_term_to_binary", "(", "term", ")", "if", "compressed", "is", "False", ":", "return", "b_chr", "(", "_TAG_VERSION", ")", "+", "data_uncompressed", "else...
Encode Python types into Erlang terms in binary data
[ "Encode", "Python", "types", "into", "Erlang", "terms", "in", "binary", "data" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L461-L480
train
Encode Python types into Erlang terms in binary data.
okeuday/erlang_py
erlang.py
consult
def consult(string_in): """ provide file:consult/1 functionality with python types """ # pylint: disable=eval-used # pylint: disable=too-many-branches # pylint: disable=too-many-statements # manually parse textual erlang data to avoid external dependencies list_out = [] tuple_binary...
python
def consult(string_in): """ provide file:consult/1 functionality with python types """ # pylint: disable=eval-used # pylint: disable=too-many-branches # pylint: disable=too-many-statements # manually parse textual erlang data to avoid external dependencies list_out = [] tuple_binary...
[ "def", "consult", "(", "string_in", ")", ":", "# pylint: disable=eval-used", "# pylint: disable=too-many-branches", "# pylint: disable=too-many-statements", "# manually parse textual erlang data to avoid external dependencies", "list_out", "=", "[", "]", "tuple_binary", "=", "False",...
provide file:consult/1 functionality with python types
[ "provide", "file", ":", "consult", "/", "1", "functionality", "with", "python", "types" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L903-L976
train
Consults the contents of a string into a list of the elements of the order they appear in.
okeuday/erlang_py
erlang.py
OtpErlangAtom.binary
def binary(self): """ return encoded representation """ if isinstance(self.value, int): return b_chr(_TAG_ATOM_CACHE_REF) + b_chr(self.value) elif isinstance(self.value, TypeUnicode): value_encoded = self.value.encode('utf-8') length = len(valu...
python
def binary(self): """ return encoded representation """ if isinstance(self.value, int): return b_chr(_TAG_ATOM_CACHE_REF) + b_chr(self.value) elif isinstance(self.value, TypeUnicode): value_encoded = self.value.encode('utf-8') length = len(valu...
[ "def", "binary", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "value", ",", "int", ")", ":", "return", "b_chr", "(", "_TAG_ATOM_CACHE_REF", ")", "+", "b_chr", "(", "self", ".", "value", ")", "elif", "isinstance", "(", "self", ".", "va...
return encoded representation
[ "return", "encoded", "representation" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L118-L151
train
return encoded representation of a tag as a byte string
okeuday/erlang_py
erlang.py
OtpErlangBinary.binary
def binary(self): """ return encoded representation """ if isinstance(self.value, bytes): length = len(self.value) if length > 4294967295: raise OutputException('uint32 overflow') elif self.bits != 8: return ( ...
python
def binary(self): """ return encoded representation """ if isinstance(self.value, bytes): length = len(self.value) if length > 4294967295: raise OutputException('uint32 overflow') elif self.bits != 8: return ( ...
[ "def", "binary", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "value", ",", "bytes", ")", ":", "length", "=", "len", "(", "self", ".", "value", ")", "if", "length", ">", "4294967295", ":", "raise", "OutputException", "(", "'uint32 overf...
return encoded representation
[ "return", "encoded", "representation" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L167-L188
train
return encoded representation of the tag as a byte string
okeuday/erlang_py
erlang.py
OtpErlangList.binary
def binary(self): """ return encoded representation """ if isinstance(self.value, list): length = len(self.value) if length == 0: return b_chr(_TAG_NIL_EXT) elif length > 4294967295: raise OutputException('uint32 overflo...
python
def binary(self): """ return encoded representation """ if isinstance(self.value, list): length = len(self.value) if length == 0: return b_chr(_TAG_NIL_EXT) elif length > 4294967295: raise OutputException('uint32 overflo...
[ "def", "binary", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "value", ",", "list", ")", ":", "length", "=", "len", "(", "self", ".", "value", ")", "if", "length", "==", "0", ":", "return", "b_chr", "(", "_TAG_NIL_EXT", ")", "elif",...
return encoded representation
[ "return", "encoded", "representation" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L229-L255
train
returns encoded representation of the list of class entry
okeuday/erlang_py
erlang.py
OtpErlangPid.binary
def binary(self): """ return encoded representation """ creation_size = len(self.creation) if creation_size == 1: return ( b_chr(_TAG_PID_EXT) + self.node.binary() + self.id + self.serial + self.creation ) elif creat...
python
def binary(self): """ return encoded representation """ creation_size = len(self.creation) if creation_size == 1: return ( b_chr(_TAG_PID_EXT) + self.node.binary() + self.id + self.serial + self.creation ) elif creat...
[ "def", "binary", "(", "self", ")", ":", "creation_size", "=", "len", "(", "self", ".", "creation", ")", "if", "creation_size", "==", "1", ":", "return", "(", "b_chr", "(", "_TAG_PID_EXT", ")", "+", "self", ".", "node", ".", "binary", "(", ")", "+", ...
return encoded representation
[ "return", "encoded", "representation" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L276-L292
train
returns the binary representation of the object
okeuday/erlang_py
erlang.py
OtpErlangPort.binary
def binary(self): """ return encoded representation """ creation_size = len(self.creation) if creation_size == 1: return ( b_chr(_TAG_PORT_EXT) + self.node.binary() + self.id + self.creation ) elif creation_size == 4...
python
def binary(self): """ return encoded representation """ creation_size = len(self.creation) if creation_size == 1: return ( b_chr(_TAG_PORT_EXT) + self.node.binary() + self.id + self.creation ) elif creation_size == 4...
[ "def", "binary", "(", "self", ")", ":", "creation_size", "=", "len", "(", "self", ".", "creation", ")", "if", "creation_size", "==", "1", ":", "return", "(", "b_chr", "(", "_TAG_PORT_EXT", ")", "+", "self", ".", "node", ".", "binary", "(", ")", "+", ...
return encoded representation
[ "return", "encoded", "representation" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L314-L330
train
returns encoded representation of the port
okeuday/erlang_py
erlang.py
OtpErlangReference.binary
def binary(self): """ return encoded representation """ length = len(self.id) / 4 if length == 0: return ( b_chr(_TAG_REFERENCE_EXT) + self.node.binary() + self.id + self.creation ) elif length <= 65535: ...
python
def binary(self): """ return encoded representation """ length = len(self.id) / 4 if length == 0: return ( b_chr(_TAG_REFERENCE_EXT) + self.node.binary() + self.id + self.creation ) elif length <= 65535: ...
[ "def", "binary", "(", "self", ")", ":", "length", "=", "len", "(", "self", ".", "id", ")", "/", "4", "if", "length", "==", "0", ":", "return", "(", "b_chr", "(", "_TAG_REFERENCE_EXT", ")", "+", "self", ".", "node", ".", "binary", "(", ")", "+", ...
return encoded representation
[ "return", "encoded", "representation" ]
81b7c2ace66b6bdee23602a6802efff541223fa3
https://github.com/okeuday/erlang_py/blob/81b7c2ace66b6bdee23602a6802efff541223fa3/erlang.py#L351-L378
train
return encoded representation of the object
iwoca/django-deep-collector
deep_collector/compat/serializers/django_1_9.py
CustomizableLocalFieldsSerializer.serialize
def serialize(self, queryset, **options): """ Serialize a queryset. """ self.options = options self.stream = options.pop("stream", six.StringIO()) self.selected_fields = options.pop("fields", None) self.use_natural_foreign_keys = options.pop('use_natural_foreign_...
python
def serialize(self, queryset, **options): """ Serialize a queryset. """ self.options = options self.stream = options.pop("stream", six.StringIO()) self.selected_fields = options.pop("fields", None) self.use_natural_foreign_keys = options.pop('use_natural_foreign_...
[ "def", "serialize", "(", "self", ",", "queryset", ",", "*", "*", "options", ")", ":", "self", ".", "options", "=", "options", "self", ".", "stream", "=", "options", ".", "pop", "(", "\"stream\"", ",", "six", ".", "StringIO", "(", ")", ")", "self", ...
Serialize a queryset.
[ "Serialize", "a", "queryset", "." ]
1bd599d5362ade525cb51d6ee70713a3f58af219
https://github.com/iwoca/django-deep-collector/blob/1bd599d5362ade525cb51d6ee70713a3f58af219/deep_collector/compat/serializers/django_1_9.py#L17-L55
train
Serialize a queryset.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/resource.py
ResourceActions.add_resource
def add_resource(self, name, file_path, ind_obj): """Link a resource to an individual.""" new_resource = Resource(name=name, individual=ind_obj, path=file_path) self.session.add(new_resource) self.save() return new_resource
python
def add_resource(self, name, file_path, ind_obj): """Link a resource to an individual.""" new_resource = Resource(name=name, individual=ind_obj, path=file_path) self.session.add(new_resource) self.save() return new_resource
[ "def", "add_resource", "(", "self", ",", "name", ",", "file_path", ",", "ind_obj", ")", ":", "new_resource", "=", "Resource", "(", "name", "=", "name", ",", "individual", "=", "ind_obj", ",", "path", "=", "file_path", ")", "self", ".", "session", ".", ...
Link a resource to an individual.
[ "Link", "a", "resource", "to", "an", "individual", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/resource.py#L10-L15
train
Link a resource to an individual.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/resource.py
ResourceActions.delete_resource
def delete_resource(self, resource_id): """Link a resource to an individual.""" resource_obj = self.resource(resource_id) logger.debug("Deleting resource {0}".format(resource_obj.name)) self.session.delete(resource_obj) self.save()
python
def delete_resource(self, resource_id): """Link a resource to an individual.""" resource_obj = self.resource(resource_id) logger.debug("Deleting resource {0}".format(resource_obj.name)) self.session.delete(resource_obj) self.save()
[ "def", "delete_resource", "(", "self", ",", "resource_id", ")", ":", "resource_obj", "=", "self", ".", "resource", "(", "resource_id", ")", "logger", ".", "debug", "(", "\"Deleting resource {0}\"", ".", "format", "(", "resource_obj", ".", "name", ")", ")", "...
Link a resource to an individual.
[ "Link", "a", "resource", "to", "an", "individual", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/resource.py#L21-L26
train
Link a resource to an individual.
TiagoBras/audio-clip-extractor
audioclipextractor/parser.py
SpecsParser.parse
def parse(cls, specsFileOrString): """Parsers a file or string and returns a list of AudioClipSpec Arguments: specsFileOrString (str): specifications' file or string Examples: >>> SpecsParser.parse('23.4 34.1\n40.2 79.65 Hello World!') [<Audi...
python
def parse(cls, specsFileOrString): """Parsers a file or string and returns a list of AudioClipSpec Arguments: specsFileOrString (str): specifications' file or string Examples: >>> SpecsParser.parse('23.4 34.1\n40.2 79.65 Hello World!') [<Audi...
[ "def", "parse", "(", "cls", ",", "specsFileOrString", ")", ":", "stringToParse", "=", "None", "# Read the contents of the file if specsFileOrString is not a string", "if", "os", ".", "path", ".", "isfile", "(", "specsFileOrString", ")", ":", "with", "open", "(", "sp...
Parsers a file or string and returns a list of AudioClipSpec Arguments: specsFileOrString (str): specifications' file or string Examples: >>> SpecsParser.parse('23.4 34.1\n40.2 79.65 Hello World!') [<AudioClipSpec start:23.40, end:34.10, text:''>, ...
[ "Parsers", "a", "file", "or", "string", "and", "returns", "a", "list", "of", "AudioClipSpec", "Arguments", ":", "specsFileOrString", "(", "str", ")", ":", "specifications", "file", "or", "string", "Examples", ":", ">>>", "SpecsParser", ".", "parse", "(", "23...
b0dd90266656dcbf7e663b3e174dce4d09e74c32
https://github.com/TiagoBras/audio-clip-extractor/blob/b0dd90266656dcbf7e663b3e174dce4d09e74c32/audioclipextractor/parser.py#L82-L115
train
Parses a file or string and returns a list of AudioClipSpec objects.
TiagoBras/audio-clip-extractor
audioclipextractor/parser.py
SpecsParser._parseLine
def _parseLine(cls, line): """Parsers a single line of text and returns an AudioClipSpec Line format: <number> <number> [<text>] Returns: list(AudioClipSpec) or None """ r = cls._PROG.match(line) if not r: raise ValueError("Error: parsing '%s'. ...
python
def _parseLine(cls, line): """Parsers a single line of text and returns an AudioClipSpec Line format: <number> <number> [<text>] Returns: list(AudioClipSpec) or None """ r = cls._PROG.match(line) if not r: raise ValueError("Error: parsing '%s'. ...
[ "def", "_parseLine", "(", "cls", ",", "line", ")", ":", "r", "=", "cls", ".", "_PROG", ".", "match", "(", "line", ")", "if", "not", "r", ":", "raise", "ValueError", "(", "\"Error: parsing '%s'. Correct: \\\"<number> <number> [<text>]\\\"\"", "%", "line", ")", ...
Parsers a single line of text and returns an AudioClipSpec Line format: <number> <number> [<text>] Returns: list(AudioClipSpec) or None
[ "Parsers", "a", "single", "line", "of", "text", "and", "returns", "an", "AudioClipSpec" ]
b0dd90266656dcbf7e663b3e174dce4d09e74c32
https://github.com/TiagoBras/audio-clip-extractor/blob/b0dd90266656dcbf7e663b3e174dce4d09e74c32/audioclipextractor/parser.py#L118-L136
train
Parses a single line of text and returns an AudioClipSpec
Gawen/pytun
pytun.py
Tunnel.mode_name
def mode_name(self): """ Returns the tunnel mode's name, for printing purpose. """ for name, id in self.MODES.iteritems(): if id == self.mode: return name
python
def mode_name(self): """ Returns the tunnel mode's name, for printing purpose. """ for name, id in self.MODES.iteritems(): if id == self.mode: return name
[ "def", "mode_name", "(", "self", ")", ":", "for", "name", ",", "id", "in", "self", ".", "MODES", ".", "iteritems", "(", ")", ":", "if", "id", "==", "self", ".", "mode", ":", "return", "name" ]
Returns the tunnel mode's name, for printing purpose.
[ "Returns", "the", "tunnel", "mode", "s", "name", "for", "printing", "purpose", "." ]
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
https://github.com/Gawen/pytun/blob/a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d/pytun.py#L106-L111
train
Returns the tunnel mode s name for printing purpose.
Gawen/pytun
pytun.py
Tunnel.open
def open(self): """ Create the tunnel. If the tunnel is already opened, the function will raised an AlreadyOpened exception. """ if self.fd is not None: raise self.AlreadyOpened() logger.debug("Opening %s..." % (TUN_KO_PATH, )) self.fd = os.o...
python
def open(self): """ Create the tunnel. If the tunnel is already opened, the function will raised an AlreadyOpened exception. """ if self.fd is not None: raise self.AlreadyOpened() logger.debug("Opening %s..." % (TUN_KO_PATH, )) self.fd = os.o...
[ "def", "open", "(", "self", ")", ":", "if", "self", ".", "fd", "is", "not", "None", ":", "raise", "self", ".", "AlreadyOpened", "(", ")", "logger", ".", "debug", "(", "\"Opening %s...\"", "%", "(", "TUN_KO_PATH", ",", ")", ")", "self", ".", "fd", "...
Create the tunnel. If the tunnel is already opened, the function will raised an AlreadyOpened exception.
[ "Create", "the", "tunnel", ".", "If", "the", "tunnel", "is", "already", "opened", "the", "function", "will", "raised", "an", "AlreadyOpened", "exception", "." ]
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
https://github.com/Gawen/pytun/blob/a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d/pytun.py#L117-L142
train
Open the tunnel.
Gawen/pytun
pytun.py
Tunnel.close
def close(self): """ Close the tunnel. If the tunnel is already closed or never opened, do nothing. """ if self.fd is None: return logger.debug("Closing tunnel '%s'..." % (self.name or "", )) # Close tun.ko file os.close(...
python
def close(self): """ Close the tunnel. If the tunnel is already closed or never opened, do nothing. """ if self.fd is None: return logger.debug("Closing tunnel '%s'..." % (self.name or "", )) # Close tun.ko file os.close(...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "fd", "is", "None", ":", "return", "logger", ".", "debug", "(", "\"Closing tunnel '%s'...\"", "%", "(", "self", ".", "name", "or", "\"\"", ",", ")", ")", "# Close tun.ko file", "os", ".", "close...
Close the tunnel. If the tunnel is already closed or never opened, do nothing.
[ "Close", "the", "tunnel", ".", "If", "the", "tunnel", "is", "already", "closed", "or", "never", "opened", "do", "nothing", "." ]
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
https://github.com/Gawen/pytun/blob/a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d/pytun.py#L144-L159
train
Close the tunnel.
Gawen/pytun
pytun.py
Tunnel.recv
def recv(self, size = None): """ Receive a buffer. The default size is 1500, the classical MTU. """ size = size if size is not None else 1500 return os.read(self.fd, size)
python
def recv(self, size = None): """ Receive a buffer. The default size is 1500, the classical MTU. """ size = size if size is not None else 1500 return os.read(self.fd, size)
[ "def", "recv", "(", "self", ",", "size", "=", "None", ")", ":", "size", "=", "size", "if", "size", "is", "not", "None", "else", "1500", "return", "os", ".", "read", "(", "self", ".", "fd", ",", "size", ")" ]
Receive a buffer. The default size is 1500, the classical MTU.
[ "Receive", "a", "buffer", ".", "The", "default", "size", "is", "1500", "the", "classical", "MTU", "." ]
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
https://github.com/Gawen/pytun/blob/a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d/pytun.py#L165-L172
train
Receive a buffer.
Gawen/pytun
pytun.py
Tunnel.set_mac
def set_mac(self, mac): """ Sets the MAC address of the device to 'mac'. parameter 'mac' should be a binary representation of the MAC address Note: Will fail for TUN devices """ mac = map(ord, mac) ifreq = struct.pack('16sH6B8', self.name, socket.AF_UN...
python
def set_mac(self, mac): """ Sets the MAC address of the device to 'mac'. parameter 'mac' should be a binary representation of the MAC address Note: Will fail for TUN devices """ mac = map(ord, mac) ifreq = struct.pack('16sH6B8', self.name, socket.AF_UN...
[ "def", "set_mac", "(", "self", ",", "mac", ")", ":", "mac", "=", "map", "(", "ord", ",", "mac", ")", "ifreq", "=", "struct", ".", "pack", "(", "'16sH6B8'", ",", "self", ".", "name", ",", "socket", ".", "AF_UNIX", ",", "*", "mac", ")", "fcntl", ...
Sets the MAC address of the device to 'mac'. parameter 'mac' should be a binary representation of the MAC address Note: Will fail for TUN devices
[ "Sets", "the", "MAC", "address", "of", "the", "device", "to", "mac", ".", "parameter", "mac", "should", "be", "a", "binary", "representation", "of", "the", "MAC", "address", "Note", ":", "Will", "fail", "for", "TUN", "devices" ]
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
https://github.com/Gawen/pytun/blob/a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d/pytun.py#L174-L182
train
Sets the MAC address of the device to mac.
Gawen/pytun
pytun.py
Tunnel.set_ipv4
def set_ipv4(self, ip): """ Sets the IP address (ifr_addr) of the device parameter 'ip' should be string representation of IP address This does the same as ifconfig. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) bin_ip = socket.inet_aton(ip) ...
python
def set_ipv4(self, ip): """ Sets the IP address (ifr_addr) of the device parameter 'ip' should be string representation of IP address This does the same as ifconfig. """ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) bin_ip = socket.inet_aton(ip) ...
[ "def", "set_ipv4", "(", "self", ",", "ip", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "bin_ip", "=", "socket", ".", "inet_aton", "(", "ip", ")", "ifreq", "=", "struct", ".", ...
Sets the IP address (ifr_addr) of the device parameter 'ip' should be string representation of IP address This does the same as ifconfig.
[ "Sets", "the", "IP", "address", "(", "ifr_addr", ")", "of", "the", "device", "parameter", "ip", "should", "be", "string", "representation", "of", "IP", "address", "This", "does", "the", "same", "as", "ifconfig", "." ]
a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d
https://github.com/Gawen/pytun/blob/a1e1f86a5e2b5ed256e3b87dcdd4f6aedc6cde6d/pytun.py#L184-L194
train
Sets the IP address of the device parameter ip should be string representation of IP address.
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm.download
def download(self): """ MLBAM dataset download """ p = Pool() p.map(self._download, self.days)
python
def download(self): """ MLBAM dataset download """ p = Pool() p.map(self._download, self.days)
[ "def", "download", "(", "self", ")", ":", "p", "=", "Pool", "(", ")", "p", ".", "map", "(", "self", ".", "_download", ",", "self", ".", "days", ")" ]
MLBAM dataset download
[ "MLBAM", "dataset", "download" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L49-L54
train
Download all the entries in the MLBAM dataset
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm._download
def _download(self, timestamp): """ download MLBAM Game Day :param timestamp: day """ games, atbats, pitches = [], [], [] rosters, coaches, umpires = [], [], [] boxscores, actions = [], [] timestamp_params = { 'year': str(timestamp.year), ...
python
def _download(self, timestamp): """ download MLBAM Game Day :param timestamp: day """ games, atbats, pitches = [], [], [] rosters, coaches, umpires = [], [], [] boxscores, actions = [], [] timestamp_params = { 'year': str(timestamp.year), ...
[ "def", "_download", "(", "self", ",", "timestamp", ")", ":", "games", ",", "atbats", ",", "pitches", "=", "[", "]", ",", "[", "]", ",", "[", "]", "rosters", ",", "coaches", ",", "umpires", "=", "[", "]", ",", "[", "]", ",", "[", "]", "boxscores...
download MLBAM Game Day :param timestamp: day
[ "download", "MLBAM", "Game", "Day", ":", "param", "timestamp", ":", "day" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L56-L114
train
Download MLBAM Game Day and return a list of dictionaries.
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm._get_game_number
def _get_game_number(cls, gid_path): """ Game Number :param gid_path: game logs directory path :return: game number(int) """ game_number = str(gid_path[len(gid_path)-2:len(gid_path)-1]) if game_number.isdigit(): return int(game_number) else: ...
python
def _get_game_number(cls, gid_path): """ Game Number :param gid_path: game logs directory path :return: game number(int) """ game_number = str(gid_path[len(gid_path)-2:len(gid_path)-1]) if game_number.isdigit(): return int(game_number) else: ...
[ "def", "_get_game_number", "(", "cls", ",", "gid_path", ")", ":", "game_number", "=", "str", "(", "gid_path", "[", "len", "(", "gid_path", ")", "-", "2", ":", "len", "(", "gid_path", ")", "-", "1", "]", ")", "if", "game_number", ".", "isdigit", "(", ...
Game Number :param gid_path: game logs directory path :return: game number(int)
[ "Game", "Number", ":", "param", "gid_path", ":", "game", "logs", "directory", "path", ":", "return", ":", "game", "number", "(", "int", ")" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L117-L130
train
Get game number from game logs directory path.
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm._write_csv
def _write_csv(self, datasets, filename): """ Write CSV :param datasets: Datasets :param filename: File Name """ with open('/'.join([self.output, filename]), mode='w', encoding=self.encoding) as write_file: writer = csv.writer(write_file, delimiter=',') ...
python
def _write_csv(self, datasets, filename): """ Write CSV :param datasets: Datasets :param filename: File Name """ with open('/'.join([self.output, filename]), mode='w', encoding=self.encoding) as write_file: writer = csv.writer(write_file, delimiter=',') ...
[ "def", "_write_csv", "(", "self", ",", "datasets", ",", "filename", ")", ":", "with", "open", "(", "'/'", ".", "join", "(", "[", "self", ".", "output", ",", "filename", "]", ")", ",", "mode", "=", "'w'", ",", "encoding", "=", "self", ".", "encoding...
Write CSV :param datasets: Datasets :param filename: File Name
[ "Write", "CSV", ":", "param", "datasets", ":", "Datasets", ":", "param", "filename", ":", "File", "Name" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L132-L144
train
Write CSV file.
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm._validate_datetime
def _validate_datetime(cls, value): """ validate datetime value :param value: datetime value :return: None or validators.Invalid or MlbAmException """ datetime_check = validators.Int() datetime_check.to_python(value) if len(value) != 8: raise M...
python
def _validate_datetime(cls, value): """ validate datetime value :param value: datetime value :return: None or validators.Invalid or MlbAmException """ datetime_check = validators.Int() datetime_check.to_python(value) if len(value) != 8: raise M...
[ "def", "_validate_datetime", "(", "cls", ",", "value", ")", ":", "datetime_check", "=", "validators", ".", "Int", "(", ")", "datetime_check", ".", "to_python", "(", "value", ")", "if", "len", "(", "value", ")", "!=", "8", ":", "raise", "MlbAmBadParameter",...
validate datetime value :param value: datetime value :return: None or validators.Invalid or MlbAmException
[ "validate", "datetime", "value", ":", "param", "value", ":", "datetime", "value", ":", "return", ":", "None", "or", "validators", ".", "Invalid", "or", "MlbAmException" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L147-L156
train
validate datetime value
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm._validate_datetime_from_to
def _validate_datetime_from_to(cls, start, end): """ validate from-to :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :return: None or MlbAmException """ if not start <= end: raise MlbAmBadParameter("not Start Day({start}) <= End Day({e...
python
def _validate_datetime_from_to(cls, start, end): """ validate from-to :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :return: None or MlbAmException """ if not start <= end: raise MlbAmBadParameter("not Start Day({start}) <= End Day({e...
[ "def", "_validate_datetime_from_to", "(", "cls", ",", "start", ",", "end", ")", ":", "if", "not", "start", "<=", "end", ":", "raise", "MlbAmBadParameter", "(", "\"not Start Day({start}) <= End Day({end})\"", ".", "format", "(", "start", "=", "start", ",", "end",...
validate from-to :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :return: None or MlbAmException
[ "validate", "from", "-", "to", ":", "param", "start", ":", "Start", "Day", "(", "YYYYMMDD", ")", ":", "param", "end", ":", "End", "Day", "(", "YYYYMMDD", ")", ":", "return", ":", "None", "or", "MlbAmException" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L159-L167
train
Validate datetime from start to end.
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm._days
def _days(cls, start, end): """ Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) """ days = [] # datetime start_day, end_day = dt.strptime(start, cls.DATE_FORMAT), dt.strptime(end, cls.DATE_FORMAT) delta = end_day...
python
def _days(cls, start, end): """ Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) """ days = [] # datetime start_day, end_day = dt.strptime(start, cls.DATE_FORMAT), dt.strptime(end, cls.DATE_FORMAT) delta = end_day...
[ "def", "_days", "(", "cls", ",", "start", ",", "end", ")", ":", "days", "=", "[", "]", "# datetime", "start_day", ",", "end_day", "=", "dt", ".", "strptime", "(", "start", ",", "cls", ".", "DATE_FORMAT", ")", ",", "dt", ".", "strptime", "(", "end",...
Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD)
[ "Scrape", "a", "MLBAM", "Data", ":", "param", "start", ":", "Start", "Day", "(", "YYYYMMDD", ")", ":", "param", "end", ":", "End", "Day", "(", "YYYYMMDD", ")" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L170-L183
train
Scrape a MLBAM Data
Shinichi-Nakagawa/pitchpx
pitchpx/mlbam.py
MlbAm.scrape
def scrape(cls, start, end, output): """ Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :param output: Output directory """ # Logger setting logging.basicConfig( level=logging.INFO, format="time:...
python
def scrape(cls, start, end, output): """ Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :param output: Output directory """ # Logger setting logging.basicConfig( level=logging.INFO, format="time:...
[ "def", "scrape", "(", "cls", ",", "start", ",", "end", ",", "output", ")", ":", "# Logger setting", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "INFO", ",", "format", "=", "\"time:%(asctime)s.%(msecs)03d\"", "+", "\"\\tmessage:%(message)s\"...
Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :param output: Output directory
[ "Scrape", "a", "MLBAM", "Data", ":", "param", "start", ":", "Start", "Day", "(", "YYYYMMDD", ")", ":", "param", "end", ":", "End", "Day", "(", "YYYYMMDD", ")", ":", "param", "output", ":", "Output", "directory" ]
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/mlbam.py#L186-L212
train
Scrape a MLBAM data file from start to end.
ldomic/lintools
lintools/analysis/salt_bridges.py
SaltBridges.find_salt_bridges
def find_salt_bridges(self): """First the atom names of protein charge centers are found as these can be different in different forcefields. Then a Euclidian distance is measured between charged ligand atoms and respective inverted charge centres on protein. If the distance s lower than threshol...
python
def find_salt_bridges(self): """First the atom names of protein charge centers are found as these can be different in different forcefields. Then a Euclidian distance is measured between charged ligand atoms and respective inverted charge centres on protein. If the distance s lower than threshol...
[ "def", "find_salt_bridges", "(", "self", ")", ":", "#Define charge centers for protein - atom names", "charge_definitions", "=", "{", "\"ARG\"", ":", "\"name C* and around 1.4 (name N* and not name N)\"", ",", "#carbon atom surrounded by nitrogens that are not in the peptide bond", "\"...
First the atom names of protein charge centers are found as these can be different in different forcefields. Then a Euclidian distance is measured between charged ligand atoms and respective inverted charge centres on protein. If the distance s lower than threshold (5.5 angstrom) the interaction is reco...
[ "First", "the", "atom", "names", "of", "protein", "charge", "centers", "are", "found", "as", "these", "can", "be", "different", "in", "different", "forcefields", ".", "Then", "a", "Euclidian", "distance", "is", "measured", "between", "charged", "ligand", "atom...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/salt_bridges.py#L54-L127
train
Find the salt bridges for the current ligand atom.
ldomic/lintools
lintools/analysis/salt_bridges.py
SaltBridges.make_table
def make_table(self): """Make numpy array from timeseries data.""" num_records = int(np.sum([1 for frame in self.timeseries])) dtype = [("frame",float),("time",float),("ligand atom id",int), ("ligand atom name","|U4"),("distance",float), ("resid",int),("resname","...
python
def make_table(self): """Make numpy array from timeseries data.""" num_records = int(np.sum([1 for frame in self.timeseries])) dtype = [("frame",float),("time",float),("ligand atom id",int), ("ligand atom name","|U4"),("distance",float), ("resid",int),("resname","...
[ "def", "make_table", "(", "self", ")", ":", "num_records", "=", "int", "(", "np", ".", "sum", "(", "[", "1", "for", "frame", "in", "self", ".", "timeseries", "]", ")", ")", "dtype", "=", "[", "(", "\"frame\"", ",", "float", ")", ",", "(", "\"time...
Make numpy array from timeseries data.
[ "Make", "numpy", "array", "from", "timeseries", "data", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/salt_bridges.py#L129-L141
train
Make numpy array from timeseries data.
ldomic/lintools
lintools/analysis/salt_bridges.py
SaltBridges.count_by_type
def count_by_type(self): """Count how many times each individual salt bridge occured throughout the simulation. Returns numpy array.""" saltbridges = defaultdict(int) for contact in self.timeseries: #count by residue name not by proteinring pkey = (contact.liganda...
python
def count_by_type(self): """Count how many times each individual salt bridge occured throughout the simulation. Returns numpy array.""" saltbridges = defaultdict(int) for contact in self.timeseries: #count by residue name not by proteinring pkey = (contact.liganda...
[ "def", "count_by_type", "(", "self", ")", ":", "saltbridges", "=", "defaultdict", "(", "int", ")", "for", "contact", "in", "self", ".", "timeseries", ":", "#count by residue name not by proteinring", "pkey", "=", "(", "contact", ".", "ligandatomid", ",", "contac...
Count how many times each individual salt bridge occured throughout the simulation. Returns numpy array.
[ "Count", "how", "many", "times", "each", "individual", "salt", "bridge", "occured", "throughout", "the", "simulation", ".", "Returns", "numpy", "array", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/salt_bridges.py#L143-L156
train
Count how many times each individual salt bridge occured throughout the simulation.
ldomic/lintools
lintools/analysis/salt_bridges.py
SaltBridges.count_by_time
def count_by_time(self): """Count how many salt bridges occured in each frame. Returns numpy array.""" out = np.empty((len(self.timesteps),), dtype=[('time', float), ('count', int)]) for cursor,timestep in enumerate(self.timesteps): out[cursor] = (timestep,len([x for x in sel...
python
def count_by_time(self): """Count how many salt bridges occured in each frame. Returns numpy array.""" out = np.empty((len(self.timesteps),), dtype=[('time', float), ('count', int)]) for cursor,timestep in enumerate(self.timesteps): out[cursor] = (timestep,len([x for x in sel...
[ "def", "count_by_time", "(", "self", ")", ":", "out", "=", "np", ".", "empty", "(", "(", "len", "(", "self", ".", "timesteps", ")", ",", ")", ",", "dtype", "=", "[", "(", "'time'", ",", "float", ")", ",", "(", "'count'", ",", "int", ")", "]", ...
Count how many salt bridges occured in each frame. Returns numpy array.
[ "Count", "how", "many", "salt", "bridges", "occured", "in", "each", "frame", ".", "Returns", "numpy", "array", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/salt_bridges.py#L158-L164
train
Count how many salt bridges occured in each frame.
ldomic/lintools
lintools/analysis/salt_bridges.py
SaltBridges.get_saltbridge_frequency
def get_saltbridge_frequency(self,analysis_cutoff): """Calculates the frequency of salt bridges throughout simulations. If the frequency exceeds the analysis cutoff, this interaction will be taken for further consideration. Takes: * analysis_cutoff * - fraction of simulation time a f...
python
def get_saltbridge_frequency(self,analysis_cutoff): """Calculates the frequency of salt bridges throughout simulations. If the frequency exceeds the analysis cutoff, this interaction will be taken for further consideration. Takes: * analysis_cutoff * - fraction of simulation time a f...
[ "def", "get_saltbridge_frequency", "(", "self", ",", "analysis_cutoff", ")", ":", "self", ".", "frequency", "=", "defaultdict", "(", "int", ")", "for", "traj", "in", "self", ".", "saltbridges_by_type", ":", "for", "contact", "in", "self", ".", "saltbridges_by_...
Calculates the frequency of salt bridges throughout simulations. If the frequency exceeds the analysis cutoff, this interaction will be taken for further consideration. Takes: * analysis_cutoff * - fraction of simulation time a feature has to be present for to be plotted Output: ...
[ "Calculates", "the", "frequency", "of", "salt", "bridges", "throughout", "simulations", ".", "If", "the", "frequency", "exceeds", "the", "analysis", "cutoff", "this", "interaction", "will", "be", "taken", "for", "further", "consideration", ".", "Takes", ":", "*"...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/analysis/salt_bridges.py#L166-L181
train
Calculates the frequency of salt bridges throughout simulations.
inveniosoftware-contrib/json-merger
json_merger/config.py
DictMergerOps.keep_longest
def keep_longest(head, update, down_path): """Keep longest field among `head` and `update`. """ if update is None: return 'f' if head is None: return 's' return 'f' if len(head) >= len(update) else 's'
python
def keep_longest(head, update, down_path): """Keep longest field among `head` and `update`. """ if update is None: return 'f' if head is None: return 's' return 'f' if len(head) >= len(update) else 's'
[ "def", "keep_longest", "(", "head", ",", "update", ",", "down_path", ")", ":", "if", "update", "is", "None", ":", "return", "'f'", "if", "head", "is", "None", ":", "return", "'s'", "return", "'f'", "if", "len", "(", "head", ")", ">=", "len", "(", "...
Keep longest field among `head` and `update`.
[ "Keep", "longest", "field", "among", "head", "and", "update", "." ]
adc6d372da018427e1db7b92424d3471e01a4118
https://github.com/inveniosoftware-contrib/json-merger/blob/adc6d372da018427e1db7b92424d3471e01a4118/json_merger/config.py#L40-L48
train
Keep longest field among head and update.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/comment.py
CommentActions.comments
def comments(self, case_id=None, variant_id=None, username=None): """Return comments for a case or variant. Args: case_id (str): id for a related case variant_id (Optional[str]): id for a related variant """ logger.debug("Looking for comments") comment_ob...
python
def comments(self, case_id=None, variant_id=None, username=None): """Return comments for a case or variant. Args: case_id (str): id for a related case variant_id (Optional[str]): id for a related variant """ logger.debug("Looking for comments") comment_ob...
[ "def", "comments", "(", "self", ",", "case_id", "=", "None", ",", "variant_id", "=", "None", ",", "username", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"Looking for comments\"", ")", "comment_objs", "=", "self", ".", "query", "(", "Comment", ...
Return comments for a case or variant. Args: case_id (str): id for a related case variant_id (Optional[str]): id for a related variant
[ "Return", "comments", "for", "a", "case", "or", "variant", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/comment.py#L10-L28
train
Return comments for a case or variant.
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/comment.py
CommentActions.add_comment
def add_comment(self, case_obj, text, variant_id=None, username=None): """Add a comment to a variant or a case""" comment = Comment( text=text, username=username or 'Anonymous', case=case_obj, # md5 sum of chrom, pos, ref, alt variant_id=varia...
python
def add_comment(self, case_obj, text, variant_id=None, username=None): """Add a comment to a variant or a case""" comment = Comment( text=text, username=username or 'Anonymous', case=case_obj, # md5 sum of chrom, pos, ref, alt variant_id=varia...
[ "def", "add_comment", "(", "self", ",", "case_obj", ",", "text", ",", "variant_id", "=", "None", ",", "username", "=", "None", ")", ":", "comment", "=", "Comment", "(", "text", "=", "text", ",", "username", "=", "username", "or", "'Anonymous'", ",", "c...
Add a comment to a variant or a case
[ "Add", "a", "comment", "to", "a", "variant", "or", "a", "case" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/comment.py#L38-L50
train
Add a comment to a variant or a case
robinandeer/puzzle
puzzle/plugins/sql/mixins/actions/comment.py
CommentActions.delete_comment
def delete_comment(self, comment_id): """Delete a comment""" comment_obj = self.query(Comment).get(comment_id) if comment_obj: logger.debug("Deleting comment {0}".format(comment_obj.id)) self.session.delete(comment_obj) self.save() return comment_obj
python
def delete_comment(self, comment_id): """Delete a comment""" comment_obj = self.query(Comment).get(comment_id) if comment_obj: logger.debug("Deleting comment {0}".format(comment_obj.id)) self.session.delete(comment_obj) self.save() return comment_obj
[ "def", "delete_comment", "(", "self", ",", "comment_id", ")", ":", "comment_obj", "=", "self", ".", "query", "(", "Comment", ")", ".", "get", "(", "comment_id", ")", "if", "comment_obj", ":", "logger", ".", "debug", "(", "\"Deleting comment {0}\"", ".", "f...
Delete a comment
[ "Delete", "a", "comment" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/sql/mixins/actions/comment.py#L52-L62
train
Delete a comment
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/consequences.py
ConsequenceExtras._add_consequences
def _add_consequences(self, variant_obj, raw_variant_line): """Add the consequences found for a variant Args: variant_obj (puzzle.models.Variant) raw_variant_line (str): A raw vcf variant line """ consequences = [] for consequence in SO_TERMS:...
python
def _add_consequences(self, variant_obj, raw_variant_line): """Add the consequences found for a variant Args: variant_obj (puzzle.models.Variant) raw_variant_line (str): A raw vcf variant line """ consequences = [] for consequence in SO_TERMS:...
[ "def", "_add_consequences", "(", "self", ",", "variant_obj", ",", "raw_variant_line", ")", ":", "consequences", "=", "[", "]", "for", "consequence", "in", "SO_TERMS", ":", "if", "consequence", "in", "raw_variant_line", ":", "consequences", ".", "append", "(", ...
Add the consequences found for a variant Args: variant_obj (puzzle.models.Variant) raw_variant_line (str): A raw vcf variant line
[ "Add", "the", "consequences", "found", "for", "a", "variant" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/consequences.py#L10-L22
train
Add the consequences found for a variant in a raw vcf variant.
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/consequences.py
ConsequenceExtras._add_most_severe_consequence
def _add_most_severe_consequence(self, variant_obj): """Add the most severe consequence Args: variant_obj (puzzle.models.Variant) """ most_severe_consequence = None most_severe_score = None for consequence in variant_obj.consequences: ...
python
def _add_most_severe_consequence(self, variant_obj): """Add the most severe consequence Args: variant_obj (puzzle.models.Variant) """ most_severe_consequence = None most_severe_score = None for consequence in variant_obj.consequences: ...
[ "def", "_add_most_severe_consequence", "(", "self", ",", "variant_obj", ")", ":", "most_severe_consequence", "=", "None", "most_severe_score", "=", "None", "for", "consequence", "in", "variant_obj", ".", "consequences", ":", "logger", ".", "debug", "(", "\"Checking ...
Add the most severe consequence Args: variant_obj (puzzle.models.Variant)
[ "Add", "the", "most", "severe", "consequence", "Args", ":", "variant_obj", "(", "puzzle", ".", "models", ".", "Variant", ")" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/consequences.py#L24-L49
train
Adds the most severe consequence to the variant_obj.
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_extras/consequences.py
ConsequenceExtras._add_impact_severity
def _add_impact_severity(self, variant_obj): """Add the impact severity for the most severe consequence Args: variant_obj (puzzle.models.Variant) """ if variant_obj.most_severe_consequence: variant_obj.impact_severity = IMPACT_SEVERITIES....
python
def _add_impact_severity(self, variant_obj): """Add the impact severity for the most severe consequence Args: variant_obj (puzzle.models.Variant) """ if variant_obj.most_severe_consequence: variant_obj.impact_severity = IMPACT_SEVERITIES....
[ "def", "_add_impact_severity", "(", "self", ",", "variant_obj", ")", ":", "if", "variant_obj", ".", "most_severe_consequence", ":", "variant_obj", ".", "impact_severity", "=", "IMPACT_SEVERITIES", ".", "get", "(", "variant_obj", ".", "most_severe_consequence", ")" ]
Add the impact severity for the most severe consequence Args: variant_obj (puzzle.models.Variant)
[ "Add", "the", "impact", "severity", "for", "the", "most", "severe", "consequence", "Args", ":", "variant_obj", "(", "puzzle", ".", "models", ".", "Variant", ")" ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_extras/consequences.py#L51-L61
train
Adds the impact severity for the most severe consequence sequence in the variant_obj.
ellethee/argparseinator
argparseinator/utils.py
check_class
def check_class(): """ Return the class name for the current frame. If the result is ** None ** means that the call is made from a module. """ # get frames frames = inspect.stack() cls = None # should be the third frame # 0: this function # 1: function/decorator # 2: class th...
python
def check_class(): """ Return the class name for the current frame. If the result is ** None ** means that the call is made from a module. """ # get frames frames = inspect.stack() cls = None # should be the third frame # 0: this function # 1: function/decorator # 2: class th...
[ "def", "check_class", "(", ")", ":", "# get frames", "frames", "=", "inspect", ".", "stack", "(", ")", "cls", "=", "None", "# should be the third frame", "# 0: this function", "# 1: function/decorator", "# 2: class that contains the function", "if", "len", "(", "frames"...
Return the class name for the current frame. If the result is ** None ** means that the call is made from a module.
[ "Return", "the", "class", "name", "for", "the", "current", "frame", ".", "If", "the", "result", "is", "**", "None", "**", "means", "that", "the", "call", "is", "made", "from", "a", "module", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L68-L85
train
Return the class name for the current frame.
ellethee/argparseinator
argparseinator/utils.py
collect_appendvars
def collect_appendvars(ap_, cls): """ colleziona elementi per le liste. """ for key, value in cls.__dict__.items(): if key.startswith('appendvars_'): varname = key[11:] if varname not in ap_.appendvars: ap_.appendvars[varname] = [] if value not...
python
def collect_appendvars(ap_, cls): """ colleziona elementi per le liste. """ for key, value in cls.__dict__.items(): if key.startswith('appendvars_'): varname = key[11:] if varname not in ap_.appendvars: ap_.appendvars[varname] = [] if value not...
[ "def", "collect_appendvars", "(", "ap_", ",", "cls", ")", ":", "for", "key", ",", "value", "in", "cls", ".", "__dict__", ".", "items", "(", ")", ":", "if", "key", ".", "startswith", "(", "'appendvars_'", ")", ":", "varname", "=", "key", "[", "11", ...
colleziona elementi per le liste.
[ "colleziona", "elementi", "per", "le", "liste", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L88-L100
train
collects all appendvars in the list
ellethee/argparseinator
argparseinator/utils.py
isglob
def isglob(value): """ Windows non traduce automaticamente i wildchars così lo facciamo a mano tramite glob. :param value: Espressione glob per la lista dei files. :type value: str """ if os.name == 'nt': if isinstance(value, basestring): value = glob.glob(value) ret...
python
def isglob(value): """ Windows non traduce automaticamente i wildchars così lo facciamo a mano tramite glob. :param value: Espressione glob per la lista dei files. :type value: str """ if os.name == 'nt': if isinstance(value, basestring): value = glob.glob(value) ret...
[ "def", "isglob", "(", "value", ")", ":", "if", "os", ".", "name", "==", "'nt'", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "glob", ".", "glob", "(", "value", ")", "return", "value" ]
Windows non traduce automaticamente i wildchars così lo facciamo a mano tramite glob. :param value: Espressione glob per la lista dei files. :type value: str
[ "Windows", "non", "traduce", "automaticamente", "i", "wildchars", "così", "lo", "facciamo", "a", "mano", "tramite", "glob", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L103-L114
train
Windows non traduce automaticamente i wildchars così lo facciamo a mano tramite glob.
ellethee/argparseinator
argparseinator/utils.py
string_or_bool
def string_or_bool(value): """ Ritorna True o False in caso venga passata la stringa 'true' o 'false' (o 't' o 'f') altrimenti ritorna una stringa. :param value: Stringa da analizzare. :type value: str """ if value.lower() in ['t', 'true']: value = True elif value.lower() in ['f...
python
def string_or_bool(value): """ Ritorna True o False in caso venga passata la stringa 'true' o 'false' (o 't' o 'f') altrimenti ritorna una stringa. :param value: Stringa da analizzare. :type value: str """ if value.lower() in ['t', 'true']: value = True elif value.lower() in ['f...
[ "def", "string_or_bool", "(", "value", ")", ":", "if", "value", ".", "lower", "(", ")", "in", "[", "'t'", ",", "'true'", "]", ":", "value", "=", "True", "elif", "value", ".", "lower", "(", ")", "in", "[", "'f'", ",", "'false'", "]", ":", "value",...
Ritorna True o False in caso venga passata la stringa 'true' o 'false' (o 't' o 'f') altrimenti ritorna una stringa. :param value: Stringa da analizzare. :type value: str
[ "Ritorna", "True", "o", "False", "in", "caso", "venga", "passata", "la", "stringa", "true", "o", "false", "(", "o", "t", "o", "f", ")", "altrimenti", "ritorna", "una", "stringa", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L117-L133
train
A string o bool
ellethee/argparseinator
argparseinator/utils.py
has_shared
def has_shared(arg, shared): """ Verifica se ci sono shared. """ try: if isinstance(shared, list): shared_arguments = shared else: shared_arguments = shared.__shared_arguments__ for idx, (args, kwargs) in enumerate(shared_arguments): arg_name =...
python
def has_shared(arg, shared): """ Verifica se ci sono shared. """ try: if isinstance(shared, list): shared_arguments = shared else: shared_arguments = shared.__shared_arguments__ for idx, (args, kwargs) in enumerate(shared_arguments): arg_name =...
[ "def", "has_shared", "(", "arg", ",", "shared", ")", ":", "try", ":", "if", "isinstance", "(", "shared", ",", "list", ")", ":", "shared_arguments", "=", "shared", "else", ":", "shared_arguments", "=", "shared", ".", "__shared_arguments__", "for", "idx", ",...
Verifica se ci sono shared.
[ "Verifica", "se", "ci", "sono", "shared", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L136-L153
train
Return the index of the first element in the list of shared items.
ellethee/argparseinator
argparseinator/utils.py
has_argument
def has_argument(arg, arguments): """ Verifica se ci sono argument con la classe. """ try: if not isinstance(arguments, list): arguments = arguments.__arguments__ for idx, (args, kwargs) in enumerate(arguments): arg_name = kwargs.get( 'dest', args[...
python
def has_argument(arg, arguments): """ Verifica se ci sono argument con la classe. """ try: if not isinstance(arguments, list): arguments = arguments.__arguments__ for idx, (args, kwargs) in enumerate(arguments): arg_name = kwargs.get( 'dest', args[...
[ "def", "has_argument", "(", "arg", ",", "arguments", ")", ":", "try", ":", "if", "not", "isinstance", "(", "arguments", ",", "list", ")", ":", "arguments", "=", "arguments", ".", "__arguments__", "for", "idx", ",", "(", "args", ",", "kwargs", ")", "in"...
Verifica se ci sono argument con la classe.
[ "Verifica", "se", "ci", "sono", "argument", "con", "la", "classe", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L156-L171
train
Verifica se ci sono argument con la classe.
ellethee/argparseinator
argparseinator/utils.py
get_functarguments
def get_functarguments(func): """ Recupera gli argomenti dalla funzione stessa. """ argspec = inspect.getargspec(func) if argspec.defaults is not None: args = argspec.args[:-len(argspec.defaults)] kwargs = dict( zip(argspec.args[-len(argspec.defaults):], argspec.defaults)...
python
def get_functarguments(func): """ Recupera gli argomenti dalla funzione stessa. """ argspec = inspect.getargspec(func) if argspec.defaults is not None: args = argspec.args[:-len(argspec.defaults)] kwargs = dict( zip(argspec.args[-len(argspec.defaults):], argspec.defaults)...
[ "def", "get_functarguments", "(", "func", ")", ":", "argspec", "=", "inspect", ".", "getargspec", "(", "func", ")", "if", "argspec", ".", "defaults", "is", "not", "None", ":", "args", "=", "argspec", ".", "args", "[", ":", "-", "len", "(", "argspec", ...
Recupera gli argomenti dalla funzione stessa.
[ "Recupera", "gli", "argomenti", "dalla", "funzione", "stessa", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L174-L215
train
Return a list of functions that are passed to the function.
ellethee/argparseinator
argparseinator/utils.py
get_parser
def get_parser(func, parent): """ Imposta il parser. """ parser = parent.add_parser(func.__cmd_name__, help=func.__doc__) for args, kwargs in func.__arguments__: parser.add_argument(*args, **kwargs) return parser
python
def get_parser(func, parent): """ Imposta il parser. """ parser = parent.add_parser(func.__cmd_name__, help=func.__doc__) for args, kwargs in func.__arguments__: parser.add_argument(*args, **kwargs) return parser
[ "def", "get_parser", "(", "func", ",", "parent", ")", ":", "parser", "=", "parent", ".", "add_parser", "(", "func", ".", "__cmd_name__", ",", "help", "=", "func", ".", "__doc__", ")", "for", "args", ",", "kwargs", "in", "func", ".", "__arguments__", ":...
Imposta il parser.
[ "Imposta", "il", "parser", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L218-L225
train
Get Imposta il parser.
ellethee/argparseinator
argparseinator/utils.py
get_shared
def get_shared(func): """ return shared. """ shared = [] if not hasattr(func, '__cls__'): return shared if not hasattr(func.__cls__, '__shared_arguments__'): return shared if hasattr(func, '__no_share__'): if func.__no_share__ is True: return shared ...
python
def get_shared(func): """ return shared. """ shared = [] if not hasattr(func, '__cls__'): return shared if not hasattr(func.__cls__, '__shared_arguments__'): return shared if hasattr(func, '__no_share__'): if func.__no_share__ is True: return shared ...
[ "def", "get_shared", "(", "func", ")", ":", "shared", "=", "[", "]", "if", "not", "hasattr", "(", "func", ",", "'__cls__'", ")", ":", "return", "shared", "if", "not", "hasattr", "(", "func", ".", "__cls__", ",", "'__shared_arguments__'", ")", ":", "ret...
return shared.
[ "return", "shared", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L228-L247
train
get_shared - Returns a list of all the shared items of the given function
ellethee/argparseinator
argparseinator/utils.py
set_subcommands
def set_subcommands(func, parser): """ Set subcommands. """ if hasattr(func, '__subcommands__') and func.__subcommands__: sub_parser = parser.add_subparsers( title=SUBCOMMANDS_LIST_TITLE, dest='subcommand', description=SUBCOMMANDS_LIST_DESCRIPTION.format( ...
python
def set_subcommands(func, parser): """ Set subcommands. """ if hasattr(func, '__subcommands__') and func.__subcommands__: sub_parser = parser.add_subparsers( title=SUBCOMMANDS_LIST_TITLE, dest='subcommand', description=SUBCOMMANDS_LIST_DESCRIPTION.format( ...
[ "def", "set_subcommands", "(", "func", ",", "parser", ")", ":", "if", "hasattr", "(", "func", ",", "'__subcommands__'", ")", "and", "func", ".", "__subcommands__", ":", "sub_parser", "=", "parser", ".", "add_subparsers", "(", "title", "=", "SUBCOMMANDS_LIST_TI...
Set subcommands.
[ "Set", "subcommands", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L250-L266
train
Set subcommands.
ellethee/argparseinator
argparseinator/utils.py
check_help
def check_help(): """ check know args in argv. """ # know arguments know = set(('-h', '--help', '-v', '--version')) # arguments args = set(sys.argv[1:]) # returns True if there is at least one known argument in arguments return len(know.intersection(args)) > 0
python
def check_help(): """ check know args in argv. """ # know arguments know = set(('-h', '--help', '-v', '--version')) # arguments args = set(sys.argv[1:]) # returns True if there is at least one known argument in arguments return len(know.intersection(args)) > 0
[ "def", "check_help", "(", ")", ":", "# know arguments", "know", "=", "set", "(", "(", "'-h'", ",", "'--help'", ",", "'-v'", ",", "'--version'", ")", ")", "# arguments", "args", "=", "set", "(", "sys", ".", "argv", "[", "1", ":", "]", ")", "# returns ...
check know args in argv.
[ "check", "know", "args", "in", "argv", "." ]
05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L269-L278
train
check if help is available in argv.
ldomic/lintools
lintools/lintools.py
Lintools.data_input_and_res_time_analysis
def data_input_and_res_time_analysis(self): """ Loads the data into Data() - renumbers the residues, imports mol file in rdkit. If there are trajectories to analyse, the residues that will be plotted are determined from Residence_time() analysis. """ self.topol_data = Dat...
python
def data_input_and_res_time_analysis(self): """ Loads the data into Data() - renumbers the residues, imports mol file in rdkit. If there are trajectories to analyse, the residues that will be plotted are determined from Residence_time() analysis. """ self.topol_data = Dat...
[ "def", "data_input_and_res_time_analysis", "(", "self", ")", ":", "self", ".", "topol_data", "=", "Data", "(", ")", "self", ".", "topol_data", ".", "load_data", "(", "self", ".", "topology", ",", "self", ".", "mol_file", ",", "self", ".", "ligand", ",", ...
Loads the data into Data() - renumbers the residues, imports mol file in rdkit. If there are trajectories to analyse, the residues that will be plotted are determined from Residence_time() analysis.
[ "Loads", "the", "data", "into", "Data", "()", "-", "renumbers", "the", "residues", "imports", "mol", "file", "in", "rdkit", ".", "If", "there", "are", "trajectories", "to", "analyse", "the", "residues", "that", "will", "be", "plotted", "are", "determined", ...
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/lintools.py#L72-L86
train
Load the data into Data and the Residence_Time object
ldomic/lintools
lintools/lintools.py
Lintools.analysis_of_prot_lig_interactions
def analysis_of_prot_lig_interactions(self): """ The classes and function that deal with protein-ligand interaction analysis. """ self.hbonds = HBonds(self.topol_data,self.trajectory,self.start,self.end,self.skip,self.analysis_cutoff,distance=3) self.pistacking = PiStacking(self....
python
def analysis_of_prot_lig_interactions(self): """ The classes and function that deal with protein-ligand interaction analysis. """ self.hbonds = HBonds(self.topol_data,self.trajectory,self.start,self.end,self.skip,self.analysis_cutoff,distance=3) self.pistacking = PiStacking(self....
[ "def", "analysis_of_prot_lig_interactions", "(", "self", ")", ":", "self", ".", "hbonds", "=", "HBonds", "(", "self", ".", "topol_data", ",", "self", ".", "trajectory", ",", "self", ".", "start", ",", "self", ".", "end", ",", "self", ".", "skip", ",", ...
The classes and function that deal with protein-ligand interaction analysis.
[ "The", "classes", "and", "function", "that", "deal", "with", "protein", "-", "ligand", "interaction", "analysis", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/lintools.py#L87-L97
train
The classes and functions that deal with protein - ligand interaction analysis.
ldomic/lintools
lintools/lintools.py
Lintools.draw_figure
def draw_figure(self,data_for_color=None, data_for_size=None, data_for_clouds=None, rot_bonds=None, color_for_clouds="Blues", color_type_color="viridis"): """ Draws molecule through Molecule() and then puts the final figure together with Figure(). """ self.molecule = Molecule(sel...
python
def draw_figure(self,data_for_color=None, data_for_size=None, data_for_clouds=None, rot_bonds=None, color_for_clouds="Blues", color_type_color="viridis"): """ Draws molecule through Molecule() and then puts the final figure together with Figure(). """ self.molecule = Molecule(sel...
[ "def", "draw_figure", "(", "self", ",", "data_for_color", "=", "None", ",", "data_for_size", "=", "None", ",", "data_for_clouds", "=", "None", ",", "rot_bonds", "=", "None", ",", "color_for_clouds", "=", "\"Blues\"", ",", "color_type_color", "=", "\"viridis\"", ...
Draws molecule through Molecule() and then puts the final figure together with Figure().
[ "Draws", "molecule", "through", "Molecule", "()", "and", "then", "puts", "the", "final", "figure", "together", "with", "Figure", "()", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/lintools.py#L103-L118
train
Draw the molecule and then puts the final figure together with the figure.
ldomic/lintools
lintools/lintools.py
Lintools.save_files
def save_files(self): """Saves all output from LINTools run in a single directory named after the output name.""" while True: try: os.mkdir(self.output_name) except Exception as e: self.output_name = raw_input("This directory already exists - pleas...
python
def save_files(self): """Saves all output from LINTools run in a single directory named after the output name.""" while True: try: os.mkdir(self.output_name) except Exception as e: self.output_name = raw_input("This directory already exists - pleas...
[ "def", "save_files", "(", "self", ")", ":", "while", "True", ":", "try", ":", "os", ".", "mkdir", "(", "self", ".", "output_name", ")", "except", "Exception", "as", "e", ":", "self", ".", "output_name", "=", "raw_input", "(", "\"This directory already exis...
Saves all output from LINTools run in a single directory named after the output name.
[ "Saves", "all", "output", "from", "LINTools", "run", "in", "a", "single", "directory", "named", "after", "the", "output", "name", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/lintools.py#L120-L130
train
Saves all output from LINTools run in a single directory named after the output name.
ldomic/lintools
lintools/lintools.py
Lintools.remove_files
def remove_files(self): """Removes intermediate files.""" file_list = ["molecule.svg","lig.pdb","HIS.pdb","PHE.pdb","TRP.pdb","TYR.pdb","lig.mol","test.xtc"] for residue in self.topol_data.dict_of_plotted_res.keys(): file_list.append(residue[1]+residue[2]+".svg") for f in fil...
python
def remove_files(self): """Removes intermediate files.""" file_list = ["molecule.svg","lig.pdb","HIS.pdb","PHE.pdb","TRP.pdb","TYR.pdb","lig.mol","test.xtc"] for residue in self.topol_data.dict_of_plotted_res.keys(): file_list.append(residue[1]+residue[2]+".svg") for f in fil...
[ "def", "remove_files", "(", "self", ")", ":", "file_list", "=", "[", "\"molecule.svg\"", ",", "\"lig.pdb\"", ",", "\"HIS.pdb\"", ",", "\"PHE.pdb\"", ",", "\"TRP.pdb\"", ",", "\"TYR.pdb\"", ",", "\"lig.mol\"", ",", "\"test.xtc\"", "]", "for", "residue", "in", "...
Removes intermediate files.
[ "Removes", "intermediate", "files", "." ]
d825a4a7b35f3f857d3b81b46c9aee72b0ec697a
https://github.com/ldomic/lintools/blob/d825a4a7b35f3f857d3b81b46c9aee72b0ec697a/lintools/lintools.py#L162-L169
train
Removes intermediate files.
MonsieurV/PiPocketGeiger
PiPocketGeiger/__init__.py
RadiationWatch.status
def status(self): """Return current readings, as a dictionary with: duration -- the duration of the measurements, in seconds; cpm -- the radiation count by minute; uSvh -- the radiation dose, exprimed in Sievert per house (uSv/h); uSvhError -- the incertitude for ...
python
def status(self): """Return current readings, as a dictionary with: duration -- the duration of the measurements, in seconds; cpm -- the radiation count by minute; uSvh -- the radiation dose, exprimed in Sievert per house (uSv/h); uSvhError -- the incertitude for ...
[ "def", "status", "(", "self", ")", ":", "minutes", "=", "min", "(", "self", ".", "duration", ",", "MAX_CPM_TIME", ")", "/", "1000", "/", "60.0", "cpm", "=", "self", ".", "count", "/", "minutes", "if", "minutes", ">", "0", "else", "0", "return", "di...
Return current readings, as a dictionary with: duration -- the duration of the measurements, in seconds; cpm -- the radiation count by minute; uSvh -- the radiation dose, exprimed in Sievert per house (uSv/h); uSvhError -- the incertitude for the radiation dose.
[ "Return", "current", "readings", "as", "a", "dictionary", "with", ":", "duration", "--", "the", "duration", "of", "the", "measurements", "in", "seconds", ";", "cpm", "--", "the", "radiation", "count", "by", "minute", ";", "uSvh", "--", "the", "radiation", ...
b0e7c303df46deeea3715fb8da3ebbefaf660f91
https://github.com/MonsieurV/PiPocketGeiger/blob/b0e7c303df46deeea3715fb8da3ebbefaf660f91/PiPocketGeiger/__init__.py#L60-L75
train
Return the current readings as a dictionary with the keys duration cpm uSvh and uSvhError.
MonsieurV/PiPocketGeiger
PiPocketGeiger/__init__.py
RadiationWatch.setup
def setup(self): """Initialize the driver by setting up GPIO interrupts and periodic statistics processing. """ # Initialize the statistics variables. self.radiation_count = 0 self.noise_count = 0 self.count = 0 # Initialize count_history[]. self.count_his...
python
def setup(self): """Initialize the driver by setting up GPIO interrupts and periodic statistics processing. """ # Initialize the statistics variables. self.radiation_count = 0 self.noise_count = 0 self.count = 0 # Initialize count_history[]. self.count_his...
[ "def", "setup", "(", "self", ")", ":", "# Initialize the statistics variables.", "self", ".", "radiation_count", "=", "0", "self", ".", "noise_count", "=", "0", "self", ".", "count", "=", "0", "# Initialize count_history[].", "self", ".", "count_history", "=", "...
Initialize the driver by setting up GPIO interrupts and periodic statistics processing.
[ "Initialize", "the", "driver", "by", "setting", "up", "GPIO", "interrupts", "and", "periodic", "statistics", "processing", "." ]
b0e7c303df46deeea3715fb8da3ebbefaf660f91
https://github.com/MonsieurV/PiPocketGeiger/blob/b0e7c303df46deeea3715fb8da3ebbefaf660f91/PiPocketGeiger/__init__.py#L91-L115
train
Initialize the driver by setting up GPIO interrupts and periodic statistics processing.
Shinichi-Nakagawa/pitchpx
pitchpx/__init__.py
main
def main(start, end, out): """ Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :param out: Output directory(default:"../output/mlb") """ try: logging.basicConfig(level=logging.WARNING) MlbAm.scrape(start, end, out) except MlbAmBadParame...
python
def main(start, end, out): """ Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :param out: Output directory(default:"../output/mlb") """ try: logging.basicConfig(level=logging.WARNING) MlbAm.scrape(start, end, out) except MlbAmBadParame...
[ "def", "main", "(", "start", ",", "end", ",", "out", ")", ":", "try", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "WARNING", ")", "MlbAm", ".", "scrape", "(", "start", ",", "end", ",", "out", ")", "except", "MlbAmBadParamet...
Scrape a MLBAM Data :param start: Start Day(YYYYMMDD) :param end: End Day(YYYYMMDD) :param out: Output directory(default:"../output/mlb")
[ "Scrape", "a", "MLBAM", "Data", ":", "param", "start", ":", "Start", "Day", "(", "YYYYMMDD", ")", ":", "param", "end", ":", "End", "Day", "(", "YYYYMMDD", ")", ":", "param", "out", ":", "Output", "directory", "(", "default", ":", "..", "/", "output",...
5747402a0b3416f5e910b479e100df858f0b6440
https://github.com/Shinichi-Nakagawa/pitchpx/blob/5747402a0b3416f5e910b479e100df858f0b6440/pitchpx/__init__.py#L15-L26
train
Scrape a MLBAM Data structure
robinandeer/puzzle
puzzle/cli/load.py
load
def load(ctx, variant_source, family_file, family_type, root): """ Load a variant source into the database. If no database was found run puzzle init first. 1. VCF: If a vcf file is used it can be loaded with a ped file 2. GEMINI: Ped information will be retreived from the gemini db """ roo...
python
def load(ctx, variant_source, family_file, family_type, root): """ Load a variant source into the database. If no database was found run puzzle init first. 1. VCF: If a vcf file is used it can be loaded with a ped file 2. GEMINI: Ped information will be retreived from the gemini db """ roo...
[ "def", "load", "(", "ctx", ",", "variant_source", ",", "family_file", ",", "family_type", ",", "root", ")", ":", "root", "=", "root", "or", "ctx", ".", "obj", ".", "get", "(", "'root'", ")", "or", "os", ".", "path", ".", "expanduser", "(", "\"~/.puzz...
Load a variant source into the database. If no database was found run puzzle init first. 1. VCF: If a vcf file is used it can be loaded with a ped file 2. GEMINI: Ped information will be retreived from the gemini db
[ "Load", "a", "variant", "source", "into", "the", "database", "." ]
9476f05b416d3a5135d25492cb31411fdf831c58
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/cli/load.py#L30-L97
train
Load a single variant source into the database.