repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
mattlong/hermes
hermes/chatroom.py
Chatroom.on_presence
def on_presence(self, session, presence): """Handles presence stanzas""" from_jid = presence.getFrom() is_member = self.is_member(from_jid.getStripped()) if is_member: member = self.get_member(from_jid.getStripped()) else: member = None logger.inf...
python
def on_presence(self, session, presence): """Handles presence stanzas""" from_jid = presence.getFrom() is_member = self.is_member(from_jid.getStripped()) if is_member: member = self.get_member(from_jid.getStripped()) else: member = None logger.inf...
[ "def", "on_presence", "(", "self", ",", "session", ",", "presence", ")", ":", "from_jid", "=", "presence", ".", "getFrom", "(", ")", "is_member", "=", "self", ".", "is_member", "(", "from_jid", ".", "getStripped", "(", ")", ")", "if", "is_member", ":", ...
Handles presence stanzas
[ "Handles", "presence", "stanzas" ]
63a5afcafe90ca99aeb44edeee9ed6f90baae431
https://github.com/mattlong/hermes/blob/63a5afcafe90ca99aeb44edeee9ed6f90baae431/hermes/chatroom.py#L179-L213
train
mattlong/hermes
hermes/chatroom.py
Chatroom.on_message
def on_message(self, con, event): """Handles messge stanzas""" msg_type = event.getType() nick = event.getFrom().getResource() from_jid = event.getFrom().getStripped() body = event.getBody() if msg_type == 'chat' and body is None: return logger.debug...
python
def on_message(self, con, event): """Handles messge stanzas""" msg_type = event.getType() nick = event.getFrom().getResource() from_jid = event.getFrom().getStripped() body = event.getBody() if msg_type == 'chat' and body is None: return logger.debug...
[ "def", "on_message", "(", "self", ",", "con", ",", "event", ")", ":", "msg_type", "=", "event", ".", "getType", "(", ")", "nick", "=", "event", ".", "getFrom", "(", ")", ".", "getResource", "(", ")", "from_jid", "=", "event", ".", "getFrom", "(", "...
Handles messge stanzas
[ "Handles", "messge", "stanzas" ]
63a5afcafe90ca99aeb44edeee9ed6f90baae431
https://github.com/mattlong/hermes/blob/63a5afcafe90ca99aeb44edeee9ed6f90baae431/hermes/chatroom.py#L215-L254
train
cloudmesh-cmd3/cmd3
cmd3/plugins/activate.py
activate.activate
def activate(self): """method to activate all activation methods in the shell and its plugins. """ d = dir(self) self.plugins = [] for key in d: if key.startswith("shell_activate_"): if self.echo: Console.ok("Shell Activate:...
python
def activate(self): """method to activate all activation methods in the shell and its plugins. """ d = dir(self) self.plugins = [] for key in d: if key.startswith("shell_activate_"): if self.echo: Console.ok("Shell Activate:...
[ "def", "activate", "(", "self", ")", ":", "d", "=", "dir", "(", "self", ")", "self", ".", "plugins", "=", "[", "]", "for", "key", "in", "d", ":", "if", "key", ".", "startswith", "(", "\"shell_activate_\"", ")", ":", "if", "self", ".", "echo", ":"...
method to activate all activation methods in the shell and its plugins.
[ "method", "to", "activate", "all", "activation", "methods", "in", "the", "shell", "and", "its", "plugins", "." ]
92e33c96032fd3921f159198a0e57917c4dc34ed
https://github.com/cloudmesh-cmd3/cmd3/blob/92e33c96032fd3921f159198a0e57917c4dc34ed/cmd3/plugins/activate.py#L20-L40
train
cloudmesh-cmd3/cmd3
cmd3/plugins/activate.py
activate.do_help
def do_help(self, arg): """List available commands with "help" or detailed help with "help cmd".""" if arg: # XXX check arg syntax try: func = getattr(self, 'help_' + arg) except AttributeError: try: doc = getattr(s...
python
def do_help(self, arg): """List available commands with "help" or detailed help with "help cmd".""" if arg: # XXX check arg syntax try: func = getattr(self, 'help_' + arg) except AttributeError: try: doc = getattr(s...
[ "def", "do_help", "(", "self", ",", "arg", ")", ":", "if", "arg", ":", "try", ":", "func", "=", "getattr", "(", "self", ",", "'help_'", "+", "arg", ")", "except", "AttributeError", ":", "try", ":", "doc", "=", "getattr", "(", "self", ",", "'do_'", ...
List available commands with "help" or detailed help with "help cmd".
[ "List", "available", "commands", "with", "help", "or", "detailed", "help", "with", "help", "cmd", "." ]
92e33c96032fd3921f159198a0e57917c4dc34ed
https://github.com/cloudmesh-cmd3/cmd3/blob/92e33c96032fd3921f159198a0e57917c4dc34ed/cmd3/plugins/activate.py#L42-L92
train
b10m/ziggo_mediabox_xl
ziggo_mediabox_xl.py
ZiggoMediaboxXL._fetch_channels
def _fetch_channels(self): """Retrieve Ziggo channel information.""" json = requests.get(self._channels_url).json() self._channels = {c['channel']['code']: c['channel']['name'] for c in json['channels']}
python
def _fetch_channels(self): """Retrieve Ziggo channel information.""" json = requests.get(self._channels_url).json() self._channels = {c['channel']['code']: c['channel']['name'] for c in json['channels']}
[ "def", "_fetch_channels", "(", "self", ")", ":", "json", "=", "requests", ".", "get", "(", "self", ".", "_channels_url", ")", ".", "json", "(", ")", "self", ".", "_channels", "=", "{", "c", "[", "'channel'", "]", "[", "'code'", "]", ":", "c", "[", ...
Retrieve Ziggo channel information.
[ "Retrieve", "Ziggo", "channel", "information", "." ]
49520ec3e2e3d09339cea667723914b10399249d
https://github.com/b10m/ziggo_mediabox_xl/blob/49520ec3e2e3d09339cea667723914b10399249d/ziggo_mediabox_xl.py#L33-L37
train
b10m/ziggo_mediabox_xl
ziggo_mediabox_xl.py
ZiggoMediaboxXL.send_keys
def send_keys(self, keys): """Send keys to the device.""" try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(self._timeout) sock.connect((self._ip, self._port['cmd'])) # mandatory dance version_info = sock.recv(15) ...
python
def send_keys(self, keys): """Send keys to the device.""" try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(self._timeout) sock.connect((self._ip, self._port['cmd'])) # mandatory dance version_info = sock.recv(15) ...
[ "def", "send_keys", "(", "self", ",", "keys", ")", ":", "try", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "settimeout", "(", "self", ".", "_timeout", ")", "sock", "."...
Send keys to the device.
[ "Send", "keys", "to", "the", "device", "." ]
49520ec3e2e3d09339cea667723914b10399249d
https://github.com/b10m/ziggo_mediabox_xl/blob/49520ec3e2e3d09339cea667723914b10399249d/ziggo_mediabox_xl.py#L72-L94
train
mbourqui/django-echoices
echoices/fields/fields.py
make_echoicefield
def make_echoicefield(echoices, *args, klass_name=None, **kwargs): """ Construct a subclass of a derived `models.Field` specific to the type of the `EChoice` values. Parameters ---------- echoices : subclass of EChoice args Passed to the derived `models.Field` klass_name : str ...
python
def make_echoicefield(echoices, *args, klass_name=None, **kwargs): """ Construct a subclass of a derived `models.Field` specific to the type of the `EChoice` values. Parameters ---------- echoices : subclass of EChoice args Passed to the derived `models.Field` klass_name : str ...
[ "def", "make_echoicefield", "(", "echoices", ",", "*", "args", ",", "klass_name", "=", "None", ",", "**", "kwargs", ")", ":", "assert", "issubclass", "(", "echoices", ",", "EChoice", ")", "value_type", "=", "echoices", ".", "__getvaluetype__", "(", ")", "i...
Construct a subclass of a derived `models.Field` specific to the type of the `EChoice` values. Parameters ---------- echoices : subclass of EChoice args Passed to the derived `models.Field` klass_name : str Give a specific name to the returned class. By default for Django < ...
[ "Construct", "a", "subclass", "of", "a", "derived", "models", ".", "Field", "specific", "to", "the", "type", "of", "the", "EChoice", "values", "." ]
c57405005ec368ac602bb38a71091a1e03c723bb
https://github.com/mbourqui/django-echoices/blob/c57405005ec368ac602bb38a71091a1e03c723bb/echoices/fields/fields.py#L120-L163
train
jstitch/MambuPy
MambuPy/orm/schema_dummies.py
make_dummy
def make_dummy(instance, relations = {}, datetime_default = dt.strptime('1901-01-01','%Y-%m-%d'), varchar_default = "", integer_default = 0, numeric_default = 0.0, *args, **kwargs ): """Make an instance...
python
def make_dummy(instance, relations = {}, datetime_default = dt.strptime('1901-01-01','%Y-%m-%d'), varchar_default = "", integer_default = 0, numeric_default = 0.0, *args, **kwargs ): """Make an instance...
[ "def", "make_dummy", "(", "instance", ",", "relations", "=", "{", "}", ",", "datetime_default", "=", "dt", ".", "strptime", "(", "'1901-01-01'", ",", "'%Y-%m-%d'", ")", ",", "varchar_default", "=", "\"\"", ",", "integer_default", "=", "0", ",", "numeric_defa...
Make an instance to look like an empty dummy. Every field of the table is set with zeroes/empty strings. Date fields are set to 01/01/1901. * relations is a dictionary to set properties for relationships on the instance. The keys of the relations dictionary are the name of the fields to be ...
[ "Make", "an", "instance", "to", "look", "like", "an", "empty", "dummy", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/orm/schema_dummies.py#L14-L99
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.set_up_network
def set_up_network( self, genes: List[Gene], gene_filter: bool = False, disease_associations: Optional[Dict] = None ) -> None: """Set up the network. Filter genes out if requested and add attributes to the vertices. :param genes: A list of G...
python
def set_up_network( self, genes: List[Gene], gene_filter: bool = False, disease_associations: Optional[Dict] = None ) -> None: """Set up the network. Filter genes out if requested and add attributes to the vertices. :param genes: A list of G...
[ "def", "set_up_network", "(", "self", ",", "genes", ":", "List", "[", "Gene", "]", ",", "gene_filter", ":", "bool", "=", "False", ",", "disease_associations", ":", "Optional", "[", "Dict", "]", "=", "None", ")", "->", "None", ":", "if", "gene_filter", ...
Set up the network. Filter genes out if requested and add attributes to the vertices. :param genes: A list of Gene objects. :param gene_filter: Removes all genes that are not in list <genes> if True. :param disease_associations: Diseases associated with genes.
[ "Set", "up", "the", "network", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L38-L55
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.filter_genes
def filter_genes(self, relevant_entrez: list) -> None: """Filter out the genes that are not in list relevant_entrez. :param list relevant_entrez: Entrez IDs of genes which are to be kept. """ logger.info("In filter_genes()") irrelevant_genes = self.graph.vs.select(name_notin=rel...
python
def filter_genes(self, relevant_entrez: list) -> None: """Filter out the genes that are not in list relevant_entrez. :param list relevant_entrez: Entrez IDs of genes which are to be kept. """ logger.info("In filter_genes()") irrelevant_genes = self.graph.vs.select(name_notin=rel...
[ "def", "filter_genes", "(", "self", ",", "relevant_entrez", ":", "list", ")", "->", "None", ":", "logger", ".", "info", "(", "\"In filter_genes()\"", ")", "irrelevant_genes", "=", "self", ".", "graph", ".", "vs", ".", "select", "(", "name_notin", "=", "rel...
Filter out the genes that are not in list relevant_entrez. :param list relevant_entrez: Entrez IDs of genes which are to be kept.
[ "Filter", "out", "the", "genes", "that", "are", "not", "in", "list", "relevant_entrez", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L57-L64
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network._add_vertex_attributes
def _add_vertex_attributes(self, genes: List[Gene], disease_associations: Optional[dict] = None) -> None: """Add attributes to vertices. :param genes: A list of genes containing attribute information. """ self._set_default_vertex_attributes() self....
python
def _add_vertex_attributes(self, genes: List[Gene], disease_associations: Optional[dict] = None) -> None: """Add attributes to vertices. :param genes: A list of genes containing attribute information. """ self._set_default_vertex_attributes() self....
[ "def", "_add_vertex_attributes", "(", "self", ",", "genes", ":", "List", "[", "Gene", "]", ",", "disease_associations", ":", "Optional", "[", "dict", "]", "=", "None", ")", "->", "None", ":", "self", ".", "_set_default_vertex_attributes", "(", ")", "self", ...
Add attributes to vertices. :param genes: A list of genes containing attribute information.
[ "Add", "attributes", "to", "vertices", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L66-L89
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network._set_default_vertex_attributes
def _set_default_vertex_attributes(self) -> None: """Assign default values on attributes to all vertices.""" self.graph.vs["l2fc"] = 0 self.graph.vs["padj"] = 0.5 self.graph.vs["symbol"] = self.graph.vs["name"] self.graph.vs["diff_expressed"] = False self.graph.vs["up_reg...
python
def _set_default_vertex_attributes(self) -> None: """Assign default values on attributes to all vertices.""" self.graph.vs["l2fc"] = 0 self.graph.vs["padj"] = 0.5 self.graph.vs["symbol"] = self.graph.vs["name"] self.graph.vs["diff_expressed"] = False self.graph.vs["up_reg...
[ "def", "_set_default_vertex_attributes", "(", "self", ")", "->", "None", ":", "self", ".", "graph", ".", "vs", "[", "\"l2fc\"", "]", "=", "0", "self", ".", "graph", ".", "vs", "[", "\"padj\"", "]", "=", "0.5", "self", ".", "graph", ".", "vs", "[", ...
Assign default values on attributes to all vertices.
[ "Assign", "default", "values", "on", "attributes", "to", "all", "vertices", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L91-L98
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network._add_vertex_attributes_by_genes
def _add_vertex_attributes_by_genes(self, genes: List[Gene]) -> None: """Assign values to attributes on vertices. :param genes: A list of Gene objects from which values will be extracted. """ for gene in genes: try: vertex = self.graph.vs.find(name=str(gene.e...
python
def _add_vertex_attributes_by_genes(self, genes: List[Gene]) -> None: """Assign values to attributes on vertices. :param genes: A list of Gene objects from which values will be extracted. """ for gene in genes: try: vertex = self.graph.vs.find(name=str(gene.e...
[ "def", "_add_vertex_attributes_by_genes", "(", "self", ",", "genes", ":", "List", "[", "Gene", "]", ")", "->", "None", ":", "for", "gene", "in", "genes", ":", "try", ":", "vertex", "=", "self", ".", "graph", ".", "vs", ".", "find", "(", "name", "=", ...
Assign values to attributes on vertices. :param genes: A list of Gene objects from which values will be extracted.
[ "Assign", "values", "to", "attributes", "on", "vertices", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L100-L112
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network._add_disease_associations
def _add_disease_associations(self, disease_associations: dict) -> None: """Add disease association annotation to the network. :param disease_associations: Dictionary of disease-gene associations. """ if disease_associations is not None: for target_id, disease_id_list in dis...
python
def _add_disease_associations(self, disease_associations: dict) -> None: """Add disease association annotation to the network. :param disease_associations: Dictionary of disease-gene associations. """ if disease_associations is not None: for target_id, disease_id_list in dis...
[ "def", "_add_disease_associations", "(", "self", ",", "disease_associations", ":", "dict", ")", "->", "None", ":", "if", "disease_associations", "is", "not", "None", ":", "for", "target_id", ",", "disease_id_list", "in", "disease_associations", ".", "items", "(", ...
Add disease association annotation to the network. :param disease_associations: Dictionary of disease-gene associations.
[ "Add", "disease", "association", "annotation", "to", "the", "network", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L114-L122
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.get_upregulated_genes
def get_upregulated_genes(self) -> VertexSeq: """Get genes that are up-regulated. :return: Up-regulated genes. """ up_regulated = self.graph.vs.select(self._is_upregulated_gene) logger.info(f"No. of up-regulated genes after laying on network: {len(up_regulated)}") return...
python
def get_upregulated_genes(self) -> VertexSeq: """Get genes that are up-regulated. :return: Up-regulated genes. """ up_regulated = self.graph.vs.select(self._is_upregulated_gene) logger.info(f"No. of up-regulated genes after laying on network: {len(up_regulated)}") return...
[ "def", "get_upregulated_genes", "(", "self", ")", "->", "VertexSeq", ":", "up_regulated", "=", "self", ".", "graph", ".", "vs", ".", "select", "(", "self", ".", "_is_upregulated_gene", ")", "logger", ".", "info", "(", "f\"No. of up-regulated genes after laying on ...
Get genes that are up-regulated. :return: Up-regulated genes.
[ "Get", "genes", "that", "are", "up", "-", "regulated", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L124-L131
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.get_downregulated_genes
def get_downregulated_genes(self) -> VertexSeq: """Get genes that are down-regulated. :return: Down-regulated genes. """ down_regulated = self.graph.vs.select(self._is_downregulated_gene) logger.info(f"No. of down-regulated genes after laying on network: {len(down_regulated)}") ...
python
def get_downregulated_genes(self) -> VertexSeq: """Get genes that are down-regulated. :return: Down-regulated genes. """ down_regulated = self.graph.vs.select(self._is_downregulated_gene) logger.info(f"No. of down-regulated genes after laying on network: {len(down_regulated)}") ...
[ "def", "get_downregulated_genes", "(", "self", ")", "->", "VertexSeq", ":", "down_regulated", "=", "self", ".", "graph", ".", "vs", ".", "select", "(", "self", ".", "_is_downregulated_gene", ")", "logger", ".", "info", "(", "f\"No. of down-regulated genes after la...
Get genes that are down-regulated. :return: Down-regulated genes.
[ "Get", "genes", "that", "are", "down", "-", "regulated", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L133-L140
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.print_summary
def print_summary(self, heading: str) -> None: """Print the summary of a graph. :param str heading: Title of the graph. """ logger.info(heading) logger.info("Number of nodes: {}".format(len(self.graph.vs))) logger.info("Number of edges: {}".format(len(self.graph.es)))
python
def print_summary(self, heading: str) -> None: """Print the summary of a graph. :param str heading: Title of the graph. """ logger.info(heading) logger.info("Number of nodes: {}".format(len(self.graph.vs))) logger.info("Number of edges: {}".format(len(self.graph.es)))
[ "def", "print_summary", "(", "self", ",", "heading", ":", "str", ")", "->", "None", ":", "logger", ".", "info", "(", "heading", ")", "logger", ".", "info", "(", "\"Number of nodes: {}\"", ".", "format", "(", "len", "(", "self", ".", "graph", ".", "vs",...
Print the summary of a graph. :param str heading: Title of the graph.
[ "Print", "the", "summary", "of", "a", "graph", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L151-L158
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.get_differentially_expressed_genes
def get_differentially_expressed_genes(self, diff_type: str) -> VertexSeq: """Get the differentially expressed genes based on diff_type. :param str diff_type: Differential expression type chosen by the user; all, down, or up. :return list: A list of differentially expressed genes. """ ...
python
def get_differentially_expressed_genes(self, diff_type: str) -> VertexSeq: """Get the differentially expressed genes based on diff_type. :param str diff_type: Differential expression type chosen by the user; all, down, or up. :return list: A list of differentially expressed genes. """ ...
[ "def", "get_differentially_expressed_genes", "(", "self", ",", "diff_type", ":", "str", ")", "->", "VertexSeq", ":", "if", "diff_type", "==", "\"up\"", ":", "diff_expr", "=", "self", ".", "graph", ".", "vs", ".", "select", "(", "up_regulated_eq", "=", "True"...
Get the differentially expressed genes based on diff_type. :param str diff_type: Differential expression type chosen by the user; all, down, or up. :return list: A list of differentially expressed genes.
[ "Get", "the", "differentially", "expressed", "genes", "based", "on", "diff_type", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L160-L172
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.write_adj_list
def write_adj_list(self, path: str) -> None: """Write the network as an adjacency list to a file. :param path: File path to write the adjacency list. """ adj_list = self.get_adjlist() with open(path, mode="w") as file: for i, line in enumerate(adj_list): ...
python
def write_adj_list(self, path: str) -> None: """Write the network as an adjacency list to a file. :param path: File path to write the adjacency list. """ adj_list = self.get_adjlist() with open(path, mode="w") as file: for i, line in enumerate(adj_list): ...
[ "def", "write_adj_list", "(", "self", ",", "path", ":", "str", ")", "->", "None", ":", "adj_list", "=", "self", ".", "get_adjlist", "(", ")", "with", "open", "(", "path", ",", "mode", "=", "\"w\"", ")", "as", "file", ":", "for", "i", ",", "line", ...
Write the network as an adjacency list to a file. :param path: File path to write the adjacency list.
[ "Write", "the", "network", "as", "an", "adjacency", "list", "to", "a", "file", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L174-L183
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/model/network.py
Network.get_attribute_from_indices
def get_attribute_from_indices(self, indices: list, attribute_name: str): """Get attribute values for the requested indices. :param indices: Indices of vertices for which the attribute values are requested. :param attribute_name: The name of the attribute. :return: A list of attribute v...
python
def get_attribute_from_indices(self, indices: list, attribute_name: str): """Get attribute values for the requested indices. :param indices: Indices of vertices for which the attribute values are requested. :param attribute_name: The name of the attribute. :return: A list of attribute v...
[ "def", "get_attribute_from_indices", "(", "self", ",", "indices", ":", "list", ",", "attribute_name", ":", "str", ")", ":", "return", "list", "(", "np", ".", "array", "(", "self", ".", "graph", ".", "vs", "[", "attribute_name", "]", ")", "[", "indices", ...
Get attribute values for the requested indices. :param indices: Indices of vertices for which the attribute values are requested. :param attribute_name: The name of the attribute. :return: A list of attribute values for the requested indices.
[ "Get", "attribute", "values", "for", "the", "requested", "indices", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/model/network.py#L192-L199
train
rsgalloway/grit
grit/server/cherrypy/__init__.py
read_headers
def read_headers(rfile, hdict=None): """Read headers from the given stream into the given header dict. If hdict is None, a new header dict is created. Returns the populated header dict. Headers which are repeated are folded together using a comma if their specification so dictates. ...
python
def read_headers(rfile, hdict=None): """Read headers from the given stream into the given header dict. If hdict is None, a new header dict is created. Returns the populated header dict. Headers which are repeated are folded together using a comma if their specification so dictates. ...
[ "def", "read_headers", "(", "rfile", ",", "hdict", "=", "None", ")", ":", "if", "hdict", "is", "None", ":", "hdict", "=", "{", "}", "while", "True", ":", "line", "=", "rfile", ".", "readline", "(", ")", "if", "not", "line", ":", "raise", "ValueErro...
Read headers from the given stream into the given header dict. If hdict is None, a new header dict is created. Returns the populated header dict. Headers which are repeated are folded together using a comma if their specification so dictates. This function raises ValueError when the r...
[ "Read", "headers", "from", "the", "given", "stream", "into", "the", "given", "header", "dict", ".", "If", "hdict", "is", "None", "a", "new", "header", "dict", "is", "created", ".", "Returns", "the", "populated", "header", "dict", ".", "Headers", "which", ...
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/__init__.py#L137-L183
train
rsgalloway/grit
grit/server/cherrypy/__init__.py
HTTPRequest.parse_request
def parse_request(self): """Parse the next HTTP request start-line and message-headers.""" self.rfile = SizeCheckWrapper(self.conn.rfile, self.server.max_request_header_size) try: self.read_request_line() except MaxSizeExceeded: ...
python
def parse_request(self): """Parse the next HTTP request start-line and message-headers.""" self.rfile = SizeCheckWrapper(self.conn.rfile, self.server.max_request_header_size) try: self.read_request_line() except MaxSizeExceeded: ...
[ "def", "parse_request", "(", "self", ")", ":", "self", ".", "rfile", "=", "SizeCheckWrapper", "(", "self", ".", "conn", ".", "rfile", ",", "self", ".", "server", ".", "max_request_header_size", ")", "try", ":", "self", ".", "read_request_line", "(", ")", ...
Parse the next HTTP request start-line and message-headers.
[ "Parse", "the", "next", "HTTP", "request", "start", "-", "line", "and", "message", "-", "headers", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/__init__.py#L513-L536
train
rsgalloway/grit
grit/server/cherrypy/__init__.py
HTTPRequest.send_headers
def send_headers(self): """Assert, process, and send the HTTP response message-headers. You must set self.status, and self.outheaders before calling this. """ hkeys = [key.lower() for key, value in self.outheaders] status = int(self.status[:3]) if status...
python
def send_headers(self): """Assert, process, and send the HTTP response message-headers. You must set self.status, and self.outheaders before calling this. """ hkeys = [key.lower() for key, value in self.outheaders] status = int(self.status[:3]) if status...
[ "def", "send_headers", "(", "self", ")", ":", "hkeys", "=", "[", "key", ".", "lower", "(", ")", "for", "key", ",", "value", "in", "self", ".", "outheaders", "]", "status", "=", "int", "(", "self", ".", "status", "[", ":", "3", "]", ")", "if", "...
Assert, process, and send the HTTP response message-headers. You must set self.status, and self.outheaders before calling this.
[ "Assert", "process", "and", "send", "the", "HTTP", "response", "message", "-", "headers", ".", "You", "must", "set", "self", ".", "status", "and", "self", ".", "outheaders", "before", "calling", "this", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/__init__.py#L811-L875
train
rsgalloway/grit
grit/server/cherrypy/__init__.py
ThreadPool.start
def start(self): """Start the pool of threads.""" for i in range(self.min): self._threads.append(WorkerThread(self.server)) for worker in self._threads: worker.setName("CP Server " + worker.getName()) worker.start() for worker in self._threads: ...
python
def start(self): """Start the pool of threads.""" for i in range(self.min): self._threads.append(WorkerThread(self.server)) for worker in self._threads: worker.setName("CP Server " + worker.getName()) worker.start() for worker in self._threads: ...
[ "def", "start", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "min", ")", ":", "self", ".", "_threads", ".", "append", "(", "WorkerThread", "(", "self", ".", "server", ")", ")", "for", "worker", "in", "self", ".", "_threads", ...
Start the pool of threads.
[ "Start", "the", "pool", "of", "threads", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/cherrypy/__init__.py#L1397-L1406
train
openvax/varlens
varlens/read_evidence/pileup_element.py
PileupElement.fields
def fields(self): ''' Fields that should be considered for our notion of object equality. ''' return ( self.locus, self.offset_start, self.offset_end, self.alignment_key)
python
def fields(self): ''' Fields that should be considered for our notion of object equality. ''' return ( self.locus, self.offset_start, self.offset_end, self.alignment_key)
[ "def", "fields", "(", "self", ")", ":", "return", "(", "self", ".", "locus", ",", "self", ".", "offset_start", ",", "self", ".", "offset_end", ",", "self", ".", "alignment_key", ")" ]
Fields that should be considered for our notion of object equality.
[ "Fields", "that", "should", "be", "considered", "for", "our", "notion", "of", "object", "equality", "." ]
715d3ede5893757b2fcba4117515621bca7b1e5d
https://github.com/openvax/varlens/blob/715d3ede5893757b2fcba4117515621bca7b1e5d/varlens/read_evidence/pileup_element.py#L57-L62
train
openvax/varlens
varlens/read_evidence/pileup_element.py
PileupElement.bases
def bases(self): ''' The sequenced bases in the alignment that align to this locus in the genome, as a string. Empty string in the case of a deletion. String of length > 1 if there is an insertion here. ''' sequence = self.alignment.query_sequence assert ...
python
def bases(self): ''' The sequenced bases in the alignment that align to this locus in the genome, as a string. Empty string in the case of a deletion. String of length > 1 if there is an insertion here. ''' sequence = self.alignment.query_sequence assert ...
[ "def", "bases", "(", "self", ")", ":", "sequence", "=", "self", ".", "alignment", ".", "query_sequence", "assert", "self", ".", "offset_end", "<=", "len", "(", "sequence", ")", ",", "\"End offset=%d > sequence length=%d. CIGAR=%s. SEQUENCE=%s\"", "%", "(", "self",...
The sequenced bases in the alignment that align to this locus in the genome, as a string. Empty string in the case of a deletion. String of length > 1 if there is an insertion here.
[ "The", "sequenced", "bases", "in", "the", "alignment", "that", "align", "to", "this", "locus", "in", "the", "genome", "as", "a", "string", "." ]
715d3ede5893757b2fcba4117515621bca7b1e5d
https://github.com/openvax/varlens/blob/715d3ede5893757b2fcba4117515621bca7b1e5d/varlens/read_evidence/pileup_element.py#L71-L86
train
openvax/varlens
varlens/read_evidence/pileup_element.py
PileupElement.min_base_quality
def min_base_quality(self): ''' The minimum of the base qualities. In the case of a deletion, in which case there are no bases in this PileupElement, the minimum is taken over the sequenced bases immediately before and after the deletion. ''' try: return min(s...
python
def min_base_quality(self): ''' The minimum of the base qualities. In the case of a deletion, in which case there are no bases in this PileupElement, the minimum is taken over the sequenced bases immediately before and after the deletion. ''' try: return min(s...
[ "def", "min_base_quality", "(", "self", ")", ":", "try", ":", "return", "min", "(", "self", ".", "base_qualities", ")", "except", "ValueError", ":", "assert", "self", ".", "offset_start", "==", "self", ".", "offset_end", "adjacent_qualities", "=", "[", "self...
The minimum of the base qualities. In the case of a deletion, in which case there are no bases in this PileupElement, the minimum is taken over the sequenced bases immediately before and after the deletion.
[ "The", "minimum", "of", "the", "base", "qualities", ".", "In", "the", "case", "of", "a", "deletion", "in", "which", "case", "there", "are", "no", "bases", "in", "this", "PileupElement", "the", "minimum", "is", "taken", "over", "the", "sequenced", "bases", ...
715d3ede5893757b2fcba4117515621bca7b1e5d
https://github.com/openvax/varlens/blob/715d3ede5893757b2fcba4117515621bca7b1e5d/varlens/read_evidence/pileup_element.py#L98-L114
train
openvax/varlens
varlens/read_evidence/pileup_element.py
PileupElement.from_pysam_alignment
def from_pysam_alignment(locus, pileup_read): ''' Factory function to create a new PileupElement from a pysam `PileupRead`. Parameters ---------- locus : varcode.Locus Reference locus for which to construct a PileupElement. Must include exactly on...
python
def from_pysam_alignment(locus, pileup_read): ''' Factory function to create a new PileupElement from a pysam `PileupRead`. Parameters ---------- locus : varcode.Locus Reference locus for which to construct a PileupElement. Must include exactly on...
[ "def", "from_pysam_alignment", "(", "locus", ",", "pileup_read", ")", ":", "assert", "not", "pileup_read", ".", "is_refskip", ",", "(", "\"Can't create a PileupElement in a refskip (typically an intronic \"", "\"gap in an RNA alignment)\"", ")", "offset_start", "=", "None", ...
Factory function to create a new PileupElement from a pysam `PileupRead`. Parameters ---------- locus : varcode.Locus Reference locus for which to construct a PileupElement. Must include exactly one base. pileup_read : pysam.calignmentfile.PileupRead ...
[ "Factory", "function", "to", "create", "a", "new", "PileupElement", "from", "a", "pysam", "PileupRead", "." ]
715d3ede5893757b2fcba4117515621bca7b1e5d
https://github.com/openvax/varlens/blob/715d3ede5893757b2fcba4117515621bca7b1e5d/varlens/read_evidence/pileup_element.py#L117-L206
train
polyaxon/hestia
hestia/http.py
safe_request
def safe_request( url, method=None, params=None, data=None, json=None, headers=None, allow_redirects=False, timeout=30, verify_ssl=True, ): """A slightly safer version of `request`.""" session = requests.Session() kwargs = {} if json: kwargs['json'] = json ...
python
def safe_request( url, method=None, params=None, data=None, json=None, headers=None, allow_redirects=False, timeout=30, verify_ssl=True, ): """A slightly safer version of `request`.""" session = requests.Session() kwargs = {} if json: kwargs['json'] = json ...
[ "def", "safe_request", "(", "url", ",", "method", "=", "None", ",", "params", "=", "None", ",", "data", "=", "None", ",", "json", "=", "None", ",", "headers", "=", "None", ",", "allow_redirects", "=", "False", ",", "timeout", "=", "30", ",", "verify_...
A slightly safer version of `request`.
[ "A", "slightly", "safer", "version", "of", "request", "." ]
382ed139cff8bf35c987cfc30a31b72c0d6b808e
https://github.com/polyaxon/hestia/blob/382ed139cff8bf35c987cfc30a31b72c0d6b808e/hestia/http.py#L12-L56
train
klmitch/turnstile
turnstile/remote.py
remote
def remote(func): """ Decorator to mark a function as invoking a remote procedure call. When invoked in server mode, the function will be called; when invoked in client mode, an RPC will be initiated. """ @functools.wraps(func) def wrapper(self, *args, **kwargs): if self.mode == 'se...
python
def remote(func): """ Decorator to mark a function as invoking a remote procedure call. When invoked in server mode, the function will be called; when invoked in client mode, an RPC will be initiated. """ @functools.wraps(func) def wrapper(self, *args, **kwargs): if self.mode == 'se...
[ "def", "remote", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "mode", "==", "'server'", ":", "return", "func", "(", "se...
Decorator to mark a function as invoking a remote procedure call. When invoked in server mode, the function will be called; when invoked in client mode, an RPC will be initiated.
[ "Decorator", "to", "mark", "a", "function", "as", "invoking", "a", "remote", "procedure", "call", ".", "When", "invoked", "in", "server", "mode", "the", "function", "will", "be", "called", ";", "when", "invoked", "in", "client", "mode", "an", "RPC", "will"...
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L171-L210
train
klmitch/turnstile
turnstile/remote.py
Connection.send
def send(self, cmd, *payload): """ Send a command message to the other end. :param cmd: The command to send to the other end. :param payload: The command payload. Note that all elements of the payload must be serializable to JSON. """ # If it's ...
python
def send(self, cmd, *payload): """ Send a command message to the other end. :param cmd: The command to send to the other end. :param payload: The command payload. Note that all elements of the payload must be serializable to JSON. """ # If it's ...
[ "def", "send", "(", "self", ",", "cmd", ",", "*", "payload", ")", ":", "if", "not", "self", ".", "_sock", ":", "raise", "ConnectionClosed", "(", "\"Connection closed\"", ")", "msg", "=", "json", ".", "dumps", "(", "dict", "(", "cmd", "=", "cmd", ",",...
Send a command message to the other end. :param cmd: The command to send to the other end. :param payload: The command payload. Note that all elements of the payload must be serializable to JSON.
[ "Send", "a", "command", "message", "to", "the", "other", "end", "." ]
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L67-L94
train
klmitch/turnstile
turnstile/remote.py
Connection._recvbuf_pop
def _recvbuf_pop(self): """ Internal helper to pop a message off the receive buffer. If the message is an Exception, that exception will be raised; otherwise, a tuple of command and payload will be returned. """ # Pop a message off the recv buffer and return (or raise) ...
python
def _recvbuf_pop(self): """ Internal helper to pop a message off the receive buffer. If the message is an Exception, that exception will be raised; otherwise, a tuple of command and payload will be returned. """ # Pop a message off the recv buffer and return (or raise) ...
[ "def", "_recvbuf_pop", "(", "self", ")", ":", "msg", "=", "self", ".", "_recvbuf", ".", "pop", "(", "0", ")", "if", "isinstance", "(", "msg", ",", "Exception", ")", ":", "raise", "msg", "return", "msg", "[", "'cmd'", "]", ",", "msg", "[", "'payload...
Internal helper to pop a message off the receive buffer. If the message is an Exception, that exception will be raised; otherwise, a tuple of command and payload will be returned.
[ "Internal", "helper", "to", "pop", "a", "message", "off", "the", "receive", "buffer", ".", "If", "the", "message", "is", "an", "Exception", "that", "exception", "will", "be", "raised", ";", "otherwise", "a", "tuple", "of", "command", "and", "payload", "wil...
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L96-L107
train
klmitch/turnstile
turnstile/remote.py
SimpleRPC.ping
def ping(self): """ Ping the server. Returns the time interval, in seconds, required for the server to respond to the PING message. """ # Make sure we're connected if not self.conn: self.connect() # Send the ping and wait for the response se...
python
def ping(self): """ Ping the server. Returns the time interval, in seconds, required for the server to respond to the PING message. """ # Make sure we're connected if not self.conn: self.connect() # Send the ping and wait for the response se...
[ "def", "ping", "(", "self", ")", ":", "if", "not", "self", ".", "conn", ":", "self", ".", "connect", "(", ")", "self", ".", "conn", ".", "send", "(", "'PING'", ",", "time", ".", "time", "(", ")", ")", "cmd", ",", "payload", "=", "self", ".", ...
Ping the server. Returns the time interval, in seconds, required for the server to respond to the PING message.
[ "Ping", "the", "server", ".", "Returns", "the", "time", "interval", "in", "seconds", "required", "for", "the", "server", "to", "respond", "to", "the", "PING", "message", "." ]
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L288-L308
train
klmitch/turnstile
turnstile/remote.py
SimpleRPC.listen
def listen(self): """ Listen for clients. This method causes the SimpleRPC object to switch to server mode. One thread will be created for each client. """ # Make sure we're in server mode if self.mode and self.mode != 'server': raise ValueError("%s...
python
def listen(self): """ Listen for clients. This method causes the SimpleRPC object to switch to server mode. One thread will be created for each client. """ # Make sure we're in server mode if self.mode and self.mode != 'server': raise ValueError("%s...
[ "def", "listen", "(", "self", ")", ":", "if", "self", ".", "mode", "and", "self", ".", "mode", "!=", "'server'", ":", "raise", "ValueError", "(", "\"%s is not in server mode\"", "%", "self", ".", "__class__", ".", "__name__", ")", "self", ".", "mode", "=...
Listen for clients. This method causes the SimpleRPC object to switch to server mode. One thread will be created for each client.
[ "Listen", "for", "clients", ".", "This", "method", "causes", "the", "SimpleRPC", "object", "to", "switch", "to", "server", "mode", ".", "One", "thread", "will", "be", "created", "for", "each", "client", "." ]
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L360-L402
train
klmitch/turnstile
turnstile/remote.py
SimpleRPC.serve
def serve(self, conn, addr, auth=False): """ Handle a single client. :param conn: The Connection instance. :param addr: The address of the client, for logging purposes. :param auth: A boolean specifying whether the connection should be considered authenticat...
python
def serve(self, conn, addr, auth=False): """ Handle a single client. :param conn: The Connection instance. :param addr: The address of the client, for logging purposes. :param auth: A boolean specifying whether the connection should be considered authenticat...
[ "def", "serve", "(", "self", ",", "conn", ",", "addr", ",", "auth", "=", "False", ")", ":", "try", ":", "while", "True", ":", "try", ":", "cmd", ",", "payload", "=", "conn", ".", "recv", "(", ")", "except", "ValueError", "as", "exc", ":", "conn",...
Handle a single client. :param conn: The Connection instance. :param addr: The address of the client, for logging purposes. :param auth: A boolean specifying whether the connection should be considered authenticated or not. Provided for debugging.
[ "Handle", "a", "single", "client", "." ]
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L419-L514
train
klmitch/turnstile
turnstile/remote.py
RemoteControlDaemon.get_limits
def get_limits(self): """ Retrieve the LimitData object the middleware will use for getting the limits. This implementation returns a RemoteLimitData instance that can access the LimitData stored in the RemoteControlDaemon process. """ # Set one up if we don't a...
python
def get_limits(self): """ Retrieve the LimitData object the middleware will use for getting the limits. This implementation returns a RemoteLimitData instance that can access the LimitData stored in the RemoteControlDaemon process. """ # Set one up if we don't a...
[ "def", "get_limits", "(", "self", ")", ":", "if", "not", "self", ".", "remote_limits", ":", "self", ".", "remote_limits", "=", "RemoteLimitData", "(", "self", ".", "remote", ")", "return", "self", ".", "remote_limits" ]
Retrieve the LimitData object the middleware will use for getting the limits. This implementation returns a RemoteLimitData instance that can access the LimitData stored in the RemoteControlDaemon process.
[ "Retrieve", "the", "LimitData", "object", "the", "middleware", "will", "use", "for", "getting", "the", "limits", ".", "This", "implementation", "returns", "a", "RemoteLimitData", "instance", "that", "can", "access", "the", "LimitData", "stored", "in", "the", "Re...
8fe9a359b45e505d3192ab193ecf9be177ab1a17
https://github.com/klmitch/turnstile/blob/8fe9a359b45e505d3192ab193ecf9be177ab1a17/turnstile/remote.py#L643-L654
train
kata198/python-subprocess2
subprocess2/__init__.py
waitUpTo
def waitUpTo(self, timeoutSeconds, pollInterval=DEFAULT_POLL_INTERVAL): ''' Popen.waitUpTo - Wait up to a certain number of seconds for the process to end. @param timeoutSeconds <float> - Number of seconds to wait @param pollInterval <float> (default .05) - Number of seconds in bet...
python
def waitUpTo(self, timeoutSeconds, pollInterval=DEFAULT_POLL_INTERVAL): ''' Popen.waitUpTo - Wait up to a certain number of seconds for the process to end. @param timeoutSeconds <float> - Number of seconds to wait @param pollInterval <float> (default .05) - Number of seconds in bet...
[ "def", "waitUpTo", "(", "self", ",", "timeoutSeconds", ",", "pollInterval", "=", "DEFAULT_POLL_INTERVAL", ")", ":", "i", "=", "0", "numWaits", "=", "timeoutSeconds", "/", "float", "(", "pollInterval", ")", "ret", "=", "self", ".", "poll", "(", ")", "if", ...
Popen.waitUpTo - Wait up to a certain number of seconds for the process to end. @param timeoutSeconds <float> - Number of seconds to wait @param pollInterval <float> (default .05) - Number of seconds in between each poll @return - Returncode of application, or None if did not term...
[ "Popen", ".", "waitUpTo", "-", "Wait", "up", "to", "a", "certain", "number", "of", "seconds", "for", "the", "process", "to", "end", "." ]
8544b0b651d8e14de9fdd597baa704182e248b01
https://github.com/kata198/python-subprocess2/blob/8544b0b651d8e14de9fdd597baa704182e248b01/subprocess2/__init__.py#L63-L85
train
kata198/python-subprocess2
subprocess2/__init__.py
waitOrTerminate
def waitOrTerminate(self, timeoutSeconds, pollInterval=DEFAULT_POLL_INTERVAL, terminateToKillSeconds=SUBPROCESS2_DEFAULT_TERMINATE_TO_KILL_SECONDS): ''' waitOrTerminate - Wait up to a certain number of seconds for the process to end. If the process is running after the timeout has been exceeded...
python
def waitOrTerminate(self, timeoutSeconds, pollInterval=DEFAULT_POLL_INTERVAL, terminateToKillSeconds=SUBPROCESS2_DEFAULT_TERMINATE_TO_KILL_SECONDS): ''' waitOrTerminate - Wait up to a certain number of seconds for the process to end. If the process is running after the timeout has been exceeded...
[ "def", "waitOrTerminate", "(", "self", ",", "timeoutSeconds", ",", "pollInterval", "=", "DEFAULT_POLL_INTERVAL", ",", "terminateToKillSeconds", "=", "SUBPROCESS2_DEFAULT_TERMINATE_TO_KILL_SECONDS", ")", ":", "returnCode", "=", "self", ".", "waitUpTo", "(", "timeoutSeconds...
waitOrTerminate - Wait up to a certain number of seconds for the process to end. If the process is running after the timeout has been exceeded, a SIGTERM will be sent. Optionally, an additional SIGKILL can be sent after some configurable interval. See #terminateToKillSeconds doc below ...
[ "waitOrTerminate", "-", "Wait", "up", "to", "a", "certain", "number", "of", "seconds", "for", "the", "process", "to", "end", "." ]
8544b0b651d8e14de9fdd597baa704182e248b01
https://github.com/kata198/python-subprocess2/blob/8544b0b651d8e14de9fdd597baa704182e248b01/subprocess2/__init__.py#L89-L147
train
kata198/python-subprocess2
subprocess2/__init__.py
runInBackground
def runInBackground(self, pollInterval=.1, encoding=False): ''' runInBackground - Create a background thread which will manage this process, automatically read from streams, and perform any cleanups The object returned is a "BackgroundTaskInfo" object, and represents the state of the process. It ...
python
def runInBackground(self, pollInterval=.1, encoding=False): ''' runInBackground - Create a background thread which will manage this process, automatically read from streams, and perform any cleanups The object returned is a "BackgroundTaskInfo" object, and represents the state of the process. It ...
[ "def", "runInBackground", "(", "self", ",", "pollInterval", "=", ".1", ",", "encoding", "=", "False", ")", ":", "from", ".", "BackgroundTask", "import", "BackgroundTaskThread", "taskInfo", "=", "BackgroundTaskInfo", "(", "encoding", ")", "thread", "=", "Backgrou...
runInBackground - Create a background thread which will manage this process, automatically read from streams, and perform any cleanups The object returned is a "BackgroundTaskInfo" object, and represents the state of the process. It is updated automatically as the program runs, and if stdout or s...
[ "runInBackground", "-", "Create", "a", "background", "thread", "which", "will", "manage", "this", "process", "automatically", "read", "from", "streams", "and", "perform", "any", "cleanups" ]
8544b0b651d8e14de9fdd597baa704182e248b01
https://github.com/kata198/python-subprocess2/blob/8544b0b651d8e14de9fdd597baa704182e248b01/subprocess2/__init__.py#L152-L172
train
jstitch/MambuPy
MambuPy/rest/mambugroup.py
MambuGroup.setClients
def setClients(self, *args, **kwargs): """Adds the clients for this group to a 'clients' field. The 'groupMembers' field of the group holds the encodedKeys of the member clients of the group. Since Mambu REST API accepts both ids or encodedKeys to retrieve entities, we use that here. ...
python
def setClients(self, *args, **kwargs): """Adds the clients for this group to a 'clients' field. The 'groupMembers' field of the group holds the encodedKeys of the member clients of the group. Since Mambu REST API accepts both ids or encodedKeys to retrieve entities, we use that here. ...
[ "def", "setClients", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "requests", "=", "0", "if", "'fullDetails'", "in", "kwargs", ":", "fullDetails", "=", "kwargs", "[", "'fullDetails'", "]", "kwargs", ".", "pop", "(", "'fullDetails'", ")",...
Adds the clients for this group to a 'clients' field. The 'groupMembers' field of the group holds the encodedKeys of the member clients of the group. Since Mambu REST API accepts both ids or encodedKeys to retrieve entities, we use that here. You may wish to get the full details of eac...
[ "Adds", "the", "clients", "for", "this", "group", "to", "a", "clients", "field", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambugroup.py#L77-L112
train
jstitch/MambuPy
MambuPy/rest/mambugroup.py
MambuGroup.setActivities
def setActivities(self, *args, **kwargs): """Adds the activities for this group to a 'activities' field. Activities are MambuActivity objects. Activities get sorted by activity timestamp. Returns the number of requests done to Mambu. """ def activityDate(activity): ...
python
def setActivities(self, *args, **kwargs): """Adds the activities for this group to a 'activities' field. Activities are MambuActivity objects. Activities get sorted by activity timestamp. Returns the number of requests done to Mambu. """ def activityDate(activity): ...
[ "def", "setActivities", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "def", "activityDate", "(", "activity", ")", ":", "try", ":", "return", "activity", "[", "'activity'", "]", "[", "'timestamp'", "]", "except", "KeyError", "as", "kerr",...
Adds the activities for this group to a 'activities' field. Activities are MambuActivity objects. Activities get sorted by activity timestamp. Returns the number of requests done to Mambu.
[ "Adds", "the", "activities", "for", "this", "group", "to", "a", "activities", "field", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambugroup.py#L142-L167
train
azogue/i2csense
i2csense/bh1750.py
BH1750.set_sensitivity
def set_sensitivity(self, sensitivity=DEFAULT_SENSITIVITY): """Set the sensitivity value. Valid values are 31 (lowest) to 254 (highest), default is 69. """ if sensitivity < 31: self._mtreg = 31 elif sensitivity > 254: self._mtreg = 254 else: ...
python
def set_sensitivity(self, sensitivity=DEFAULT_SENSITIVITY): """Set the sensitivity value. Valid values are 31 (lowest) to 254 (highest), default is 69. """ if sensitivity < 31: self._mtreg = 31 elif sensitivity > 254: self._mtreg = 254 else: ...
[ "def", "set_sensitivity", "(", "self", ",", "sensitivity", "=", "DEFAULT_SENSITIVITY", ")", ":", "if", "sensitivity", "<", "31", ":", "self", ".", "_mtreg", "=", "31", "elif", "sensitivity", ">", "254", ":", "self", ".", "_mtreg", "=", "254", "else", ":"...
Set the sensitivity value. Valid values are 31 (lowest) to 254 (highest), default is 69.
[ "Set", "the", "sensitivity", "value", "." ]
ecc6806dcee9de827a5414a9e836d271fedca9b9
https://github.com/azogue/i2csense/blob/ecc6806dcee9de827a5414a9e836d271fedca9b9/i2csense/bh1750.py#L92-L106
train
azogue/i2csense
i2csense/bh1750.py
BH1750._get_result
def _get_result(self) -> float: """Return current measurement result in lx.""" try: data = self._bus.read_word_data(self._i2c_add, self._mode) self._ok = True except OSError as exc: self.log_error("Bad reading in bus: %s", exc) self._ok = False ...
python
def _get_result(self) -> float: """Return current measurement result in lx.""" try: data = self._bus.read_word_data(self._i2c_add, self._mode) self._ok = True except OSError as exc: self.log_error("Bad reading in bus: %s", exc) self._ok = False ...
[ "def", "_get_result", "(", "self", ")", "->", "float", ":", "try", ":", "data", "=", "self", ".", "_bus", ".", "read_word_data", "(", "self", ".", "_i2c_add", ",", "self", ".", "_mode", ")", "self", ".", "_ok", "=", "True", "except", "OSError", "as",...
Return current measurement result in lx.
[ "Return", "current", "measurement", "result", "in", "lx", "." ]
ecc6806dcee9de827a5414a9e836d271fedca9b9
https://github.com/azogue/i2csense/blob/ecc6806dcee9de827a5414a9e836d271fedca9b9/i2csense/bh1750.py#L108-L121
train
azogue/i2csense
i2csense/bh1750.py
BH1750._wait_for_result
def _wait_for_result(self): """Wait for the sensor to be ready for measurement.""" basetime = 0.018 if self._low_res else 0.128 sleep(basetime * (self._mtreg / 69.0) + self._delay)
python
def _wait_for_result(self): """Wait for the sensor to be ready for measurement.""" basetime = 0.018 if self._low_res else 0.128 sleep(basetime * (self._mtreg / 69.0) + self._delay)
[ "def", "_wait_for_result", "(", "self", ")", ":", "basetime", "=", "0.018", "if", "self", ".", "_low_res", "else", "0.128", "sleep", "(", "basetime", "*", "(", "self", ".", "_mtreg", "/", "69.0", ")", "+", "self", ".", "_delay", ")" ]
Wait for the sensor to be ready for measurement.
[ "Wait", "for", "the", "sensor", "to", "be", "ready", "for", "measurement", "." ]
ecc6806dcee9de827a5414a9e836d271fedca9b9
https://github.com/azogue/i2csense/blob/ecc6806dcee9de827a5414a9e836d271fedca9b9/i2csense/bh1750.py#L123-L126
train
azogue/i2csense
i2csense/bh1750.py
BH1750.update
def update(self): """Update the measured light level in lux.""" if not self._continuous_sampling \ or self._light_level < 0 \ or self._operation_mode != self._mode: self._reset() self._set_mode(self._operation_mode) self._wait_for_resul...
python
def update(self): """Update the measured light level in lux.""" if not self._continuous_sampling \ or self._light_level < 0 \ or self._operation_mode != self._mode: self._reset() self._set_mode(self._operation_mode) self._wait_for_resul...
[ "def", "update", "(", "self", ")", ":", "if", "not", "self", ".", "_continuous_sampling", "or", "self", ".", "_light_level", "<", "0", "or", "self", ".", "_operation_mode", "!=", "self", ".", "_mode", ":", "self", ".", "_reset", "(", ")", "self", ".", ...
Update the measured light level in lux.
[ "Update", "the", "measured", "light", "level", "in", "lux", "." ]
ecc6806dcee9de827a5414a9e836d271fedca9b9
https://github.com/azogue/i2csense/blob/ecc6806dcee9de827a5414a9e836d271fedca9b9/i2csense/bh1750.py#L128-L138
train
jpscaletti/authcode
authcode/utils.py
get_token
def get_token(user, secret, timestamp=None): """Make a timestamped one-time-use token that can be used to identifying the user. By hashing the `last_sign_in` attribute and a snippet of the current password hash salt, it produces a token that will be invalidated as soon as the user log in again or t...
python
def get_token(user, secret, timestamp=None): """Make a timestamped one-time-use token that can be used to identifying the user. By hashing the `last_sign_in` attribute and a snippet of the current password hash salt, it produces a token that will be invalidated as soon as the user log in again or t...
[ "def", "get_token", "(", "user", ",", "secret", ",", "timestamp", "=", "None", ")", ":", "timestamp", "=", "int", "(", "timestamp", "or", "time", "(", ")", ")", "secret", "=", "to_bytes", "(", "secret", ")", "key", "=", "'|'", ".", "join", "(", "["...
Make a timestamped one-time-use token that can be used to identifying the user. By hashing the `last_sign_in` attribute and a snippet of the current password hash salt, it produces a token that will be invalidated as soon as the user log in again or the is changed. A hash of the user ID is used, s...
[ "Make", "a", "timestamped", "one", "-", "time", "-", "use", "token", "that", "can", "be", "used", "to", "identifying", "the", "user", "." ]
91529b6d0caec07d1452758d937e1e0745826139
https://github.com/jpscaletti/authcode/blob/91529b6d0caec07d1452758d937e1e0745826139/authcode/utils.py#L63-L90
train
jpscaletti/authcode
authcode/utils.py
LazyUser.__get_user
def __get_user(self): """Return the real user object. """ storage = object.__getattribute__(self, '_LazyUser__storage') user = getattr(self.__auth, 'get_user')() setattr(storage, self.__user_name, user) return user
python
def __get_user(self): """Return the real user object. """ storage = object.__getattribute__(self, '_LazyUser__storage') user = getattr(self.__auth, 'get_user')() setattr(storage, self.__user_name, user) return user
[ "def", "__get_user", "(", "self", ")", ":", "storage", "=", "object", ".", "__getattribute__", "(", "self", ",", "'_LazyUser__storage'", ")", "user", "=", "getattr", "(", "self", ".", "__auth", ",", "'get_user'", ")", "(", ")", "setattr", "(", "storage", ...
Return the real user object.
[ "Return", "the", "real", "user", "object", "." ]
91529b6d0caec07d1452758d937e1e0745826139
https://github.com/jpscaletti/authcode/blob/91529b6d0caec07d1452758d937e1e0745826139/authcode/utils.py#L116-L122
train
cloudmesh-cmd3/cmd3
cmd3/plugins/browser.py
browser._expand_filename
def _expand_filename(self, line): """expands the filename if there is a . as leading path""" # expand . newline = line path = os.getcwd() if newline.startswith("."): newline = newline.replace(".", path, 1) # expand ~ newline = os.path.expanduser(newlin...
python
def _expand_filename(self, line): """expands the filename if there is a . as leading path""" # expand . newline = line path = os.getcwd() if newline.startswith("."): newline = newline.replace(".", path, 1) # expand ~ newline = os.path.expanduser(newlin...
[ "def", "_expand_filename", "(", "self", ",", "line", ")", ":", "newline", "=", "line", "path", "=", "os", ".", "getcwd", "(", ")", "if", "newline", ".", "startswith", "(", "\".\"", ")", ":", "newline", "=", "newline", ".", "replace", "(", "\".\"", ",...
expands the filename if there is a . as leading path
[ "expands", "the", "filename", "if", "there", "is", "a", ".", "as", "leading", "path" ]
92e33c96032fd3921f159198a0e57917c4dc34ed
https://github.com/cloudmesh-cmd3/cmd3/blob/92e33c96032fd3921f159198a0e57917c4dc34ed/cmd3/plugins/browser.py#L14-L23
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
setCustomField
def setCustomField(mambuentity, customfield="", *args, **kwargs): """Modifies the customField field for the given object with something related to the value of the given field. If the dataType == "USER_LINK" then instead of using the value of the CF, it will be a MambuUser object. Same if dataType...
python
def setCustomField(mambuentity, customfield="", *args, **kwargs): """Modifies the customField field for the given object with something related to the value of the given field. If the dataType == "USER_LINK" then instead of using the value of the CF, it will be a MambuUser object. Same if dataType...
[ "def", "setCustomField", "(", "mambuentity", ",", "customfield", "=", "\"\"", ",", "*", "args", ",", "**", "kwargs", ")", ":", "from", ".", "import", "mambuuser", "from", ".", "import", "mambuclient", "try", ":", "customFieldValue", "=", "mambuentity", "[", ...
Modifies the customField field for the given object with something related to the value of the given field. If the dataType == "USER_LINK" then instead of using the value of the CF, it will be a MambuUser object. Same if dataType == "CLIENT_LINK", but with a MambuClient. Default case: just uses t...
[ "Modifies", "the", "customField", "field", "for", "the", "given", "object", "with", "something", "related", "to", "the", "value", "of", "the", "given", "field", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L837-L878
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
MambuStruct.serializeFields
def serializeFields(data): """Turns every attribute of the Mambu object in to a string representation. If the object is an iterable one, it goes down to each of its elements and turns its attributes too, recursively. The base case is when it's a MambuStruct class (this one) so it ...
python
def serializeFields(data): """Turns every attribute of the Mambu object in to a string representation. If the object is an iterable one, it goes down to each of its elements and turns its attributes too, recursively. The base case is when it's a MambuStruct class (this one) so it ...
[ "def", "serializeFields", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "MambuStruct", ")", ":", "return", "data", ".", "serializeStruct", "(", ")", "try", ":", "it", "=", "iter", "(", "data", ")", "except", "TypeError", "as", "terr", ":...
Turns every attribute of the Mambu object in to a string representation. If the object is an iterable one, it goes down to each of its elements and turns its attributes too, recursively. The base case is when it's a MambuStruct class (this one) so it just 'serializes' the attr atribute...
[ "Turns", "every", "attribute", "of", "the", "Mambu", "object", "in", "to", "a", "string", "representation", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L121-L150
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
MambuStruct.init
def init(self, attrs={}, *args, **kwargs): """Default initialization from a dictionary responded by Mambu in to the elements of the Mambu object. It assings the response to attrs attribute and converts each of its elements from a string to an adequate python object: number, dat...
python
def init(self, attrs={}, *args, **kwargs): """Default initialization from a dictionary responded by Mambu in to the elements of the Mambu object. It assings the response to attrs attribute and converts each of its elements from a string to an adequate python object: number, dat...
[ "def", "init", "(", "self", ",", "attrs", "=", "{", "}", ",", "*", "args", ",", "**", "kwargs", ")", ":", "self", ".", "attrs", "=", "attrs", "self", ".", "preprocess", "(", ")", "self", ".", "convertDict2Attrs", "(", "*", "args", ",", "**", "kwa...
Default initialization from a dictionary responded by Mambu in to the elements of the Mambu object. It assings the response to attrs attribute and converts each of its elements from a string to an adequate python object: number, datetime, etc. Basically it stores the response ...
[ "Default", "initialization", "from", "a", "dictionary", "responded", "by", "Mambu" ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L299-L355
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
MambuStruct.connect
def connect(self, *args, **kwargs): """Connect to Mambu, make the request to the REST API. If there's no urlfunc to use, nothing is done here. When done, initializes the attrs attribute of the Mambu object by calling the init method. Please refer to that code and pydoc for furt...
python
def connect(self, *args, **kwargs): """Connect to Mambu, make the request to the REST API. If there's no urlfunc to use, nothing is done here. When done, initializes the attrs attribute of the Mambu object by calling the init method. Please refer to that code and pydoc for furt...
[ "def", "connect", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "from", "copy", "import", "deepcopy", "if", "args", ":", "self", ".", "__args", "=", "deepcopy", "(", "args", ")", "if", "kwargs", ":", "for", "k", ",", "v", "in", "k...
Connect to Mambu, make the request to the REST API. If there's no urlfunc to use, nothing is done here. When done, initializes the attrs attribute of the Mambu object by calling the init method. Please refer to that code and pydoc for further information. Uses urllib module to...
[ "Connect", "to", "Mambu", "make", "the", "request", "to", "the", "REST", "API", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L516-L664
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
MambuStruct.convertDict2Attrs
def convertDict2Attrs(self, *args, **kwargs): """Each element on the atttrs attribute gest converted to a proper python object, depending on type. Some default constantFields are left as is (strings), because they are better treated as strings. """ constantFields = ['id'...
python
def convertDict2Attrs(self, *args, **kwargs): """Each element on the atttrs attribute gest converted to a proper python object, depending on type. Some default constantFields are left as is (strings), because they are better treated as strings. """ constantFields = ['id'...
[ "def", "convertDict2Attrs", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "constantFields", "=", "[", "'id'", ",", "'groupName'", ",", "'name'", ",", "'homePhone'", ",", "'mobilePhone1'", ",", "'phoneNumber'", ",", "'postcode'", ",", "'emailA...
Each element on the atttrs attribute gest converted to a proper python object, depending on type. Some default constantFields are left as is (strings), because they are better treated as strings.
[ "Each", "element", "on", "the", "atttrs", "attribute", "gest", "converted", "to", "a", "proper", "python", "object", "depending", "on", "type", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L739-L791
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
MambuStruct.util_dateFormat
def util_dateFormat(self, field, formato=None): """Converts a datetime field to a datetime using some specified format. What this really means is that, if specified format includes only for instance just year and month, day and further info gets ignored and the objects get a datetime wi...
python
def util_dateFormat(self, field, formato=None): """Converts a datetime field to a datetime using some specified format. What this really means is that, if specified format includes only for instance just year and month, day and further info gets ignored and the objects get a datetime wi...
[ "def", "util_dateFormat", "(", "self", ",", "field", ",", "formato", "=", "None", ")", ":", "if", "not", "formato", ":", "try", ":", "formato", "=", "self", ".", "__formatoFecha", "except", "AttributeError", ":", "formato", "=", "\"%Y-%m-%dT%H:%M:%S+0000\"", ...
Converts a datetime field to a datetime using some specified format. What this really means is that, if specified format includes only for instance just year and month, day and further info gets ignored and the objects get a datetime with year and month, and day 1, hour 0, minute 0, etc...
[ "Converts", "a", "datetime", "field", "to", "a", "datetime", "using", "some", "specified", "format", "." ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L793-L814
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
MambuStruct.create
def create(self, data, *args, **kwargs): """Creates an entity in Mambu This method must be implemented in child classes Args: data (dictionary): dictionary with data to send, this dictionary is specific for each Mambu entity """ # if m...
python
def create(self, data, *args, **kwargs): """Creates an entity in Mambu This method must be implemented in child classes Args: data (dictionary): dictionary with data to send, this dictionary is specific for each Mambu entity """ # if m...
[ "def", "create", "(", "self", ",", "data", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "create", ".", "__func__", ".", "__module__", "!=", "self", ".", "__module__", ":", "raise", "Exception", "(", "\"Child method not implemented\""...
Creates an entity in Mambu This method must be implemented in child classes Args: data (dictionary): dictionary with data to send, this dictionary is specific for each Mambu entity
[ "Creates", "an", "entity", "in", "Mambu" ]
2af98cc12e7ed5ec183b3e97644e880e70b79ee8
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L816-L834
train
ExoticObjects/django-sql-server-bcp
django_sql_server_bcp/__init__.py
BCPFormat.make
def make(self, cmd_args, db_args): ''' Runs bcp FORMAT command to create a format file that will assist in creating the bulk data file ''' with NamedTemporaryFile(delete=True) as f: format_file = f.name + '.bcp-format' format_args = cmd_args + ['format', NULL_FILE, '-...
python
def make(self, cmd_args, db_args): ''' Runs bcp FORMAT command to create a format file that will assist in creating the bulk data file ''' with NamedTemporaryFile(delete=True) as f: format_file = f.name + '.bcp-format' format_args = cmd_args + ['format', NULL_FILE, '-...
[ "def", "make", "(", "self", ",", "cmd_args", ",", "db_args", ")", ":", "with", "NamedTemporaryFile", "(", "delete", "=", "True", ")", "as", "f", ":", "format_file", "=", "f", ".", "name", "+", "'.bcp-format'", "format_args", "=", "cmd_args", "+", "[", ...
Runs bcp FORMAT command to create a format file that will assist in creating the bulk data file
[ "Runs", "bcp", "FORMAT", "command", "to", "create", "a", "format", "file", "that", "will", "assist", "in", "creating", "the", "bulk", "data", "file" ]
3bfc593a18091cf837a9c31cbbe7025ecc5e3226
https://github.com/ExoticObjects/django-sql-server-bcp/blob/3bfc593a18091cf837a9c31cbbe7025ecc5e3226/django_sql_server_bcp/__init__.py#L110-L119
train
ExoticObjects/django-sql-server-bcp
django_sql_server_bcp/__init__.py
BCPFormat.load
def load(self, filename=None): ''' Reads a non-XML bcp FORMAT file and parses it into fields list used for creating bulk data file ''' fields = [] with open(filename, 'r') as f: format_data = f.read().strip() lines = format_data.split('\n') self._sql_...
python
def load(self, filename=None): ''' Reads a non-XML bcp FORMAT file and parses it into fields list used for creating bulk data file ''' fields = [] with open(filename, 'r') as f: format_data = f.read().strip() lines = format_data.split('\n') self._sql_...
[ "def", "load", "(", "self", ",", "filename", "=", "None", ")", ":", "fields", "=", "[", "]", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "format_data", "=", "f", ".", "read", "(", ")", ".", "strip", "(", ")", "lines", "=",...
Reads a non-XML bcp FORMAT file and parses it into fields list used for creating bulk data file
[ "Reads", "a", "non", "-", "XML", "bcp", "FORMAT", "file", "and", "parses", "it", "into", "fields", "list", "used", "for", "creating", "bulk", "data", "file" ]
3bfc593a18091cf837a9c31cbbe7025ecc5e3226
https://github.com/ExoticObjects/django-sql-server-bcp/blob/3bfc593a18091cf837a9c31cbbe7025ecc5e3226/django_sql_server_bcp/__init__.py#L121-L140
train
transifex/transifex-python-library
txlib/api/resources.py
Resource.retrieve_content
def retrieve_content(self): """Retrieve the content of a resource.""" path = self._construct_path_to_source_content() res = self._http.get(path) self._populated_fields['content'] = res['content'] return res['content']
python
def retrieve_content(self): """Retrieve the content of a resource.""" path = self._construct_path_to_source_content() res = self._http.get(path) self._populated_fields['content'] = res['content'] return res['content']
[ "def", "retrieve_content", "(", "self", ")", ":", "path", "=", "self", ".", "_construct_path_to_source_content", "(", ")", "res", "=", "self", ".", "_http", ".", "get", "(", "path", ")", "self", ".", "_populated_fields", "[", "'content'", "]", "=", "res", ...
Retrieve the content of a resource.
[ "Retrieve", "the", "content", "of", "a", "resource", "." ]
9fea86b718973de35ccca6d54bd1f445c9632406
https://github.com/transifex/transifex-python-library/blob/9fea86b718973de35ccca6d54bd1f445c9632406/txlib/api/resources.py#L27-L32
train
transifex/transifex-python-library
txlib/api/resources.py
Resource._update
def _update(self, **kwargs): """Use separate URL for updating the source file.""" if 'content' in kwargs: content = kwargs.pop('content') path = self._construct_path_to_source_content() self._http.put(path, json.dumps({'content': content})) super(Resource, sel...
python
def _update(self, **kwargs): """Use separate URL for updating the source file.""" if 'content' in kwargs: content = kwargs.pop('content') path = self._construct_path_to_source_content() self._http.put(path, json.dumps({'content': content})) super(Resource, sel...
[ "def", "_update", "(", "self", ",", "**", "kwargs", ")", ":", "if", "'content'", "in", "kwargs", ":", "content", "=", "kwargs", ".", "pop", "(", "'content'", ")", "path", "=", "self", ".", "_construct_path_to_source_content", "(", ")", "self", ".", "_htt...
Use separate URL for updating the source file.
[ "Use", "separate", "URL", "for", "updating", "the", "source", "file", "." ]
9fea86b718973de35ccca6d54bd1f445c9632406
https://github.com/transifex/transifex-python-library/blob/9fea86b718973de35ccca6d54bd1f445c9632406/txlib/api/resources.py#L34-L40
train
cloudmesh-cmd3/cmd3
fabfile/clean.py
all
def all(): """clean the dis and uninstall cloudmesh""" dir() cmd3() banner("CLEAN PREVIOUS CLOUDMESH INSTALLS") r = int(local("pip freeze |fgrep cloudmesh | wc -l", capture=True)) while r > 0: local('echo "y\n" | pip uninstall cloudmesh') r = int(local("pip freeze |fgrep cloudmes...
python
def all(): """clean the dis and uninstall cloudmesh""" dir() cmd3() banner("CLEAN PREVIOUS CLOUDMESH INSTALLS") r = int(local("pip freeze |fgrep cloudmesh | wc -l", capture=True)) while r > 0: local('echo "y\n" | pip uninstall cloudmesh') r = int(local("pip freeze |fgrep cloudmes...
[ "def", "all", "(", ")", ":", "dir", "(", ")", "cmd3", "(", ")", "banner", "(", "\"CLEAN PREVIOUS CLOUDMESH INSTALLS\"", ")", "r", "=", "int", "(", "local", "(", "\"pip freeze |fgrep cloudmesh | wc -l\"", ",", "capture", "=", "True", ")", ")", "while", "r", ...
clean the dis and uninstall cloudmesh
[ "clean", "the", "dis", "and", "uninstall", "cloudmesh" ]
92e33c96032fd3921f159198a0e57917c4dc34ed
https://github.com/cloudmesh-cmd3/cmd3/blob/92e33c96032fd3921f159198a0e57917c4dc34ed/fabfile/clean.py#L24-L32
train
frostming/marko
marko/inline.py
InlineElement.find
def find(cls, text): """This method should return an iterable containing matches of this element.""" if isinstance(cls.pattern, string_types): cls.pattern = re.compile(cls.pattern) return cls.pattern.finditer(text)
python
def find(cls, text): """This method should return an iterable containing matches of this element.""" if isinstance(cls.pattern, string_types): cls.pattern = re.compile(cls.pattern) return cls.pattern.finditer(text)
[ "def", "find", "(", "cls", ",", "text", ")", ":", "if", "isinstance", "(", "cls", ".", "pattern", ",", "string_types", ")", ":", "cls", ".", "pattern", "=", "re", ".", "compile", "(", "cls", ".", "pattern", ")", "return", "cls", ".", "pattern", "."...
This method should return an iterable containing matches of this element.
[ "This", "method", "should", "return", "an", "iterable", "containing", "matches", "of", "this", "element", "." ]
1cd030b665fa37bad1f8b3a25a89ce1a7c491dde
https://github.com/frostming/marko/blob/1cd030b665fa37bad1f8b3a25a89ce1a7c491dde/marko/inline.py#L39-L43
train
youversion/crony
crony/crony.py
main
def main(): """Entry point for running crony. 1. If a --cronitor/-c is specified, a "run" ping is sent to cronitor. 2. The argument string passed to crony is ran. 3. Next steps depend on the exit code of the command ran. * If the exit status is 0 and a --cronitor/-c is specified, a "complete" p...
python
def main(): """Entry point for running crony. 1. If a --cronitor/-c is specified, a "run" ping is sent to cronitor. 2. The argument string passed to crony is ran. 3. Next steps depend on the exit code of the command ran. * If the exit status is 0 and a --cronitor/-c is specified, a "complete" p...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Monitor your crons with cronitor.io & sentry.io'", ",", "epilog", "=", "'https://github.com/youversion/crony'", ",", "prog", "=", "'crony'", ")", "parser", ".", ...
Entry point for running crony. 1. If a --cronitor/-c is specified, a "run" ping is sent to cronitor. 2. The argument string passed to crony is ran. 3. Next steps depend on the exit code of the command ran. * If the exit status is 0 and a --cronitor/-c is specified, a "complete" ping is sent ...
[ "Entry", "point", "for", "running", "crony", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L232-L290
train
youversion/crony
crony/crony.py
CommandCenter.cronitor
def cronitor(self): """Wrap run with requests to cronitor.""" url = f'https://cronitor.link/{self.opts.cronitor}/{{}}' try: run_url = url.format('run') self.logger.debug(f'Pinging {run_url}') requests.get(run_url, timeout=self.opts.timeout) except re...
python
def cronitor(self): """Wrap run with requests to cronitor.""" url = f'https://cronitor.link/{self.opts.cronitor}/{{}}' try: run_url = url.format('run') self.logger.debug(f'Pinging {run_url}') requests.get(run_url, timeout=self.opts.timeout) except re...
[ "def", "cronitor", "(", "self", ")", ":", "url", "=", "f'https://cronitor.link/{self.opts.cronitor}/{{}}'", "try", ":", "run_url", "=", "url", ".", "format", "(", "'run'", ")", "self", ".", "logger", ".", "debug", "(", "f'Pinging {run_url}'", ")", "requests", ...
Wrap run with requests to cronitor.
[ "Wrap", "run", "with", "requests", "to", "cronitor", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L76-L100
train
youversion/crony
crony/crony.py
CommandCenter.load_config
def load_config(self, custom_config): """Attempt to load config from file. If the command specified a --config parameter, then load that config file. Otherwise, the user's home directory takes precedence over a system wide config. Config file in the user's dir should be named ".cronyrc"...
python
def load_config(self, custom_config): """Attempt to load config from file. If the command specified a --config parameter, then load that config file. Otherwise, the user's home directory takes precedence over a system wide config. Config file in the user's dir should be named ".cronyrc"...
[ "def", "load_config", "(", "self", ",", "custom_config", ")", ":", "self", ".", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "if", "custom_config", ":", "self", ".", "config", ".", "read", "(", "custom_config", ")", "return", "f'Loading conf...
Attempt to load config from file. If the command specified a --config parameter, then load that config file. Otherwise, the user's home directory takes precedence over a system wide config. Config file in the user's dir should be named ".cronyrc". System wide config should be located at...
[ "Attempt", "to", "load", "config", "from", "file", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L102-L127
train
youversion/crony
crony/crony.py
CommandCenter.log
def log(self, output, exit_status): """Log given CompletedProcess and return exit status code.""" if exit_status != 0: self.logger.error(f'Error running command! Exit status: {exit_status}, {output}') return exit_status
python
def log(self, output, exit_status): """Log given CompletedProcess and return exit status code.""" if exit_status != 0: self.logger.error(f'Error running command! Exit status: {exit_status}, {output}') return exit_status
[ "def", "log", "(", "self", ",", "output", ",", "exit_status", ")", ":", "if", "exit_status", "!=", "0", ":", "self", ".", "logger", ".", "error", "(", "f'Error running command! Exit status: {exit_status}, {output}'", ")", "return", "exit_status" ]
Log given CompletedProcess and return exit status code.
[ "Log", "given", "CompletedProcess", "and", "return", "exit", "status", "code", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L129-L134
train
youversion/crony
crony/crony.py
CommandCenter.run
def run(self): """Run command and report errors to Sentry.""" self.logger.debug(f'Running command: {self.cmd}') def execute(cmd): output = "" popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_ne...
python
def run(self): """Run command and report errors to Sentry.""" self.logger.debug(f'Running command: {self.cmd}') def execute(cmd): output = "" popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_ne...
[ "def", "run", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "f'Running command: {self.cmd}'", ")", "def", "execute", "(", "cmd", ")", ":", "output", "=", "\"\"", "popen", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "stdout", "=...
Run command and report errors to Sentry.
[ "Run", "command", "and", "report", "errors", "to", "Sentry", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L136-L158
train
youversion/crony
crony/crony.py
CommandCenter.setup_dir
def setup_dir(self): """Change directory for script if necessary.""" cd = self.opts.cd or self.config['crony'].get('directory') if cd: self.logger.debug(f'Adding cd to {cd}') self.cmd = f'cd {cd} && {self.cmd}'
python
def setup_dir(self): """Change directory for script if necessary.""" cd = self.opts.cd or self.config['crony'].get('directory') if cd: self.logger.debug(f'Adding cd to {cd}') self.cmd = f'cd {cd} && {self.cmd}'
[ "def", "setup_dir", "(", "self", ")", ":", "cd", "=", "self", ".", "opts", ".", "cd", "or", "self", ".", "config", "[", "'crony'", "]", ".", "get", "(", "'directory'", ")", "if", "cd", ":", "self", ".", "logger", ".", "debug", "(", "f'Adding cd to ...
Change directory for script if necessary.
[ "Change", "directory", "for", "script", "if", "necessary", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L160-L165
train
youversion/crony
crony/crony.py
CommandCenter.setup_logging
def setup_logging(self): """Setup python logging handler.""" date_format = '%Y-%m-%dT%H:%M:%S' log_format = '%(asctime)s %(levelname)s: %(message)s' if self.opts.verbose: lvl = logging.DEBUG else: lvl = logging.INFO # Requests is a bit chatty ...
python
def setup_logging(self): """Setup python logging handler.""" date_format = '%Y-%m-%dT%H:%M:%S' log_format = '%(asctime)s %(levelname)s: %(message)s' if self.opts.verbose: lvl = logging.DEBUG else: lvl = logging.INFO # Requests is a bit chatty ...
[ "def", "setup_logging", "(", "self", ")", ":", "date_format", "=", "'%Y-%m-%dT%H:%M:%S'", "log_format", "=", "'%(asctime)s %(levelname)s: %(message)s'", "if", "self", ".", "opts", ".", "verbose", ":", "lvl", "=", "logging", ".", "DEBUG", "else", ":", "lvl", "=",...
Setup python logging handler.
[ "Setup", "python", "logging", "handler", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L167-L207
train
youversion/crony
crony/crony.py
CommandCenter.setup_path
def setup_path(self): """Setup PATH env var if necessary.""" path = self.opts.path or self.config['crony'].get('path') if path: self.logger.debug(f'Adding {path} to PATH environment variable') self.cmd = f'export PATH={path}:$PATH && {self.cmd}'
python
def setup_path(self): """Setup PATH env var if necessary.""" path = self.opts.path or self.config['crony'].get('path') if path: self.logger.debug(f'Adding {path} to PATH environment variable') self.cmd = f'export PATH={path}:$PATH && {self.cmd}'
[ "def", "setup_path", "(", "self", ")", ":", "path", "=", "self", ".", "opts", ".", "path", "or", "self", ".", "config", "[", "'crony'", "]", ".", "get", "(", "'path'", ")", "if", "path", ":", "self", ".", "logger", ".", "debug", "(", "f'Adding {pat...
Setup PATH env var if necessary.
[ "Setup", "PATH", "env", "var", "if", "necessary", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L209-L214
train
youversion/crony
crony/crony.py
CommandCenter.setup_venv
def setup_venv(self): """Setup virtualenv if necessary.""" venv = self.opts.venv if not venv: venv = os.environ.get('CRONY_VENV') if not venv and self.config['crony']: venv = self.config['crony'].get('venv') if venv: if not venv.endswit...
python
def setup_venv(self): """Setup virtualenv if necessary.""" venv = self.opts.venv if not venv: venv = os.environ.get('CRONY_VENV') if not venv and self.config['crony']: venv = self.config['crony'].get('venv') if venv: if not venv.endswit...
[ "def", "setup_venv", "(", "self", ")", ":", "venv", "=", "self", ".", "opts", ".", "venv", "if", "not", "venv", ":", "venv", "=", "os", ".", "environ", ".", "get", "(", "'CRONY_VENV'", ")", "if", "not", "venv", "and", "self", ".", "config", "[", ...
Setup virtualenv if necessary.
[ "Setup", "virtualenv", "if", "necessary", "." ]
c93d14b809a2e878f1b9d6d53d5a04947896583b
https://github.com/youversion/crony/blob/c93d14b809a2e878f1b9d6d53d5a04947896583b/crony/crony.py#L216-L229
train
rsgalloway/grit
grit/repo/local.py
get_repos
def get_repos(path): """ Returns list of found branches. :return: List of grit.Local objects """ p = str(path) ret = [] if not os.path.exists(p): return ret for d in os.listdir(p): pd = os.path.join(p, d) if os.path.exists(pd) and is_repo(pd): ret.app...
python
def get_repos(path): """ Returns list of found branches. :return: List of grit.Local objects """ p = str(path) ret = [] if not os.path.exists(p): return ret for d in os.listdir(p): pd = os.path.join(p, d) if os.path.exists(pd) and is_repo(pd): ret.app...
[ "def", "get_repos", "(", "path", ")", ":", "p", "=", "str", "(", "path", ")", "ret", "=", "[", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "p", ")", ":", "return", "ret", "for", "d", "in", "os", ".", "listdir", "(", "p", ")", "...
Returns list of found branches. :return: List of grit.Local objects
[ "Returns", "list", "of", "found", "branches", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L32-L46
train
rsgalloway/grit
grit/repo/local.py
get_repo_parent
def get_repo_parent(path): """ Returns parent repo or input path if none found. :return: grit.Local or path """ # path is a repository if is_repo(path): return Local(path) # path is inside a repository elif not os.path.isdir(path): _rel = '' while path and path ...
python
def get_repo_parent(path): """ Returns parent repo or input path if none found. :return: grit.Local or path """ # path is a repository if is_repo(path): return Local(path) # path is inside a repository elif not os.path.isdir(path): _rel = '' while path and path ...
[ "def", "get_repo_parent", "(", "path", ")", ":", "if", "is_repo", "(", "path", ")", ":", "return", "Local", "(", "path", ")", "elif", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "_rel", "=", "''", "while", "path", "and", "path", ...
Returns parent repo or input path if none found. :return: grit.Local or path
[ "Returns", "parent", "repo", "or", "input", "path", "if", "none", "found", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L48-L67
train
rsgalloway/grit
grit/repo/local.py
Local.setVersion
def setVersion(self, version): """ Checkout a version of the repo. :param version: Version number. """ try: sha = self.versions(version).commit.sha self.git.reset("--hard", sha) except Exception, e: raise RepoError(e)
python
def setVersion(self, version): """ Checkout a version of the repo. :param version: Version number. """ try: sha = self.versions(version).commit.sha self.git.reset("--hard", sha) except Exception, e: raise RepoError(e)
[ "def", "setVersion", "(", "self", ",", "version", ")", ":", "try", ":", "sha", "=", "self", ".", "versions", "(", "version", ")", ".", "commit", ".", "sha", "self", ".", "git", ".", "reset", "(", "\"--hard\"", ",", "sha", ")", "except", "Exception", ...
Checkout a version of the repo. :param version: Version number.
[ "Checkout", "a", "version", "of", "the", "repo", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L159-L169
train
rsgalloway/grit
grit/repo/local.py
Local._commits
def _commits(self, head='HEAD'): """Returns a list of the commits reachable from head. :return: List of commit objects. the first of which will be the commit of head, then following theat will be the parents. :raise: RepoError if any no commits are referenced, including if the ...
python
def _commits(self, head='HEAD'): """Returns a list of the commits reachable from head. :return: List of commit objects. the first of which will be the commit of head, then following theat will be the parents. :raise: RepoError if any no commits are referenced, including if the ...
[ "def", "_commits", "(", "self", ",", "head", "=", "'HEAD'", ")", ":", "pending_commits", "=", "[", "head", "]", "history", "=", "[", "]", "while", "pending_commits", "!=", "[", "]", ":", "head", "=", "pending_commits", ".", "pop", "(", "0", ")", "try...
Returns a list of the commits reachable from head. :return: List of commit objects. the first of which will be the commit of head, then following theat will be the parents. :raise: RepoError if any no commits are referenced, including if the head parameter isn't the sha of a commit.
[ "Returns", "a", "list", "of", "the", "commits", "reachable", "from", "head", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L171-L199
train
rsgalloway/grit
grit/repo/local.py
Local.versions
def versions(self, version=None): """ List of Versions of this repository. :param version: Version index. :param rev: Commit sha or ref. :return: List of Version objects matching params. """ try: versions = [Version(self, c) for c in self._commits()]...
python
def versions(self, version=None): """ List of Versions of this repository. :param version: Version index. :param rev: Commit sha or ref. :return: List of Version objects matching params. """ try: versions = [Version(self, c) for c in self._commits()]...
[ "def", "versions", "(", "self", ",", "version", "=", "None", ")", ":", "try", ":", "versions", "=", "[", "Version", "(", "self", ",", "c", ")", "for", "c", "in", "self", ".", "_commits", "(", ")", "]", "except", "Exception", ",", "e", ":", "log",...
List of Versions of this repository. :param version: Version index. :param rev: Commit sha or ref. :return: List of Version objects matching params.
[ "List", "of", "Versions", "of", "this", "repository", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L201-L220
train
rsgalloway/grit
grit/repo/local.py
Local.setDescription
def setDescription(self, desc='No description'): """sets repository description""" try: self._put_named_file('description', desc) except Exception, e: raise RepoError(e)
python
def setDescription(self, desc='No description'): """sets repository description""" try: self._put_named_file('description', desc) except Exception, e: raise RepoError(e)
[ "def", "setDescription", "(", "self", ",", "desc", "=", "'No description'", ")", ":", "try", ":", "self", ".", "_put_named_file", "(", "'description'", ",", "desc", ")", "except", "Exception", ",", "e", ":", "raise", "RepoError", "(", "e", ")" ]
sets repository description
[ "sets", "repository", "description" ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L229-L234
train
rsgalloway/grit
grit/repo/local.py
Local.new
def new(self, path, desc=None, bare=True): """ Create a new bare repo.Local instance. :param path: Path to new repo. :param desc: Repo description. :param bare: Create as bare repo. :returns: New repo.Local instance. """ if os.path.exists(path): ...
python
def new(self, path, desc=None, bare=True): """ Create a new bare repo.Local instance. :param path: Path to new repo. :param desc: Repo description. :param bare: Create as bare repo. :returns: New repo.Local instance. """ if os.path.exists(path): ...
[ "def", "new", "(", "self", ",", "path", ",", "desc", "=", "None", ",", "bare", "=", "True", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "RepoError", "(", "'Path already exists: %s'", "%", "path", ")", "try", ":...
Create a new bare repo.Local instance. :param path: Path to new repo. :param desc: Repo description. :param bare: Create as bare repo. :returns: New repo.Local instance.
[ "Create", "a", "new", "bare", "repo", ".", "Local", "instance", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L246-L272
train
rsgalloway/grit
grit/repo/local.py
Local.branch
def branch(self, name, desc=None): """ Create a branch of this repo at 'name'. :param name: Name of new branch :param desc: Repo description. :return: New Local instance. """ return Local.new(path=os.path.join(self.path, name), desc=desc, bare=True)
python
def branch(self, name, desc=None): """ Create a branch of this repo at 'name'. :param name: Name of new branch :param desc: Repo description. :return: New Local instance. """ return Local.new(path=os.path.join(self.path, name), desc=desc, bare=True)
[ "def", "branch", "(", "self", ",", "name", ",", "desc", "=", "None", ")", ":", "return", "Local", ".", "new", "(", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "name", ")", ",", "desc", "=", "desc", ",", "bare", ...
Create a branch of this repo at 'name'. :param name: Name of new branch :param desc: Repo description. :return: New Local instance.
[ "Create", "a", "branch", "of", "this", "repo", "at", "name", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L274-L283
train
rsgalloway/grit
grit/repo/local.py
Local.addItem
def addItem(self, item, message=None): """add a new Item class object""" if message is None: message = 'Adding item %s' % item.path try: v = Version.new(repo=self) v.addItem(item) v.save(message) except VersionError, e: raise Re...
python
def addItem(self, item, message=None): """add a new Item class object""" if message is None: message = 'Adding item %s' % item.path try: v = Version.new(repo=self) v.addItem(item) v.save(message) except VersionError, e: raise Re...
[ "def", "addItem", "(", "self", ",", "item", ",", "message", "=", "None", ")", ":", "if", "message", "is", "None", ":", "message", "=", "'Adding item %s'", "%", "item", ".", "path", "try", ":", "v", "=", "Version", ".", "new", "(", "repo", "=", "sel...
add a new Item class object
[ "add", "a", "new", "Item", "class", "object" ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L290-L299
train
rsgalloway/grit
grit/repo/local.py
Local.items
def items(self, path=None, version=None): """ Returns a list of items. :param path: Regex filter on item path. :param version: Repo versions number/index. :return: List of Item class objects. """ if version is None: version = -1 items = {} ...
python
def items(self, path=None, version=None): """ Returns a list of items. :param path: Regex filter on item path. :param version: Repo versions number/index. :return: List of Item class objects. """ if version is None: version = -1 items = {} ...
[ "def", "items", "(", "self", ",", "path", "=", "None", ",", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "version", "=", "-", "1", "items", "=", "{", "}", "for", "item", "in", "self", ".", "versions", "(", "version", ")",...
Returns a list of items. :param path: Regex filter on item path. :param version: Repo versions number/index. :return: List of Item class objects.
[ "Returns", "a", "list", "of", "items", "." ]
e6434ad8a1f4ac5d0903ebad630c81f8a5164d78
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/local.py#L305-L334
train
BernardFW/bernard
src/bernard/platforms/telegram/_utils.py
set_reply_markup
async def set_reply_markup(msg: Dict, request: 'Request', stack: 'Stack') \ -> None: """ Add the "reply markup" to a message from the layers :param msg: Message dictionary :param request: Current request being replied :param stack: Stack to analyze """ from bernard.platforms.telegr...
python
async def set_reply_markup(msg: Dict, request: 'Request', stack: 'Stack') \ -> None: """ Add the "reply markup" to a message from the layers :param msg: Message dictionary :param request: Current request being replied :param stack: Stack to analyze """ from bernard.platforms.telegr...
[ "async", "def", "set_reply_markup", "(", "msg", ":", "Dict", ",", "request", ":", "'Request'", ",", "stack", ":", "'Stack'", ")", "->", "None", ":", "from", "bernard", ".", "platforms", ".", "telegram", ".", "layers", "import", "InlineKeyboard", ",", "Repl...
Add the "reply markup" to a message from the layers :param msg: Message dictionary :param request: Current request being replied :param stack: Stack to analyze
[ "Add", "the", "reply", "markup", "to", "a", "message", "from", "the", "layers" ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/telegram/_utils.py#L11-L42
train
BernardFW/bernard
src/bernard/i18n/utils.py
split_locale
def split_locale(locale: Text) -> Tuple[Text, Optional[Text]]: """ Decompose the locale into a normalized tuple. The first item is the locale (as lowercase letters) while the second item is either the country as lower case either None if no country was supplied. """ items = re.split(r'[_\-]', ...
python
def split_locale(locale: Text) -> Tuple[Text, Optional[Text]]: """ Decompose the locale into a normalized tuple. The first item is the locale (as lowercase letters) while the second item is either the country as lower case either None if no country was supplied. """ items = re.split(r'[_\-]', ...
[ "def", "split_locale", "(", "locale", ":", "Text", ")", "->", "Tuple", "[", "Text", ",", "Optional", "[", "Text", "]", "]", ":", "items", "=", "re", ".", "split", "(", "r'[_\\-]'", ",", "locale", ".", "lower", "(", ")", ",", "1", ")", "try", ":",...
Decompose the locale into a normalized tuple. The first item is the locale (as lowercase letters) while the second item is either the country as lower case either None if no country was supplied.
[ "Decompose", "the", "locale", "into", "a", "normalized", "tuple", "." ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/utils.py#L14-L27
train
BernardFW/bernard
src/bernard/i18n/utils.py
compare_locales
def compare_locales(a, b): """ Compares two locales to find the level of compatibility :param a: First locale :param b: Second locale :return: 2 full match, 1 lang match, 0 no match """ if a is None or b is None: if a == b: return 2 else: return 0 ...
python
def compare_locales(a, b): """ Compares two locales to find the level of compatibility :param a: First locale :param b: Second locale :return: 2 full match, 1 lang match, 0 no match """ if a is None or b is None: if a == b: return 2 else: return 0 ...
[ "def", "compare_locales", "(", "a", ",", "b", ")", ":", "if", "a", "is", "None", "or", "b", "is", "None", ":", "if", "a", "==", "b", ":", "return", "2", "else", ":", "return", "0", "a", "=", "split_locale", "(", "a", ")", "b", "=", "split_local...
Compares two locales to find the level of compatibility :param a: First locale :param b: Second locale :return: 2 full match, 1 lang match, 0 no match
[ "Compares", "two", "locales", "to", "find", "the", "level", "of", "compatibility" ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/utils.py#L30-L53
train
BernardFW/bernard
src/bernard/i18n/utils.py
LocalesDict.list_locales
def list_locales(self) -> List[Optional[Text]]: """ Returns the list of available locales. The first locale is the default locale to be used. If no locales are known, then `None` will be the first item. """ locales = list(self.dict.keys()) if not locales: ...
python
def list_locales(self) -> List[Optional[Text]]: """ Returns the list of available locales. The first locale is the default locale to be used. If no locales are known, then `None` will be the first item. """ locales = list(self.dict.keys()) if not locales: ...
[ "def", "list_locales", "(", "self", ")", "->", "List", "[", "Optional", "[", "Text", "]", "]", ":", "locales", "=", "list", "(", "self", ".", "dict", ".", "keys", "(", ")", ")", "if", "not", "locales", ":", "locales", ".", "append", "(", "None", ...
Returns the list of available locales. The first locale is the default locale to be used. If no locales are known, then `None` will be the first item.
[ "Returns", "the", "list", "of", "available", "locales", ".", "The", "first", "locale", "is", "the", "default", "locale", "to", "be", "used", ".", "If", "no", "locales", "are", "known", "then", "None", "will", "be", "the", "first", "item", "." ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/utils.py#L61-L73
train
BernardFW/bernard
src/bernard/i18n/utils.py
LocalesDict.choose_locale
def choose_locale(self, locale: Text) -> Text: """ Returns the best matching locale in what is available. :param locale: Locale to match :return: Locale to use """ if locale not in self._choice_cache: locales = self.list_locales() best_choice = ...
python
def choose_locale(self, locale: Text) -> Text: """ Returns the best matching locale in what is available. :param locale: Locale to match :return: Locale to use """ if locale not in self._choice_cache: locales = self.list_locales() best_choice = ...
[ "def", "choose_locale", "(", "self", ",", "locale", ":", "Text", ")", "->", "Text", ":", "if", "locale", "not", "in", "self", ".", "_choice_cache", ":", "locales", "=", "self", ".", "list_locales", "(", ")", "best_choice", "=", "locales", "[", "0", "]"...
Returns the best matching locale in what is available. :param locale: Locale to match :return: Locale to use
[ "Returns", "the", "best", "matching", "locale", "in", "what", "is", "available", "." ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/utils.py#L75-L98
train
BernardFW/bernard
src/bernard/i18n/utils.py
LocalesFlatDict.update
def update(self, new_data: Dict[Text, Dict[Text, Text]]): """ Receive an update from a loader. :param new_data: New translation data from the loader """ for locale, data in new_data.items(): if locale not in self.dict: self.dict[locale] = {} ...
python
def update(self, new_data: Dict[Text, Dict[Text, Text]]): """ Receive an update from a loader. :param new_data: New translation data from the loader """ for locale, data in new_data.items(): if locale not in self.dict: self.dict[locale] = {} ...
[ "def", "update", "(", "self", ",", "new_data", ":", "Dict", "[", "Text", ",", "Dict", "[", "Text", ",", "Text", "]", "]", ")", ":", "for", "locale", ",", "data", "in", "new_data", ".", "items", "(", ")", ":", "if", "locale", "not", "in", "self", ...
Receive an update from a loader. :param new_data: New translation data from the loader
[ "Receive", "an", "update", "from", "a", "loader", "." ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/i18n/utils.py#L109-L120
train
BernardFW/bernard
src/bernard/platforms/facebook/helpers.py
UrlButton._make_url
async def _make_url(self, url: Text, request: 'Request') -> Text: """ Signs the URL if needed """ if self.sign_webview: return await request.sign_url(url) return url
python
async def _make_url(self, url: Text, request: 'Request') -> Text: """ Signs the URL if needed """ if self.sign_webview: return await request.sign_url(url) return url
[ "async", "def", "_make_url", "(", "self", ",", "url", ":", "Text", ",", "request", ":", "'Request'", ")", "->", "Text", ":", "if", "self", ".", "sign_webview", ":", "return", "await", "request", ".", "sign_url", "(", "url", ")", "return", "url" ]
Signs the URL if needed
[ "Signs", "the", "URL", "if", "needed" ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/facebook/helpers.py#L125-L133
train
BernardFW/bernard
src/bernard/platforms/facebook/helpers.py
Card.is_sharable
def is_sharable(self): """ Make sure that nothing inside blocks sharing. """ if self.buttons: return (all(b.is_sharable() for b in self.buttons) and self.default_action and self.default_action.is_sharable())
python
def is_sharable(self): """ Make sure that nothing inside blocks sharing. """ if self.buttons: return (all(b.is_sharable() for b in self.buttons) and self.default_action and self.default_action.is_sharable())
[ "def", "is_sharable", "(", "self", ")", ":", "if", "self", ".", "buttons", ":", "return", "(", "all", "(", "b", ".", "is_sharable", "(", ")", "for", "b", "in", "self", ".", "buttons", ")", "and", "self", ".", "default_action", "and", "self", ".", "...
Make sure that nothing inside blocks sharing.
[ "Make", "sure", "that", "nothing", "inside", "blocks", "sharing", "." ]
9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/facebook/helpers.py#L306-L313
train
ioos/cc-plugin-ncei
cc_plugin_ncei/ncei_grid.py
NCEIGridBase.check_bounds_variables
def check_bounds_variables(self, dataset): ''' Checks the grid boundary variables. :param netCDF4.Dataset dataset: An open netCDF dataset ''' recommended_ctx = TestCtx(BaseCheck.MEDIUM, 'Recommended variables to describe grid boundaries') bounds_map = { 'lat...
python
def check_bounds_variables(self, dataset): ''' Checks the grid boundary variables. :param netCDF4.Dataset dataset: An open netCDF dataset ''' recommended_ctx = TestCtx(BaseCheck.MEDIUM, 'Recommended variables to describe grid boundaries') bounds_map = { 'lat...
[ "def", "check_bounds_variables", "(", "self", ",", "dataset", ")", ":", "recommended_ctx", "=", "TestCtx", "(", "BaseCheck", ".", "MEDIUM", ",", "'Recommended variables to describe grid boundaries'", ")", "bounds_map", "=", "{", "'lat_bounds'", ":", "{", "'units'", ...
Checks the grid boundary variables. :param netCDF4.Dataset dataset: An open netCDF dataset
[ "Checks", "the", "grid", "boundary", "variables", "." ]
963fefd7fa43afd32657ac4c36aad4ddb4c25acf
https://github.com/ioos/cc-plugin-ncei/blob/963fefd7fa43afd32657ac4c36aad4ddb4c25acf/cc_plugin_ncei/ncei_grid.py#L42-L93
train
walter426/Python_GoogleMapsApi
GoogleMapsApi/geocode.py
Geocoding.geocode
def geocode(self, string, bounds=None, region=None, language=None, sensor=False): '''Geocode an address. Pls refer to the Google Maps Web API for the details of the parameters ''' if isinstance(string, unicode): string = string.encode('utf-8') params ...
python
def geocode(self, string, bounds=None, region=None, language=None, sensor=False): '''Geocode an address. Pls refer to the Google Maps Web API for the details of the parameters ''' if isinstance(string, unicode): string = string.encode('utf-8') params ...
[ "def", "geocode", "(", "self", ",", "string", ",", "bounds", "=", "None", ",", "region", "=", "None", ",", "language", "=", "None", ",", "sensor", "=", "False", ")", ":", "if", "isinstance", "(", "string", ",", "unicode", ")", ":", "string", "=", "...
Geocode an address. Pls refer to the Google Maps Web API for the details of the parameters
[ "Geocode", "an", "address", ".", "Pls", "refer", "to", "the", "Google", "Maps", "Web", "API", "for", "the", "details", "of", "the", "parameters" ]
4832b293a0027446941a5f00ecc66256f92ddbce
https://github.com/walter426/Python_GoogleMapsApi/blob/4832b293a0027446941a5f00ecc66256f92ddbce/GoogleMapsApi/geocode.py#L34-L63
train
walter426/Python_GoogleMapsApi
GoogleMapsApi/geocode.py
Geocoding.reverse
def reverse(self, point, language=None, sensor=False): '''Reverse geocode a point. Pls refer to the Google Maps Web API for the details of the parameters ''' params = { 'latlng': point, 'sensor': str(sensor).lower() } if language: ...
python
def reverse(self, point, language=None, sensor=False): '''Reverse geocode a point. Pls refer to the Google Maps Web API for the details of the parameters ''' params = { 'latlng': point, 'sensor': str(sensor).lower() } if language: ...
[ "def", "reverse", "(", "self", ",", "point", ",", "language", "=", "None", ",", "sensor", "=", "False", ")", ":", "params", "=", "{", "'latlng'", ":", "point", ",", "'sensor'", ":", "str", "(", "sensor", ")", ".", "lower", "(", ")", "}", "if", "l...
Reverse geocode a point. Pls refer to the Google Maps Web API for the details of the parameters
[ "Reverse", "geocode", "a", "point", ".", "Pls", "refer", "to", "the", "Google", "Maps", "Web", "API", "for", "the", "details", "of", "the", "parameters" ]
4832b293a0027446941a5f00ecc66256f92ddbce
https://github.com/walter426/Python_GoogleMapsApi/blob/4832b293a0027446941a5f00ecc66256f92ddbce/GoogleMapsApi/geocode.py#L66-L83
train
walter426/Python_GoogleMapsApi
GoogleMapsApi/directions.py
Directions.GetDirections
def GetDirections(self, origin, destination, sensor = False, mode = None, waypoints = None, alternatives = None, avoid = None, language = None, units = None, region = None, departure_time = None, arrival_time = None): '''Get Directions Service Pls refer to the Google Maps Web ...
python
def GetDirections(self, origin, destination, sensor = False, mode = None, waypoints = None, alternatives = None, avoid = None, language = None, units = None, region = None, departure_time = None, arrival_time = None): '''Get Directions Service Pls refer to the Google Maps Web ...
[ "def", "GetDirections", "(", "self", ",", "origin", ",", "destination", ",", "sensor", "=", "False", ",", "mode", "=", "None", ",", "waypoints", "=", "None", ",", "alternatives", "=", "None", ",", "avoid", "=", "None", ",", "language", "=", "None", ","...
Get Directions Service Pls refer to the Google Maps Web API for the details of the remained parameters
[ "Get", "Directions", "Service", "Pls", "refer", "to", "the", "Google", "Maps", "Web", "API", "for", "the", "details", "of", "the", "remained", "parameters" ]
4832b293a0027446941a5f00ecc66256f92ddbce
https://github.com/walter426/Python_GoogleMapsApi/blob/4832b293a0027446941a5f00ecc66256f92ddbce/GoogleMapsApi/directions.py#L33-L79
train
sthysel/knobs
src/knobs.py
ListKnob.get
def get(self): """ convert json env variable if set to list """ self._cast = type([]) source_value = os.getenv(self.env_name) # set the environment if it is not set if source_value is None: os.environ[self.env_name] = json.dumps(self.default) ...
python
def get(self): """ convert json env variable if set to list """ self._cast = type([]) source_value = os.getenv(self.env_name) # set the environment if it is not set if source_value is None: os.environ[self.env_name] = json.dumps(self.default) ...
[ "def", "get", "(", "self", ")", ":", "self", ".", "_cast", "=", "type", "(", "[", "]", ")", "source_value", "=", "os", ".", "getenv", "(", "self", ".", "env_name", ")", "if", "source_value", "is", "None", ":", "os", ".", "environ", "[", "self", "...
convert json env variable if set to list
[ "convert", "json", "env", "variable", "if", "set", "to", "list" ]
1d01f50f643068076e38118a93fed9375ea3ac81
https://github.com/sthysel/knobs/blob/1d01f50f643068076e38118a93fed9375ea3ac81/src/knobs.py#L225-L250
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
parse_ppi_graph
def parse_ppi_graph(path: str, min_edge_weight: float = 0.0) -> Graph: """Build an undirected graph of gene interactions from edgelist file. :param str path: The path to the edgelist file :param float min_edge_weight: Cutoff to keep/remove the edges, default is 0, but could also be 0.63. :return Graph:...
python
def parse_ppi_graph(path: str, min_edge_weight: float = 0.0) -> Graph: """Build an undirected graph of gene interactions from edgelist file. :param str path: The path to the edgelist file :param float min_edge_weight: Cutoff to keep/remove the edges, default is 0, but could also be 0.63. :return Graph:...
[ "def", "parse_ppi_graph", "(", "path", ":", "str", ",", "min_edge_weight", ":", "float", "=", "0.0", ")", "->", "Graph", ":", "logger", ".", "info", "(", "\"In parse_ppi_graph()\"", ")", "graph", "=", "igraph", ".", "read", "(", "os", ".", "path", ".", ...
Build an undirected graph of gene interactions from edgelist file. :param str path: The path to the edgelist file :param float min_edge_weight: Cutoff to keep/remove the edges, default is 0, but could also be 0.63. :return Graph: Protein-protein interaction graph
[ "Build", "an", "undirected", "graph", "of", "gene", "interactions", "from", "edgelist", "file", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L19-L33
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
parse_excel
def parse_excel(file_path: str, entrez_id_header, log_fold_change_header, adjusted_p_value_header, entrez_delimiter, base_mean_header=None) -> List[Gene]: """Read an excel file on differential expression values as Gene objects. :pa...
python
def parse_excel(file_path: str, entrez_id_header, log_fold_change_header, adjusted_p_value_header, entrez_delimiter, base_mean_header=None) -> List[Gene]: """Read an excel file on differential expression values as Gene objects. :pa...
[ "def", "parse_excel", "(", "file_path", ":", "str", ",", "entrez_id_header", ",", "log_fold_change_header", ",", "adjusted_p_value_header", ",", "entrez_delimiter", ",", "base_mean_header", "=", "None", ")", "->", "List", "[", "Gene", "]", ":", "logger", ".", "i...
Read an excel file on differential expression values as Gene objects. :param str file_path: The path to the differential expression file to be parsed. :param config.Params params: An object that includes paths, cutoffs and other information. :return list: A list of Gene objects.
[ "Read", "an", "excel", "file", "on", "differential", "expression", "values", "as", "Gene", "objects", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L36-L59
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
parse_csv
def parse_csv(file_path: str, entrez_id_header, log_fold_change_header, adjusted_p_value_header, entrez_delimiter, base_mean_header=None, sep=",") -> List[Gene]: """Read a csv file on differential expression values as Gene objects. ...
python
def parse_csv(file_path: str, entrez_id_header, log_fold_change_header, adjusted_p_value_header, entrez_delimiter, base_mean_header=None, sep=",") -> List[Gene]: """Read a csv file on differential expression values as Gene objects. ...
[ "def", "parse_csv", "(", "file_path", ":", "str", ",", "entrez_id_header", ",", "log_fold_change_header", ",", "adjusted_p_value_header", ",", "entrez_delimiter", ",", "base_mean_header", "=", "None", ",", "sep", "=", "\",\"", ")", "->", "List", "[", "Gene", "]"...
Read a csv file on differential expression values as Gene objects. :param str file_path: The path to the differential expression file to be parsed. :param config.Params params: An object that includes paths, cutoffs and other information. :return list: A list of Gene objects.
[ "Read", "a", "csv", "file", "on", "differential", "expression", "values", "as", "Gene", "objects", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L62-L86
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
handle_dataframe
def handle_dataframe( df: pd.DataFrame, entrez_id_name, log2_fold_change_name, adjusted_p_value_name, entrez_delimiter, base_mean=None, ) -> List[Gene]: """Convert data frame on differential expression values as Gene objects. :param df: Data frame with columns sh...
python
def handle_dataframe( df: pd.DataFrame, entrez_id_name, log2_fold_change_name, adjusted_p_value_name, entrez_delimiter, base_mean=None, ) -> List[Gene]: """Convert data frame on differential expression values as Gene objects. :param df: Data frame with columns sh...
[ "def", "handle_dataframe", "(", "df", ":", "pd", ".", "DataFrame", ",", "entrez_id_name", ",", "log2_fold_change_name", ",", "adjusted_p_value_name", ",", "entrez_delimiter", ",", "base_mean", "=", "None", ",", ")", "->", "List", "[", "Gene", "]", ":", "logger...
Convert data frame on differential expression values as Gene objects. :param df: Data frame with columns showing values on differential expression. :param cfp: An object that includes paths, cutoffs and other information. :return list: A list of Gene objects.
[ "Convert", "data", "frame", "on", "differential", "expression", "values", "as", "Gene", "objects", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L89-L129
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
parse_gene_list
def parse_gene_list(path: str, graph: Graph, anno_type: str = "name") -> list: """Parse a list of genes and return them if they are in the network. :param str path: The path of input file. :param Graph graph: The graph with genes as nodes. :param str anno_type: The type of annotation with two options:n...
python
def parse_gene_list(path: str, graph: Graph, anno_type: str = "name") -> list: """Parse a list of genes and return them if they are in the network. :param str path: The path of input file. :param Graph graph: The graph with genes as nodes. :param str anno_type: The type of annotation with two options:n...
[ "def", "parse_gene_list", "(", "path", ":", "str", ",", "graph", ":", "Graph", ",", "anno_type", ":", "str", "=", "\"name\"", ")", "->", "list", ":", "genes", "=", "pd", ".", "read_csv", "(", "path", ",", "header", "=", "None", ")", "[", "0", "]", ...
Parse a list of genes and return them if they are in the network. :param str path: The path of input file. :param Graph graph: The graph with genes as nodes. :param str anno_type: The type of annotation with two options:name-Entrez ID, symbol-HGNC symbol. :return list: A list of genes, all of which are...
[ "Parse", "a", "list", "of", "genes", "and", "return", "them", "if", "they", "are", "in", "the", "network", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L132-L155
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
parse_disease_ids
def parse_disease_ids(path: str): """Parse the disease identifier file. :param str path: Path to the disease identifier file. :return: List of disease identifiers. """ if os.path.isdir(path) or not os.path.exists(path): logger.info("Couldn't find the disease identifiers file. Returning empt...
python
def parse_disease_ids(path: str): """Parse the disease identifier file. :param str path: Path to the disease identifier file. :return: List of disease identifiers. """ if os.path.isdir(path) or not os.path.exists(path): logger.info("Couldn't find the disease identifiers file. Returning empt...
[ "def", "parse_disease_ids", "(", "path", ":", "str", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", "or", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "logger", ".", "info", "(", "\"Couldn't find the disease ident...
Parse the disease identifier file. :param str path: Path to the disease identifier file. :return: List of disease identifiers.
[ "Parse", "the", "disease", "identifier", "file", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L158-L169
train
GuiltyTargets/ppi-network-annotation
src/ppi_network_annotation/parsers.py
parse_disease_associations
def parse_disease_associations(path: str, excluded_disease_ids: set): """Parse the disease-drug target associations file. :param str path: Path to the disease-drug target associations file. :param list excluded_disease_ids: Identifiers of the disease for which drug targets are being predicted. :return:...
python
def parse_disease_associations(path: str, excluded_disease_ids: set): """Parse the disease-drug target associations file. :param str path: Path to the disease-drug target associations file. :param list excluded_disease_ids: Identifiers of the disease for which drug targets are being predicted. :return:...
[ "def", "parse_disease_associations", "(", "path", ":", "str", ",", "excluded_disease_ids", ":", "set", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", "or", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "logger", ...
Parse the disease-drug target associations file. :param str path: Path to the disease-drug target associations file. :param list excluded_disease_ids: Identifiers of the disease for which drug targets are being predicted. :return: Dictionary of drug target-disease mappings.
[ "Parse", "the", "disease", "-", "drug", "target", "associations", "file", "." ]
4d7b6713485f2d0a0957e6457edc1b1b5a237460
https://github.com/GuiltyTargets/ppi-network-annotation/blob/4d7b6713485f2d0a0957e6457edc1b1b5a237460/src/ppi_network_annotation/parsers.py#L172-L189
train