repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
flo-compbio/goparser
goparser/parser.py
GOParser.clear_annotation_data
def clear_annotation_data(self): """Clear annotation data. Parameters ---------- Returns ------- None """ self.genes = set() self.annotations = [] self.term_annotations = {} self.gene_annotations = {}
python
def clear_annotation_data(self): """Clear annotation data. Parameters ---------- Returns ------- None """ self.genes = set() self.annotations = [] self.term_annotations = {} self.gene_annotations = {}
[ "def", "clear_annotation_data", "(", "self", ")", ":", "self", ".", "genes", "=", "set", "(", ")", "self", ".", "annotations", "=", "[", "]", "self", ".", "term_annotations", "=", "{", "}", "self", ".", "gene_annotations", "=", "{", "}" ]
Clear annotation data. Parameters ---------- Returns ------- None
[ "Clear", "annotation", "data", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L305-L318
flo-compbio/goparser
goparser/parser.py
GOParser.parse_ontology
def parse_ontology(self, fn, flatten=True, part_of_cc_only=False): """ Parse an OBO file and store GO term information. This function needs to be called before `parse_annotations`, in order to read in the Gene Ontology terms and structure. Parameters ---------- fn: str ...
python
def parse_ontology(self, fn, flatten=True, part_of_cc_only=False): """ Parse an OBO file and store GO term information. This function needs to be called before `parse_annotations`, in order to read in the Gene Ontology terms and structure. Parameters ---------- fn: str ...
[ "def", "parse_ontology", "(", "self", ",", "fn", ",", "flatten", "=", "True", ",", "part_of_cc_only", "=", "False", ")", ":", "self", ".", "clear_data", "(", ")", "# clear all old data", "with", "open", "(", "fn", ")", "as", "fh", ":", "n", "=", "0", ...
Parse an OBO file and store GO term information. This function needs to be called before `parse_annotations`, in order to read in the Gene Ontology terms and structure. Parameters ---------- fn: str Path of the OBO file. flatten: bool, optional I...
[ "Parse", "an", "OBO", "file", "and", "store", "GO", "term", "information", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L320-L403
flo-compbio/goparser
goparser/parser.py
GOParser._flatten_ancestors
def _flatten_ancestors(self, include_part_of=True): """Determines and stores all ancestors of each GO term. Parameters ---------- include_part_of: bool, optional Whether to include ``part_of`` relations in determining ancestors. Returns ------- ...
python
def _flatten_ancestors(self, include_part_of=True): """Determines and stores all ancestors of each GO term. Parameters ---------- include_part_of: bool, optional Whether to include ``part_of`` relations in determining ancestors. Returns ------- ...
[ "def", "_flatten_ancestors", "(", "self", ",", "include_part_of", "=", "True", ")", ":", "def", "get_all_ancestors", "(", "term", ")", ":", "ancestors", "=", "set", "(", ")", "for", "id_", "in", "term", ".", "is_a", ":", "ancestors", ".", "add", "(", "...
Determines and stores all ancestors of each GO term. Parameters ---------- include_part_of: bool, optional Whether to include ``part_of`` relations in determining ancestors. Returns ------- None
[ "Determines", "and", "stores", "all", "ancestors", "of", "each", "GO", "term", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L405-L431
flo-compbio/goparser
goparser/parser.py
GOParser.parse_annotations
def parse_annotations( self, annotation_file, genes, db_sel='UniProtKB', select_evidence=None, exclude_evidence=None, exclude_ref=None, strip_species=False, ignore_case=False): """Parse a GO annotation file (in GAF 2.0 format). GO annotation files can be downloaded f...
python
def parse_annotations( self, annotation_file, genes, db_sel='UniProtKB', select_evidence=None, exclude_evidence=None, exclude_ref=None, strip_species=False, ignore_case=False): """Parse a GO annotation file (in GAF 2.0 format). GO annotation files can be downloaded f...
[ "def", "parse_annotations", "(", "self", ",", "annotation_file", ",", "genes", ",", "db_sel", "=", "'UniProtKB'", ",", "select_evidence", "=", "None", ",", "exclude_evidence", "=", "None", ",", "exclude_ref", "=", "None", ",", "strip_species", "=", "False", ",...
Parse a GO annotation file (in GAF 2.0 format). GO annotation files can be downloaded from the `UniProt-GOA download site`__ or from their `FTP server`__. __ goa_download_ __ goa_ftp_ .. _goa_download: http://www.ebi.ac.uk/GOA/downloads .. _goa_ftp: ftp://ftp.ebi.ac.uk...
[ "Parse", "a", "GO", "annotation", "file", "(", "in", "GAF", "2", ".", "0", "format", ")", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L461-L664
flo-compbio/goparser
goparser/parser.py
GOParser.get_gene_goterms
def get_gene_goterms(self, gene, ancestors=False): """Return all GO terms a particular gene is annotated with. Parameters ---------- gene: str The gene symbol of the gene. ancestors: bool, optional If set to True, also return all ancestor GO terms. ...
python
def get_gene_goterms(self, gene, ancestors=False): """Return all GO terms a particular gene is annotated with. Parameters ---------- gene: str The gene symbol of the gene. ancestors: bool, optional If set to True, also return all ancestor GO terms. ...
[ "def", "get_gene_goterms", "(", "self", ",", "gene", ",", "ancestors", "=", "False", ")", ":", "annotations", "=", "self", ".", "gene_annotations", "[", "gene", "]", "terms", "=", "set", "(", "ann", ".", "term", "for", "ann", "in", "annotations", ")", ...
Return all GO terms a particular gene is annotated with. Parameters ---------- gene: str The gene symbol of the gene. ancestors: bool, optional If set to True, also return all ancestor GO terms. Returns ------- set of GOTerm objects ...
[ "Return", "all", "GO", "terms", "a", "particular", "gene", "is", "annotated", "with", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L666-L697
flo-compbio/goparser
goparser/parser.py
GOParser.get_goterm_genes
def get_goterm_genes(self, id_, descendants=True): """Return all genes that are annotated with a particular GO term. Parameters ---------- id_: str GO term ID of the GO term. descendants: bool, optional If set to False, only return genes that are directly...
python
def get_goterm_genes(self, id_, descendants=True): """Return all genes that are annotated with a particular GO term. Parameters ---------- id_: str GO term ID of the GO term. descendants: bool, optional If set to False, only return genes that are directly...
[ "def", "get_goterm_genes", "(", "self", ",", "id_", ",", "descendants", "=", "True", ")", ":", "# determine which terms to include", "main_term", "=", "self", ".", "terms", "[", "id_", "]", "check_terms", "=", "{", "main_term", ",", "}", "if", "descendants", ...
Return all genes that are annotated with a particular GO term. Parameters ---------- id_: str GO term ID of the GO term. descendants: bool, optional If set to False, only return genes that are directly annotated with the specified GO term. By default,...
[ "Return", "all", "genes", "that", "are", "annotated", "with", "a", "particular", "GO", "term", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L699-L730
flo-compbio/goparser
goparser/parser.py
GOParser.get_gene_sets
def get_gene_sets(self, min_genes=None, max_genes=None): """Return the set of annotated genes for each GO term. Parameters ---------- min_genes: int, optional Exclude GO terms with fewer than this number of genes. max_genes: int, optional Exclude GO terms...
python
def get_gene_sets(self, min_genes=None, max_genes=None): """Return the set of annotated genes for each GO term. Parameters ---------- min_genes: int, optional Exclude GO terms with fewer than this number of genes. max_genes: int, optional Exclude GO terms...
[ "def", "get_gene_sets", "(", "self", ",", "min_genes", "=", "None", ",", "max_genes", "=", "None", ")", ":", "if", "not", "self", ".", "terms", ":", "raise", "ValueError", "(", "'You need to first parse both an OBO file and '", "'a gene association file!'", ")", "...
Return the set of annotated genes for each GO term. Parameters ---------- min_genes: int, optional Exclude GO terms with fewer than this number of genes. max_genes: int, optional Exclude GO terms with more than this number of genes. Returns -----...
[ "Return", "the", "set", "of", "annotated", "genes", "for", "each", "GO", "term", "." ]
train
https://github.com/flo-compbio/goparser/blob/5e27d7d04a26a70a1d9dc113357041abff72be3f/goparser/parser.py#L732-L826
openmeteo/pd2hts
pd2hts/__init__.py
_ReadFile.read_meta
def read_meta(self, f): """Read the headers of a file in file format and place them in the self.meta dictionary. """ if not isinstance(f, BacktrackableFile): f = BacktrackableFile(f) try: (name, value) = self.read_meta_line(f) while name: ...
python
def read_meta(self, f): """Read the headers of a file in file format and place them in the self.meta dictionary. """ if not isinstance(f, BacktrackableFile): f = BacktrackableFile(f) try: (name, value) = self.read_meta_line(f) while name: ...
[ "def", "read_meta", "(", "self", ",", "f", ")", ":", "if", "not", "isinstance", "(", "f", ",", "BacktrackableFile", ")", ":", "f", "=", "BacktrackableFile", "(", "f", ")", "try", ":", "(", "name", ",", "value", ")", "=", "self", ".", "read_meta_line"...
Read the headers of a file in file format and place them in the self.meta dictionary.
[ "Read", "the", "headers", "of", "a", "file", "in", "file", "format", "and", "place", "them", "in", "the", "self", ".", "meta", "dictionary", "." ]
train
https://github.com/openmeteo/pd2hts/blob/b8f982046e2b99680445298b63a488dd76f6e104/pd2hts/__init__.py#L161-L183
openmeteo/pd2hts
pd2hts/__init__.py
_ReadFile.read_minutes_months
def read_minutes_months(self, s): """Return a (minutes, months) tuple after parsing a "M,N" string. """ try: (minutes, months) = [int(x.strip()) for x in s.split(',')] return minutes, months except Exception: raise ParsingError(('Value should be "minut...
python
def read_minutes_months(self, s): """Return a (minutes, months) tuple after parsing a "M,N" string. """ try: (minutes, months) = [int(x.strip()) for x in s.split(',')] return minutes, months except Exception: raise ParsingError(('Value should be "minut...
[ "def", "read_minutes_months", "(", "self", ",", "s", ")", ":", "try", ":", "(", "minutes", ",", "months", ")", "=", "[", "int", "(", "x", ".", "strip", "(", ")", ")", "for", "x", "in", "s", ".", "split", "(", "','", ")", "]", "return", "minutes...
Return a (minutes, months) tuple after parsing a "M,N" string.
[ "Return", "a", "(", "minutes", "months", ")", "tuple", "after", "parsing", "a", "M", "N", "string", "." ]
train
https://github.com/openmeteo/pd2hts/blob/b8f982046e2b99680445298b63a488dd76f6e104/pd2hts/__init__.py#L238-L245
openmeteo/pd2hts
pd2hts/__init__.py
_ReadFile.read_meta_line
def read_meta_line(self, f): """Read one line from a file format header and return a (name, value) tuple, where name is lowercased. Returns ('', '') if the next line is blank. Raises ParsingError if next line in f is not a valid header line.""" line = f.readline() if isin...
python
def read_meta_line(self, f): """Read one line from a file format header and return a (name, value) tuple, where name is lowercased. Returns ('', '') if the next line is blank. Raises ParsingError if next line in f is not a valid header line.""" line = f.readline() if isin...
[ "def", "read_meta_line", "(", "self", ",", "f", ")", ":", "line", "=", "f", ".", "readline", "(", ")", "if", "isinstance", "(", "line", ",", "bytes", ")", ":", "line", "=", "line", ".", "decode", "(", "'utf-8-sig'", ")", "name", ",", "value", "=", ...
Read one line from a file format header and return a (name, value) tuple, where name is lowercased. Returns ('', '') if the next line is blank. Raises ParsingError if next line in f is not a valid header line.
[ "Read", "one", "line", "from", "a", "file", "format", "header", "and", "return", "a", "(", "name", "value", ")", "tuple", "where", "name", "is", "lowercased", ".", "Returns", "(", ")", "if", "the", "next", "line", "is", "blank", ".", "Raises", "Parsing...
train
https://github.com/openmeteo/pd2hts/blob/b8f982046e2b99680445298b63a488dd76f6e104/pd2hts/__init__.py#L247-L265
majerteam/sqla_inspect
sqla_inspect/export.py
format_value
def format_value(column_dict, value, key=None): """ Format a value coming from the database (for example converts datetimes to strings) :param column_dict: The column datas collected during inspection :param value: A value coming from the database :param key: The exportation key """ for...
python
def format_value(column_dict, value, key=None): """ Format a value coming from the database (for example converts datetimes to strings) :param column_dict: The column datas collected during inspection :param value: A value coming from the database :param key: The exportation key """ for...
[ "def", "format_value", "(", "column_dict", ",", "value", ",", "key", "=", "None", ")", ":", "formatter", "=", "column_dict", ".", "get", "(", "'formatter'", ")", "prop", "=", "column_dict", "[", "'__col__'", "]", "res", "=", "value", "if", "value", "in",...
Format a value coming from the database (for example converts datetimes to strings) :param column_dict: The column datas collected during inspection :param value: A value coming from the database :param key: The exportation key
[ "Format", "a", "value", "coming", "from", "the", "database", "(", "for", "example", "converts", "datetimes", "to", "strings", ")" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L88-L116
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._is_excluded
def _is_excluded(self, prop, info_dict): """ Check if the given prop should be excluded from the export """ if prop.key in BLACKLISTED_KEYS: return True if info_dict.get('exclude', False): return True if prop.key in self.excludes: ret...
python
def _is_excluded(self, prop, info_dict): """ Check if the given prop should be excluded from the export """ if prop.key in BLACKLISTED_KEYS: return True if info_dict.get('exclude', False): return True if prop.key in self.excludes: ret...
[ "def", "_is_excluded", "(", "self", ",", "prop", ",", "info_dict", ")", ":", "if", "prop", ".", "key", "in", "BLACKLISTED_KEYS", ":", "return", "True", "if", "info_dict", ".", "get", "(", "'exclude'", ",", "False", ")", ":", "return", "True", "if", "pr...
Check if the given prop should be excluded from the export
[ "Check", "if", "the", "given", "prop", "should", "be", "excluded", "from", "the", "export" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L149-L165
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._get_title
def _get_title(self, prop, main_infos, info_dict): """ Return the title configured as in colanderalchemy """ result = main_infos.get('label') if result is None: result = info_dict.get('colanderalchemy', {}).get('title') if result is None: result = ...
python
def _get_title(self, prop, main_infos, info_dict): """ Return the title configured as in colanderalchemy """ result = main_infos.get('label') if result is None: result = info_dict.get('colanderalchemy', {}).get('title') if result is None: result = ...
[ "def", "_get_title", "(", "self", ",", "prop", ",", "main_infos", ",", "info_dict", ")", ":", "result", "=", "main_infos", ".", "get", "(", "'label'", ")", "if", "result", "is", "None", ":", "result", "=", "info_dict", ".", "get", "(", "'colanderalchemy'...
Return the title configured as in colanderalchemy
[ "Return", "the", "title", "configured", "as", "in", "colanderalchemy" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L167-L176
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._get_prop_infos
def _get_prop_infos(self, prop): """ Return the infos configured for this specific prop, merging the different configuration level """ info_dict = self.get_info_field(prop) main_infos = info_dict.get('export', {}).copy() infos = main_infos.get(self.config_key, {})...
python
def _get_prop_infos(self, prop): """ Return the infos configured for this specific prop, merging the different configuration level """ info_dict = self.get_info_field(prop) main_infos = info_dict.get('export', {}).copy() infos = main_infos.get(self.config_key, {})...
[ "def", "_get_prop_infos", "(", "self", ",", "prop", ")", ":", "info_dict", "=", "self", ".", "get_info_field", "(", "prop", ")", "main_infos", "=", "info_dict", ".", "get", "(", "'export'", ",", "{", "}", ")", ".", "copy", "(", ")", "infos", "=", "ma...
Return the infos configured for this specific prop, merging the different configuration level
[ "Return", "the", "infos", "configured", "for", "this", "specific", "prop", "merging", "the", "different", "configuration", "level" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L178-L191
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._collect_headers
def _collect_headers(self): """ Collect headers from the models attribute info col """ res = [] for prop in self.get_sorted_columns(): main_infos = self._get_prop_infos(prop) if self._is_excluded(prop, main_infos): continue ...
python
def _collect_headers(self): """ Collect headers from the models attribute info col """ res = [] for prop in self.get_sorted_columns(): main_infos = self._get_prop_infos(prop) if self._is_excluded(prop, main_infos): continue ...
[ "def", "_collect_headers", "(", "self", ")", ":", "res", "=", "[", "]", "for", "prop", "in", "self", ".", "get_sorted_columns", "(", ")", ":", "main_infos", "=", "self", ".", "_get_prop_infos", "(", "prop", ")", "if", "self", ".", "_is_excluded", "(", ...
Collect headers from the models attribute info col
[ "Collect", "headers", "from", "the", "models", "attribute", "info", "col" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L193-L226
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._collect_relationship
def _collect_relationship(self, main_infos, prop, result): """ collect a relationship header: * One To many : if {'export': {'reletad_key': 'remote_attr'}} is provided, we take all the related objects and join their remote attr's value with commas If an index...
python
def _collect_relationship(self, main_infos, prop, result): """ collect a relationship header: * One To many : if {'export': {'reletad_key': 'remote_attr'}} is provided, we take all the related objects and join their remote attr's value with commas If an index...
[ "def", "_collect_relationship", "(", "self", ",", "main_infos", ",", "prop", ",", "result", ")", ":", "# No handling of the uselist relationships for the moment", "# Maybe with indexes ? ( to see: on row add, append headers on the fly", "# if needed )", "if", "prop", ".", "uselis...
collect a relationship header: * One To many : if {'export': {'reletad_key': 'remote_attr'}} is provided, we take all the related objects and join their remote attr's value with commas If an index is provided, only the related element of index 'index' is retrieve...
[ "collect", "a", "relationship", "header", ":" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L228-L281
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._merge_many_to_one_field
def _merge_many_to_one_field(self, main_infos, prop, result): """ * Find the foreignkey associated to the current relationship * Get its title * Remove this fkey field from the export :param dict main_infos: The datas collected about the relationship :param obj prop: The...
python
def _merge_many_to_one_field(self, main_infos, prop, result): """ * Find the foreignkey associated to the current relationship * Get its title * Remove this fkey field from the export :param dict main_infos: The datas collected about the relationship :param obj prop: The...
[ "def", "_merge_many_to_one_field", "(", "self", ",", "main_infos", ",", "prop", ",", "result", ")", ":", "title", "=", "None", "# We first find the related foreignkey to get the good title", "rel_base", "=", "list", "(", "prop", ".", "local_columns", ")", "[", "0", ...
* Find the foreignkey associated to the current relationship * Get its title * Remove this fkey field from the export :param dict main_infos: The datas collected about the relationship :param obj prop: The property mapper of the relationship :param list result: The actual collec...
[ "*", "Find", "the", "foreignkey", "associated", "to", "the", "current", "relationship", "*", "Get", "its", "title", "*", "Remove", "this", "fkey", "field", "from", "the", "export" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L283-L306
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._merge_many_to_one_field_from_fkey
def _merge_many_to_one_field_from_fkey(self, main_infos, prop, result): """ Find the relationship associated with this fkey and set the title :param dict main_infos: The already collected datas about this column :param obj prop: The property mapper of the relationship :param lis...
python
def _merge_many_to_one_field_from_fkey(self, main_infos, prop, result): """ Find the relationship associated with this fkey and set the title :param dict main_infos: The already collected datas about this column :param obj prop: The property mapper of the relationship :param lis...
[ "def", "_merge_many_to_one_field_from_fkey", "(", "self", ",", "main_infos", ",", "prop", ",", "result", ")", ":", "if", "prop", ".", "columns", "[", "0", "]", ".", "foreign_keys", "and", "prop", ".", "key", ".", "endswith", "(", "'_id'", ")", ":", "# We...
Find the relationship associated with this fkey and set the title :param dict main_infos: The already collected datas about this column :param obj prop: The property mapper of the relationship :param list result: The actual collected headers :returns: a main_infos dict or None
[ "Find", "the", "relationship", "associated", "with", "this", "fkey", "and", "set", "the", "title" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L308-L326
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter.add_row
def add_row(self, obj): """ fill a new row with the given obj obj instance of the exporter's model """ row = {} for column in self.headers: value = '' if '__col__' in column: if isinstance(column['__col__'], C...
python
def add_row(self, obj): """ fill a new row with the given obj obj instance of the exporter's model """ row = {} for column in self.headers: value = '' if '__col__' in column: if isinstance(column['__col__'], C...
[ "def", "add_row", "(", "self", ",", "obj", ")", ":", "row", "=", "{", "}", "for", "column", "in", "self", ".", "headers", ":", "value", "=", "''", "if", "'__col__'", "in", "column", ":", "if", "isinstance", "(", "column", "[", "'__col__'", "]", ","...
fill a new row with the given obj obj instance of the exporter's model
[ "fill", "a", "new", "row", "with", "the", "given", "obj" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L328-L350
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._get_formatted_val
def _get_formatted_val(self, obj, name, column): """ Format the value of the attribute 'name' from the given object """ attr_path = name.split('.') val = None tmp_val = obj for attr in attr_path: tmp_val = getattr(tmp_val, attr, None) if tm...
python
def _get_formatted_val(self, obj, name, column): """ Format the value of the attribute 'name' from the given object """ attr_path = name.split('.') val = None tmp_val = obj for attr in attr_path: tmp_val = getattr(tmp_val, attr, None) if tm...
[ "def", "_get_formatted_val", "(", "self", ",", "obj", ",", "name", ",", "column", ")", ":", "attr_path", "=", "name", ".", "split", "(", "'.'", ")", "val", "=", "None", "tmp_val", "=", "obj", "for", "attr", "in", "attr_path", ":", "tmp_val", "=", "ge...
Format the value of the attribute 'name' from the given object
[ "Format", "the", "value", "of", "the", "attribute", "name", "from", "the", "given", "object" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L352-L366
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._get_relationship_cell_val
def _get_relationship_cell_val(self, obj, column): """ Return the value to insert in a relationship cell """ val = "" key = column['key'] related_key = column.get('related_key', None) related_obj = getattr(obj, key, None) if related_obj is None: ...
python
def _get_relationship_cell_val(self, obj, column): """ Return the value to insert in a relationship cell """ val = "" key = column['key'] related_key = column.get('related_key', None) related_obj = getattr(obj, key, None) if related_obj is None: ...
[ "def", "_get_relationship_cell_val", "(", "self", ",", "obj", ",", "column", ")", ":", "val", "=", "\"\"", "key", "=", "column", "[", "'key'", "]", "related_key", "=", "column", ".", "get", "(", "'related_key'", ",", "None", ")", "related_obj", "=", "get...
Return the value to insert in a relationship cell
[ "Return", "the", "value", "to", "insert", "in", "a", "relationship", "cell" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L368-L409
majerteam/sqla_inspect
sqla_inspect/export.py
SqlaExporter._get_column_cell_val
def _get_column_cell_val(self, obj, column): """ Return a value of a "column" cell """ name = column['name'] return self._get_formatted_val(obj, name, column)
python
def _get_column_cell_val(self, obj, column): """ Return a value of a "column" cell """ name = column['name'] return self._get_formatted_val(obj, name, column)
[ "def", "_get_column_cell_val", "(", "self", ",", "obj", ",", "column", ")", ":", "name", "=", "column", "[", "'name'", "]", "return", "self", ".", "_get_formatted_val", "(", "obj", ",", "name", ",", "column", ")" ]
Return a value of a "column" cell
[ "Return", "a", "value", "of", "a", "column", "cell" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L411-L416
thespacedoctor/tastic
tastic/workspace/workspace.py
workspace.sort
def sort(self): """ *sort the workspace or individual taskpaper document via the workflow tags found in the settings file* **Usage:** To sort all of the taskpaper documents in the workspace via the workflow tag set with the settings file, for example: .. code-block:: y...
python
def sort(self): """ *sort the workspace or individual taskpaper document via the workflow tags found in the settings file* **Usage:** To sort all of the taskpaper documents in the workspace via the workflow tag set with the settings file, for example: .. code-block:: y...
[ "def", "sort", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``sort`` method'", ")", "for", "f", "in", "self", ".", "taskpaperFiles", ":", "self", ".", "_sort_tp_file", "(", "f", ")", "self", ".", "log", ".", "info", "(", ...
*sort the workspace or individual taskpaper document via the workflow tags found in the settings file* **Usage:** To sort all of the taskpaper documents in the workspace via the workflow tag set with the settings file, for example: .. code-block:: yaml workflowTags: "...
[ "*", "sort", "the", "workspace", "or", "individual", "taskpaper", "document", "via", "the", "workflow", "tags", "found", "in", "the", "settings", "file", "*" ]
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/workspace/workspace.py#L86-L110
thespacedoctor/tastic
tastic/workspace/workspace.py
workspace.archive_done
def archive_done( self): """*move done tasks from the document's 'Archive' project into an adjacent markdown tasklog file* **Usage:** To move the archived tasks within a workspace's taskpaper docs into ``-tasklog.md`` files use the ``archive_done()`` method: .. cod...
python
def archive_done( self): """*move done tasks from the document's 'Archive' project into an adjacent markdown tasklog file* **Usage:** To move the archived tasks within a workspace's taskpaper docs into ``-tasklog.md`` files use the ``archive_done()`` method: .. cod...
[ "def", "archive_done", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``archive_done`` method'", ")", "for", "f", "in", "self", ".", "taskpaperFiles", ":", "self", ".", "_archive_tp_file_done_tasks", "(", "f", ")", "self", ".", "...
*move done tasks from the document's 'Archive' project into an adjacent markdown tasklog file* **Usage:** To move the archived tasks within a workspace's taskpaper docs into ``-tasklog.md`` files use the ``archive_done()`` method: .. code-block:: python ws.archive_do...
[ "*", "move", "done", "tasks", "from", "the", "document", "s", "Archive", "project", "into", "an", "adjacent", "markdown", "tasklog", "file", "*" ]
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/workspace/workspace.py#L112-L130
thespacedoctor/tastic
tastic/workspace/workspace.py
workspace._get_all_taskpaper_files
def _get_all_taskpaper_files( self): """*get a list of all the taskpaper filepaths in the workspace* **Return:** - ``taskpaperFiles`` -- a list of paths to all the taskpaper files within the workspace """ self.log.info('starting the ``_get_all_taskpaper_files`` m...
python
def _get_all_taskpaper_files( self): """*get a list of all the taskpaper filepaths in the workspace* **Return:** - ``taskpaperFiles`` -- a list of paths to all the taskpaper files within the workspace """ self.log.info('starting the ``_get_all_taskpaper_files`` m...
[ "def", "_get_all_taskpaper_files", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_get_all_taskpaper_files`` method'", ")", "if", "self", ".", "workspaceRoot", ":", "from", "fundamentals", ".", "files", "import", "recursive_directory_lis...
*get a list of all the taskpaper filepaths in the workspace* **Return:** - ``taskpaperFiles`` -- a list of paths to all the taskpaper files within the workspace
[ "*", "get", "a", "list", "of", "all", "the", "taskpaper", "filepaths", "in", "the", "workspace", "*" ]
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/workspace/workspace.py#L132-L156
thespacedoctor/tastic
tastic/workspace/workspace.py
workspace._sort_tp_file
def _sort_tp_file( self, taskpaperPath): """*sort individual taskpaper documents* **Key Arguments:** - ``taskpaperPath`` -- path to a taskpaper file **Return:** - None """ self.log.info('starting the ``_sort_tp_file`` method') ...
python
def _sort_tp_file( self, taskpaperPath): """*sort individual taskpaper documents* **Key Arguments:** - ``taskpaperPath`` -- path to a taskpaper file **Return:** - None """ self.log.info('starting the ``_sort_tp_file`` method') ...
[ "def", "_sort_tp_file", "(", "self", ",", "taskpaperPath", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_sort_tp_file`` method'", ")", "# OPEN TASKPAPER FILE", "self", ".", "log", ".", "info", "(", "\"sorting taskpaper file %(taskpaperPath)s\"", "%...
*sort individual taskpaper documents* **Key Arguments:** - ``taskpaperPath`` -- path to a taskpaper file **Return:** - None
[ "*", "sort", "individual", "taskpaper", "documents", "*" ]
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/workspace/workspace.py#L158-L181
thespacedoctor/tastic
tastic/workspace/workspace.py
workspace._archive_tp_file_done_tasks
def _archive_tp_file_done_tasks( self, taskpaperPath): """* archive tp file done tasks* **Key Arguments:** - ``taskpaperPath`` -- path to a taskpaper file **Return:** - None """ self.log.info('starting the ``_archive_tp_file_done_...
python
def _archive_tp_file_done_tasks( self, taskpaperPath): """* archive tp file done tasks* **Key Arguments:** - ``taskpaperPath`` -- path to a taskpaper file **Return:** - None """ self.log.info('starting the ``_archive_tp_file_done_...
[ "def", "_archive_tp_file_done_tasks", "(", "self", ",", "taskpaperPath", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_archive_tp_file_done_tasks`` method'", ")", "self", ".", "log", ".", "info", "(", "\"archiving taskpaper file %(taskpaperPath)s\"", ...
* archive tp file done tasks* **Key Arguments:** - ``taskpaperPath`` -- path to a taskpaper file **Return:** - None
[ "*", "archive", "tp", "file", "done", "tasks", "*" ]
train
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/workspace/workspace.py#L183-L307
thespacedoctor/astrocalc
astrocalc/times/conversions.py
conversions.get
def get(self): """ *get the conversions object* **Return:** - ``conversions`` .. todo:: - @review: when complete, clean get method - @review: when complete add logging """ self.log.info('starting the ``get`` method') convers...
python
def get(self): """ *get the conversions object* **Return:** - ``conversions`` .. todo:: - @review: when complete, clean get method - @review: when complete add logging """ self.log.info('starting the ``get`` method') convers...
[ "def", "get", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``get`` method'", ")", "conversions", "=", "None", "self", ".", "log", ".", "info", "(", "'completed the ``get`` method'", ")", "return", "conversions" ]
*get the conversions object* **Return:** - ``conversions`` .. todo:: - @review: when complete, clean get method - @review: when complete add logging
[ "*", "get", "the", "conversions", "object", "*" ]
train
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/times/conversions.py#L55-L72
thespacedoctor/astrocalc
astrocalc/times/conversions.py
conversions.ut_datetime_to_mjd
def ut_datetime_to_mjd( self, utDatetime): """*ut datetime to mjd* If the date given has no time associated with it (e.g. ``20160426``), then the datetime assumed is ``20160426 00:00:00.0``. Precision should be respected. **Key Arguments:** - ``utD...
python
def ut_datetime_to_mjd( self, utDatetime): """*ut datetime to mjd* If the date given has no time associated with it (e.g. ``20160426``), then the datetime assumed is ``20160426 00:00:00.0``. Precision should be respected. **Key Arguments:** - ``utD...
[ "def", "ut_datetime_to_mjd", "(", "self", ",", "utDatetime", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``ut_datetime_to_mjd`` method'", ")", "import", "time", "import", "re", "mjd", "=", "None", "# TRIM WHITESPACE FROM AROUND STRING", "utDatetime"...
*ut datetime to mjd* If the date given has no time associated with it (e.g. ``20160426``), then the datetime assumed is ``20160426 00:00:00.0``. Precision should be respected. **Key Arguments:** - ``utDatetime`` -- UT datetime. Can accept various formats e.g. ``201604261444``, ``...
[ "*", "ut", "datetime", "to", "mjd", "*" ]
train
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/times/conversions.py#L74-L185
thespacedoctor/astrocalc
astrocalc/times/conversions.py
conversions.mjd_to_ut_datetime
def mjd_to_ut_datetime( self, mjd, sqlDate=False, datetimeObject=False): """*mjd to ut datetime* Precision should be respected. **Key Arguments:** - ``mjd`` -- time in MJD. - ``sqlDate`` -- add a 'T' between date and time...
python
def mjd_to_ut_datetime( self, mjd, sqlDate=False, datetimeObject=False): """*mjd to ut datetime* Precision should be respected. **Key Arguments:** - ``mjd`` -- time in MJD. - ``sqlDate`` -- add a 'T' between date and time...
[ "def", "mjd_to_ut_datetime", "(", "self", ",", "mjd", ",", "sqlDate", "=", "False", ",", "datetimeObject", "=", "False", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``mjd_to_ut_datetime`` method'", ")", "from", "datetime", "import", "datetime"...
*mjd to ut datetime* Precision should be respected. **Key Arguments:** - ``mjd`` -- time in MJD. - ``sqlDate`` -- add a 'T' between date and time instead of space - ``datetimeObject`` -- return a datetime object instead of a string. Default *False* .. todo...
[ "*", "mjd", "to", "ut", "datetime", "*" ]
train
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/times/conversions.py#L187-L276
thespacedoctor/astrocalc
astrocalc/times/conversions.py
conversions.decimal_day_to_day_hour_min_sec
def decimal_day_to_day_hour_min_sec( self, daysFloat): """*Convert a day from decimal format to hours mins and sec* Precision should be respected. **Key Arguments:** - ``daysFloat`` -- the day as a decimal. **Return:** - ``daysInt`` -- ...
python
def decimal_day_to_day_hour_min_sec( self, daysFloat): """*Convert a day from decimal format to hours mins and sec* Precision should be respected. **Key Arguments:** - ``daysFloat`` -- the day as a decimal. **Return:** - ``daysInt`` -- ...
[ "def", "decimal_day_to_day_hour_min_sec", "(", "self", ",", "daysFloat", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``decimal_day_to_day_hour_min_sec`` method'", ")", "daysInt", "=", "int", "(", "daysFloat", ")", "hoursFloat", "=", "(", "daysFloa...
*Convert a day from decimal format to hours mins and sec* Precision should be respected. **Key Arguments:** - ``daysFloat`` -- the day as a decimal. **Return:** - ``daysInt`` -- day as an integer - ``hoursInt`` -- hour as an integer (None if input precsion...
[ "*", "Convert", "a", "day", "from", "decimal", "format", "to", "hours", "mins", "and", "sec", "*" ]
train
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/times/conversions.py#L278-L363
PlatformStories/geojsontools
geojsontools/geojsontools.py
join
def join(input_files, output_file): ''' Join geojsons into one. The spatial reference system of the output file is the same as the one of the last file in the list. Args: input_files (list): List of file name strings. output_file (str): Output file name. ''' # get feature c...
python
def join(input_files, output_file): ''' Join geojsons into one. The spatial reference system of the output file is the same as the one of the last file in the list. Args: input_files (list): List of file name strings. output_file (str): Output file name. ''' # get feature c...
[ "def", "join", "(", "input_files", ",", "output_file", ")", ":", "# get feature collections", "final_features", "=", "[", "]", "for", "file", "in", "input_files", ":", "with", "open", "(", "file", ")", "as", "f", ":", "feat_collection", "=", "geojson", ".", ...
Join geojsons into one. The spatial reference system of the output file is the same as the one of the last file in the list. Args: input_files (list): List of file name strings. output_file (str): Output file name.
[ "Join", "geojsons", "into", "one", ".", "The", "spatial", "reference", "system", "of", "the", "output", "file", "is", "the", "same", "as", "the", "one", "of", "the", "last", "file", "in", "the", "list", "." ]
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L11-L32
PlatformStories/geojsontools
geojsontools/geojsontools.py
split
def split(input_file, file_1, file_2, no_in_first_file): ''' Split a geojson in two separate files. Args: input_file (str): Input filename. file_1 (str): Output file name 1. file_2 (str): Output file name 2. no_features (int): Number of features in input_file to go to file_1...
python
def split(input_file, file_1, file_2, no_in_first_file): ''' Split a geojson in two separate files. Args: input_file (str): Input filename. file_1 (str): Output file name 1. file_2 (str): Output file name 2. no_features (int): Number of features in input_file to go to file_1...
[ "def", "split", "(", "input_file", ",", "file_1", ",", "file_2", ",", "no_in_first_file", ")", ":", "# get feature collection", "with", "open", "(", "input_file", ")", "as", "f", ":", "feat_collection", "=", "geojson", ".", "load", "(", "f", ")", "features",...
Split a geojson in two separate files. Args: input_file (str): Input filename. file_1 (str): Output file name 1. file_2 (str): Output file name 2. no_features (int): Number of features in input_file to go to file_1. output_file (str): Output file name.
[ "Split", "a", "geojson", "in", "two", "separate", "files", "." ]
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L35-L59
PlatformStories/geojsontools
geojsontools/geojsontools.py
get_from
def get_from(input_file, property_names): ''' Reads a geojson and returns a list of value tuples, each value corresponding to a property in property_names. Args: input_file (str): File name. property_names: List of strings; each string is a property name. Returns: List ...
python
def get_from(input_file, property_names): ''' Reads a geojson and returns a list of value tuples, each value corresponding to a property in property_names. Args: input_file (str): File name. property_names: List of strings; each string is a property name. Returns: List ...
[ "def", "get_from", "(", "input_file", ",", "property_names", ")", ":", "# get feature collections", "with", "open", "(", "input_file", ")", "as", "f", ":", "feature_collection", "=", "geojson", ".", "load", "(", "f", ")", "features", "=", "feature_collection", ...
Reads a geojson and returns a list of value tuples, each value corresponding to a property in property_names. Args: input_file (str): File name. property_names: List of strings; each string is a property name. Returns: List of value tuples.
[ "Reads", "a", "geojson", "and", "returns", "a", "list", "of", "value", "tuples", "each", "value", "corresponding", "to", "a", "property", "in", "property_names", "." ]
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L62-L83
PlatformStories/geojsontools
geojsontools/geojsontools.py
write_properties_to
def write_properties_to(data, property_names, input_file, output_file, filter=None): ''' Writes property data to polygon_file for all geometries indicated in the filter, and creates output file. The length of data must be equal to the number of geometries in the filter. Existing property values ...
python
def write_properties_to(data, property_names, input_file, output_file, filter=None): ''' Writes property data to polygon_file for all geometries indicated in the filter, and creates output file. The length of data must be equal to the number of geometries in the filter. Existing property values ...
[ "def", "write_properties_to", "(", "data", ",", "property_names", ",", "input_file", ",", "output_file", ",", "filter", "=", "None", ")", ":", "with", "open", "(", "input_file", ")", "as", "f", ":", "feature_collection", "=", "geojson", ".", "load", "(", "...
Writes property data to polygon_file for all geometries indicated in the filter, and creates output file. The length of data must be equal to the number of geometries in the filter. Existing property values are overwritten. Args data (list): List of tuples. Each entry is a tuple of dimensio...
[ "Writes", "property", "data", "to", "polygon_file", "for", "all", "geometries", "indicated", "in", "the", "filter", "and", "creates", "output", "file", ".", "The", "length", "of", "data", "must", "be", "equal", "to", "the", "number", "of", "geometries", "in"...
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L86-L127
PlatformStories/geojsontools
geojsontools/geojsontools.py
find_unique_values
def find_unique_values(input_file, property_name): ''' Find unique values of a given property in a geojson file. Args input_file (str): File name. property_name (str): Property name. Returns List of distinct values of property. If property does not exist, it returns None. ''...
python
def find_unique_values(input_file, property_name): ''' Find unique values of a given property in a geojson file. Args input_file (str): File name. property_name (str): Property name. Returns List of distinct values of property. If property does not exist, it returns None. ''...
[ "def", "find_unique_values", "(", "input_file", ",", "property_name", ")", ":", "with", "open", "(", "input_file", ")", "as", "f", ":", "feature_collection", "=", "geojson", ".", "load", "(", "f", ")", "features", "=", "feature_collection", "[", "'features'", ...
Find unique values of a given property in a geojson file. Args input_file (str): File name. property_name (str): Property name. Returns List of distinct values of property. If property does not exist, it returns None.
[ "Find", "unique", "values", "of", "a", "given", "property", "in", "a", "geojson", "file", "." ]
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L130-L147
PlatformStories/geojsontools
geojsontools/geojsontools.py
filter_by_property
def filter_by_property(input_file, output_file, property_name, values): ''' Create a file containing only features with specified property value(s) from input_file. Args input_file (str): File name. output_file (str): Output file name. property_name (str): Name of the featur...
python
def filter_by_property(input_file, output_file, property_name, values): ''' Create a file containing only features with specified property value(s) from input_file. Args input_file (str): File name. output_file (str): Output file name. property_name (str): Name of the featur...
[ "def", "filter_by_property", "(", "input_file", ",", "output_file", ",", "property_name", ",", "values", ")", ":", "filtered_feats", "=", "[", "]", "if", "not", "output_file", ".", "endswith", "(", "'.geojson'", ")", ":", "output_file", "+=", "'.geojson'", "# ...
Create a file containing only features with specified property value(s) from input_file. Args input_file (str): File name. output_file (str): Output file name. property_name (str): Name of the feature property to filter by. values (list): Value(s) a feature may have for prop...
[ "Create", "a", "file", "containing", "only", "features", "with", "specified", "property", "value", "(", "s", ")", "from", "input_file", "." ]
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L150-L180
PlatformStories/geojsontools
geojsontools/geojsontools.py
create_balanced_geojson
def create_balanced_geojson(input_file, classes, output_file='balanced.geojson', samples_per_class=None): ''' Create a geojson comprised of balanced classes from the class_name property in input_file. Randomly selects polygons from all classes. Args: input_file (...
python
def create_balanced_geojson(input_file, classes, output_file='balanced.geojson', samples_per_class=None): ''' Create a geojson comprised of balanced classes from the class_name property in input_file. Randomly selects polygons from all classes. Args: input_file (...
[ "def", "create_balanced_geojson", "(", "input_file", ",", "classes", ",", "output_file", "=", "'balanced.geojson'", ",", "samples_per_class", "=", "None", ")", ":", "if", "not", "output_file", ".", "endswith", "(", "'.geojson'", ")", ":", "output_file", "+=", "'...
Create a geojson comprised of balanced classes from the class_name property in input_file. Randomly selects polygons from all classes. Args: input_file (str): File name classes (list[str]): Classes in input_file to include in the balanced output file. Must exactly match the 'cla...
[ "Create", "a", "geojson", "comprised", "of", "balanced", "classes", "from", "the", "class_name", "property", "in", "input_file", ".", "Randomly", "selects", "polygons", "from", "all", "classes", "." ]
train
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L226-L276
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.launch
def launch(self, args, unknown): """Launch something according to the provided arguments :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises:...
python
def launch(self, args, unknown): """Launch something according to the provided arguments :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises:...
[ "def", "launch", "(", "self", ",", "args", ",", "unknown", ")", ":", "pm", "=", "plugins", ".", "PluginManager", ".", "get", "(", ")", "addon", "=", "pm", ".", "get_plugin", "(", "args", ".", "addon", ")", "isgui", "=", "isinstance", "(", "addon", ...
Launch something according to the provided arguments :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: SystemExit
[ "Launch", "something", "according", "to", "the", "provided", "arguments" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L83-L103
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.list
def list(self, args, unknown): """List all addons that can be launched :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: None """ ...
python
def list(self, args, unknown): """List all addons that can be launched :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: None """ ...
[ "def", "list", "(", "self", ",", "args", ",", "unknown", ")", ":", "pm", "=", "plugins", ".", "PluginManager", ".", "get", "(", ")", "plugs", "=", "pm", ".", "get_all_plugins", "(", ")", "if", "not", "plugs", ":", "print", "\"No standalone addons found!\...
List all addons that can be launched :param args: arguments from the launch parser :type args: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: None
[ "List", "all", "addons", "that", "can", "be", "launched" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L116-L135
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.setup_manage_parser
def setup_manage_parser(self, parser): """Setup the given parser for manage command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None """ parser.set_defaults(func=self.mana...
python
def setup_manage_parser(self, parser): """Setup the given parser for manage command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None """ parser.set_defaults(func=self.mana...
[ "def", "setup_manage_parser", "(", "self", ",", "parser", ")", ":", "parser", ".", "set_defaults", "(", "func", "=", "self", ".", "manage", ")", "parser", ".", "add_argument", "(", "\"args\"", ",", "nargs", "=", "argparse", ".", "REMAINDER", ",", "help", ...
Setup the given parser for manage command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None
[ "Setup", "the", "given", "parser", "for", "manage", "command" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L137-L148
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.manage
def manage(self, namespace, unknown): """Execute the manage command for django :param namespace: namespace containing args with django manage.py arguments :type namespace: Namespace :param unknown: list of unknown arguments that get passed to the manage.py command :type unknown:...
python
def manage(self, namespace, unknown): """Execute the manage command for django :param namespace: namespace containing args with django manage.py arguments :type namespace: Namespace :param unknown: list of unknown arguments that get passed to the manage.py command :type unknown:...
[ "def", "manage", "(", "self", ",", "namespace", ",", "unknown", ")", ":", "# first argument is usually manage.py. This will also adapt the help messages", "args", "=", "[", "'jukebox manage'", "]", "args", ".", "extend", "(", "namespace", ".", "args", ")", "args", "...
Execute the manage command for django :param namespace: namespace containing args with django manage.py arguments :type namespace: Namespace :param unknown: list of unknown arguments that get passed to the manage.py command :type unknown: list :returns: None :rtype: None...
[ "Execute", "the", "manage", "command", "for", "django" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L150-L166
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.setup_compile_ui_parser
def setup_compile_ui_parser(self, parser): """Setup the given parser for the compile_ui command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None """ parser.set_defaults(fu...
python
def setup_compile_ui_parser(self, parser): """Setup the given parser for the compile_ui command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None """ parser.set_defaults(fu...
[ "def", "setup_compile_ui_parser", "(", "self", ",", "parser", ")", ":", "parser", ".", "set_defaults", "(", "func", "=", "self", ".", "compile_ui", ")", "parser", ".", "add_argument", "(", "'uifile'", ",", "nargs", "=", "\"+\"", ",", "help", "=", "'the uif...
Setup the given parser for the compile_ui command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None
[ "Setup", "the", "given", "parser", "for", "the", "compile_ui", "command" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L168-L183
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.compile_ui
def compile_ui(self, namespace, unknown): """Compile qt designer files :param namespace: namespace containing arguments from the launch parser :type namespace: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None ...
python
def compile_ui(self, namespace, unknown): """Compile qt designer files :param namespace: namespace containing arguments from the launch parser :type namespace: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None ...
[ "def", "compile_ui", "(", "self", ",", "namespace", ",", "unknown", ")", ":", "uifiles", "=", "namespace", ".", "uifile", "for", "f", "in", "uifiles", ":", "qtcompile", ".", "compile_ui", "(", "f", ".", "name", ")" ]
Compile qt designer files :param namespace: namespace containing arguments from the launch parser :type namespace: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: None
[ "Compile", "qt", "designer", "files" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L185-L198
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.setup_compile_rcc_parser
def setup_compile_rcc_parser(self, parser): """Setup the given parser for the compile_rcc command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None """ parser.set_defaults(...
python
def setup_compile_rcc_parser(self, parser): """Setup the given parser for the compile_rcc command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None """ parser.set_defaults(...
[ "def", "setup_compile_rcc_parser", "(", "self", ",", "parser", ")", ":", "parser", ".", "set_defaults", "(", "func", "=", "self", ".", "compile_rcc", ")", "parser", ".", "add_argument", "(", "'rccfile'", ",", "help", "=", "'the resource file to compile.\\\n ...
Setup the given parser for the compile_rcc command :param parser: the argument parser to setup :type parser: :class:`argparse.ArgumentParser` :returns: None :rtype: None :raises: None
[ "Setup", "the", "given", "parser", "for", "the", "compile_rcc", "command" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L200-L213
JukeboxPipeline/jukebox-core
src/jukeboxcore/launcher.py
Launcher.compile_rcc
def compile_rcc(self, namespace, unknown): """Compile qt resource files :param namespace: namespace containing arguments from the launch parser :type namespace: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None ...
python
def compile_rcc(self, namespace, unknown): """Compile qt resource files :param namespace: namespace containing arguments from the launch parser :type namespace: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None ...
[ "def", "compile_rcc", "(", "self", ",", "namespace", ",", "unknown", ")", ":", "rccfile", "=", "namespace", ".", "rccfile", ".", "name", "qtcompile", ".", "compile_rcc", "(", "rccfile", ")" ]
Compile qt resource files :param namespace: namespace containing arguments from the launch parser :type namespace: Namespace :param unknown: list of unknown arguments :type unknown: list :returns: None :rtype: None :raises: None
[ "Compile", "qt", "resource", "files" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/launcher.py#L215-L227
lcgong/redbean
redbean/logs.py
setup_logging
def setup_logging( config='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG' ): """Setup logging configuration """ path = config value = os.getenv(env_key, None) if value: path = value if path.exists(): with open(path, 'rt') as f: config = yaml...
python
def setup_logging( config='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG' ): """Setup logging configuration """ path = config value = os.getenv(env_key, None) if value: path = value if path.exists(): with open(path, 'rt') as f: config = yaml...
[ "def", "setup_logging", "(", "config", "=", "'logging.yaml'", ",", "default_level", "=", "logging", ".", "INFO", ",", "env_key", "=", "'LOG_CFG'", ")", ":", "path", "=", "config", "value", "=", "os", ".", "getenv", "(", "env_key", ",", "None", ")", "if",...
Setup logging configuration
[ "Setup", "logging", "configuration" ]
train
https://github.com/lcgong/redbean/blob/45df9ff1e807e742771c752808d7fdac4007c919/redbean/logs.py#L8-L26
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/ArrayConverter.py
ArrayConverter.to_nullable_array
def to_nullable_array(value): """ Converts value into array object. Single values are converted into arrays with a single element. :param value: the value to convert. :return: array object or None when value is None. """ # Shortcuts if value == None: ...
python
def to_nullable_array(value): """ Converts value into array object. Single values are converted into arrays with a single element. :param value: the value to convert. :return: array object or None when value is None. """ # Shortcuts if value == None: ...
[ "def", "to_nullable_array", "(", "value", ")", ":", "# Shortcuts", "if", "value", "==", "None", ":", "return", "None", "if", "type", "(", "value", ")", "==", "list", ":", "return", "value", "if", "type", "(", "value", ")", "in", "[", "tuple", ",", "s...
Converts value into array object. Single values are converted into arrays with a single element. :param value: the value to convert. :return: array object or None when value is None.
[ "Converts", "value", "into", "array", "object", ".", "Single", "values", "are", "converted", "into", "arrays", "with", "a", "single", "element", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/ArrayConverter.py#L23-L41
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/ArrayConverter.py
ArrayConverter.to_array_with_default
def to_array_with_default(value, default_value): """ Converts value into array object with specified default. Single values are converted into arrays with single element. :param value: the value to convert. :param default_value: default array object. :return: array obj...
python
def to_array_with_default(value, default_value): """ Converts value into array object with specified default. Single values are converted into arrays with single element. :param value: the value to convert. :param default_value: default array object. :return: array obj...
[ "def", "to_array_with_default", "(", "value", ",", "default_value", ")", ":", "result", "=", "ArrayConverter", ".", "to_nullable_array", "(", "value", ")", "return", "result", "if", "result", "!=", "None", "else", "default_value" ]
Converts value into array object with specified default. Single values are converted into arrays with single element. :param value: the value to convert. :param default_value: default array object. :return: array object or default array when value is None.
[ "Converts", "value", "into", "array", "object", "with", "specified", "default", ".", "Single", "values", "are", "converted", "into", "arrays", "with", "single", "element", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/ArrayConverter.py#L56-L68
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/ArrayConverter.py
ArrayConverter.list_to_array
def list_to_array(value): """ Converts value into array object with empty array as default. Strings with comma-delimited values are split into array of strings. :param value: the list to convert. :return: array object or empty array when value is None """ if val...
python
def list_to_array(value): """ Converts value into array object with empty array as default. Strings with comma-delimited values are split into array of strings. :param value: the list to convert. :return: array object or empty array when value is None """ if val...
[ "def", "list_to_array", "(", "value", ")", ":", "if", "value", "==", "None", ":", "return", "[", "]", "elif", "type", "(", "value", ")", "in", "[", "list", ",", "tuple", ",", "set", "]", ":", "return", "list", "(", "value", ")", "elif", "type", "...
Converts value into array object with empty array as default. Strings with comma-delimited values are split into array of strings. :param value: the list to convert. :return: array object or empty array when value is None
[ "Converts", "value", "into", "array", "object", "with", "empty", "array", "as", "default", ".", "Strings", "with", "comma", "-", "delimited", "values", "are", "split", "into", "array", "of", "strings", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/ArrayConverter.py#L71-L87
sbarham/dsrt
dsrt/data/transform/Vectorizer.py
Vectorizer.init_encoders
def init_encoders(self, config=DataConfig()): """ Initialize the integer encoder and the one-hot encoder, fitting them to the vocabulary of the corpus. """ self.log('info', 'Initializing the encoders ...') # create the integer encoder and fit it to our corpus' vocab ...
python
def init_encoders(self, config=DataConfig()): """ Initialize the integer encoder and the one-hot encoder, fitting them to the vocabulary of the corpus. """ self.log('info', 'Initializing the encoders ...') # create the integer encoder and fit it to our corpus' vocab ...
[ "def", "init_encoders", "(", "self", ",", "config", "=", "DataConfig", "(", ")", ")", ":", "self", ".", "log", "(", "'info'", ",", "'Initializing the encoders ...'", ")", "# create the integer encoder and fit it to our corpus' vocab", "self", ".", "ie", "=", "LabelE...
Initialize the integer encoder and the one-hot encoder, fitting them to the vocabulary of the corpus.
[ "Initialize", "the", "integer", "encoder", "and", "the", "one", "-", "hot", "encoder", "fitting", "them", "to", "the", "vocabulary", "of", "the", "corpus", "." ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/data/transform/Vectorizer.py#L40-L49
sbarham/dsrt
dsrt/data/transform/Vectorizer.py
Vectorizer.vectorize_dialogue
def vectorize_dialogue(self, dialogue, safe=True): """ Take in a dialogue (a sequence of tokenized utterances) and transform it into a sequence of sequences of indices """ if safe: return vectorize_dialogue_safe(dialogue) else: return vectorize_dia...
python
def vectorize_dialogue(self, dialogue, safe=True): """ Take in a dialogue (a sequence of tokenized utterances) and transform it into a sequence of sequences of indices """ if safe: return vectorize_dialogue_safe(dialogue) else: return vectorize_dia...
[ "def", "vectorize_dialogue", "(", "self", ",", "dialogue", ",", "safe", "=", "True", ")", ":", "if", "safe", ":", "return", "vectorize_dialogue_safe", "(", "dialogue", ")", "else", ":", "return", "vectorize_dialogue_unsafe", "(", "dialogue", ")" ]
Take in a dialogue (a sequence of tokenized utterances) and transform it into a sequence of sequences of indices
[ "Take", "in", "a", "dialogue", "(", "a", "sequence", "of", "tokenized", "utterances", ")", "and", "transform", "it", "into", "a", "sequence", "of", "sequences", "of", "indices" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/data/transform/Vectorizer.py#L84-L92
sbarham/dsrt
dsrt/data/transform/Vectorizer.py
Vectorizer.vectorize_utterance
def vectorize_utterance(self, utterance, safe=True): """ Take in a tokenized utterance and transform it into a sequence of indices """ if safe: return self.vectorize_utterance_safe(utterance) else: return self.vectorize_utterance_unsafe(utterance)
python
def vectorize_utterance(self, utterance, safe=True): """ Take in a tokenized utterance and transform it into a sequence of indices """ if safe: return self.vectorize_utterance_safe(utterance) else: return self.vectorize_utterance_unsafe(utterance)
[ "def", "vectorize_utterance", "(", "self", ",", "utterance", ",", "safe", "=", "True", ")", ":", "if", "safe", ":", "return", "self", ".", "vectorize_utterance_safe", "(", "utterance", ")", "else", ":", "return", "self", ".", "vectorize_utterance_unsafe", "(",...
Take in a tokenized utterance and transform it into a sequence of indices
[ "Take", "in", "a", "tokenized", "utterance", "and", "transform", "it", "into", "a", "sequence", "of", "indices" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/data/transform/Vectorizer.py#L101-L108
theSage21/lanchat
lanchat/utils.py
get_server_sock
def get_server_sock(): "Get a server socket" s = _socket.socket() s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True) s.setblocking(False) s.bind(('0.0.0.0', _config.server_listen_port)) s.listen(5) return s
python
def get_server_sock(): "Get a server socket" s = _socket.socket() s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True) s.setblocking(False) s.bind(('0.0.0.0', _config.server_listen_port)) s.listen(5) return s
[ "def", "get_server_sock", "(", ")", ":", "s", "=", "_socket", ".", "socket", "(", ")", "s", ".", "setsockopt", "(", "_socket", ".", "SOL_SOCKET", ",", "_socket", ".", "SO_REUSEADDR", ",", "True", ")", "s", ".", "setblocking", "(", "False", ")", "s", ...
Get a server socket
[ "Get", "a", "server", "socket" ]
train
https://github.com/theSage21/lanchat/blob/66f5dcead67fef815347b956b1d3e149a7e13b29/lanchat/utils.py#L33-L40
theSage21/lanchat
lanchat/utils.py
get_client_sock
def get_client_sock(addr): "Get a client socket" s = _socket.create_connection(addr) s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True) s.setblocking(False) return s
python
def get_client_sock(addr): "Get a client socket" s = _socket.create_connection(addr) s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True) s.setblocking(False) return s
[ "def", "get_client_sock", "(", "addr", ")", ":", "s", "=", "_socket", ".", "create_connection", "(", "addr", ")", "s", ".", "setsockopt", "(", "_socket", ".", "SOL_SOCKET", ",", "_socket", ".", "SO_REUSEADDR", ",", "True", ")", "s", ".", "setblocking", "...
Get a client socket
[ "Get", "a", "client", "socket" ]
train
https://github.com/theSage21/lanchat/blob/66f5dcead67fef815347b956b1d3e149a7e13b29/lanchat/utils.py#L43-L48
theSage21/lanchat
lanchat/utils.py
get_beacon
def get_beacon(): "Get a beacon socket" s = _socket.socket(_socket.AF_INET, _socket.SOCK_DGRAM) s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True) s.setsockopt(_socket.SOL_SOCKET, _socket.SO_BROADCAST, True) return s
python
def get_beacon(): "Get a beacon socket" s = _socket.socket(_socket.AF_INET, _socket.SOCK_DGRAM) s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, True) s.setsockopt(_socket.SOL_SOCKET, _socket.SO_BROADCAST, True) return s
[ "def", "get_beacon", "(", ")", ":", "s", "=", "_socket", ".", "socket", "(", "_socket", ".", "AF_INET", ",", "_socket", ".", "SOCK_DGRAM", ")", "s", ".", "setsockopt", "(", "_socket", ".", "SOL_SOCKET", ",", "_socket", ".", "SO_REUSEADDR", ",", "True", ...
Get a beacon socket
[ "Get", "a", "beacon", "socket" ]
train
https://github.com/theSage21/lanchat/blob/66f5dcead67fef815347b956b1d3e149a7e13b29/lanchat/utils.py#L51-L56
endeepak/pungi
pungi/matchers.py
Base.message
def message(self): ''' Override this to provide failure message''' name = self.__class__.__name__ return "{0} {1}".format(humanize(name), pp(*self.expectedArgs, **self.expectedKwArgs))
python
def message(self): ''' Override this to provide failure message''' name = self.__class__.__name__ return "{0} {1}".format(humanize(name), pp(*self.expectedArgs, **self.expectedKwArgs))
[ "def", "message", "(", "self", ")", ":", "name", "=", "self", ".", "__class__", ".", "__name__", "return", "\"{0} {1}\"", ".", "format", "(", "humanize", "(", "name", ")", ",", "pp", "(", "*", "self", ".", "expectedArgs", ",", "*", "*", "self", ".", ...
Override this to provide failure message
[ "Override", "this", "to", "provide", "failure", "message" ]
train
https://github.com/endeepak/pungi/blob/4c90e0959f3498d0be85aa1e8e3ee4348be45593/pungi/matchers.py#L25-L29
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py
SearchCommand.options
def options(self): """ Returns the options specified as argument to this command. """ if self._option_view is None: self._option_view = Option.View(self) return self._option_view
python
def options(self): """ Returns the options specified as argument to this command. """ if self._option_view is None: self._option_view = Option.View(self) return self._option_view
[ "def", "options", "(", "self", ")", ":", "if", "self", ".", "_option_view", "is", "None", ":", "self", ".", "_option_view", "=", "Option", ".", "View", "(", "self", ")", "return", "self", ".", "_option_view" ]
Returns the options specified as argument to this command.
[ "Returns", "the", "options", "specified", "as", "argument", "to", "this", "command", "." ]
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py#L160-L166
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py
SearchCommand.search_results_info
def search_results_info(self): """ Returns the search results info for this command invocation or None. The search results info object is created from the search results info file associated with the command invocation. Splunk does not pass the location of this file by default. You must...
python
def search_results_info(self): """ Returns the search results info for this command invocation or None. The search results info object is created from the search results info file associated with the command invocation. Splunk does not pass the location of this file by default. You must...
[ "def", "search_results_info", "(", "self", ")", ":", "if", "self", ".", "_search_results_info", "is", "not", "None", ":", "return", "self", ".", "_search_results_info", "try", ":", "info_path", "=", "self", ".", "input_header", "[", "'infoPath'", "]", "except"...
Returns the search results info for this command invocation or None. The search results info object is created from the search results info file associated with the command invocation. Splunk does not pass the location of this file by default. You must request it by specifying these con...
[ "Returns", "the", "search", "results", "info", "for", "this", "command", "invocation", "or", "None", "." ]
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py#L169-L232
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py
SearchCommand.service
def service(self): """ Returns a Splunk service object for this command invocation or None. The service object is created from the Splunkd URI and authentication token passed to the command invocation in the search results info file. This data is not passed to a command invocation by de...
python
def service(self): """ Returns a Splunk service object for this command invocation or None. The service object is created from the Splunkd URI and authentication token passed to the command invocation in the search results info file. This data is not passed to a command invocation by de...
[ "def", "service", "(", "self", ")", ":", "if", "self", ".", "_service", "is", "not", "None", ":", "return", "self", ".", "_service", "info", "=", "self", ".", "search_results_info", "if", "info", "is", "None", ":", "return", "None", "splunkd", "=", "ur...
Returns a Splunk service object for this command invocation or None. The service object is created from the Splunkd URI and authentication token passed to the command invocation in the search results info file. This data is not passed to a command invocation by default. You must request...
[ "Returns", "a", "Splunk", "service", "object", "for", "this", "command", "invocation", "or", "None", "." ]
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py#L235-L271
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py
SearchCommand.process
def process(self, args=argv, input_file=stdin, output_file=stdout): """ Processes search results as specified by command arguments. :param args: Sequence of command arguments :param input_file: Pipeline input file :param output_file: Pipeline output file """ self.logger...
python
def process(self, args=argv, input_file=stdin, output_file=stdout): """ Processes search results as specified by command arguments. :param args: Sequence of command arguments :param input_file: Pipeline input file :param output_file: Pipeline output file """ self.logger...
[ "def", "process", "(", "self", ",", "args", "=", "argv", ",", "input_file", "=", "stdin", ",", "output_file", "=", "stdout", ")", ":", "self", ".", "logger", ".", "debug", "(", "u'%s arguments: %s'", ",", "type", "(", "self", ")", ".", "__name__", ",",...
Processes search results as specified by command arguments. :param args: Sequence of command arguments :param input_file: Pipeline input file :param output_file: Pipeline output file
[ "Processes", "search", "results", "as", "specified", "by", "command", "arguments", "." ]
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/searchcommands/search_command.py#L282-L356
gisce/heman
heman/auth/__init__.py
check_contract_allowed
def check_contract_allowed(func): """Check if Contract is allowed by token """ @wraps(func) def decorator(*args, **kwargs): contract = kwargs.get('contract') if (contract and current_user.is_authenticated() and not current_user.allowed(contract)): return curre...
python
def check_contract_allowed(func): """Check if Contract is allowed by token """ @wraps(func) def decorator(*args, **kwargs): contract = kwargs.get('contract') if (contract and current_user.is_authenticated() and not current_user.allowed(contract)): return curre...
[ "def", "check_contract_allowed", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "decorator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "contract", "=", "kwargs", ".", "get", "(", "'contract'", ")", "if", "(", "contract", "an...
Check if Contract is allowed by token
[ "Check", "if", "Contract", "is", "allowed", "by", "token" ]
train
https://github.com/gisce/heman/blob/cf09fca09953f12454b2910ddfa9d7586709657b/heman/auth/__init__.py#L16-L26
gisce/heman
heman/auth/__init__.py
check_cups_allowed
def check_cups_allowed(func): """Check if CUPS is allowd by token """ @wraps(func) def decorator(*args, **kwargs): cups = kwargs.get('cups') if (cups and current_user.is_authenticated() and not current_user.allowed(cups, 'cups')): return current_app.login_mana...
python
def check_cups_allowed(func): """Check if CUPS is allowd by token """ @wraps(func) def decorator(*args, **kwargs): cups = kwargs.get('cups') if (cups and current_user.is_authenticated() and not current_user.allowed(cups, 'cups')): return current_app.login_mana...
[ "def", "check_cups_allowed", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "decorator", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cups", "=", "kwargs", ".", "get", "(", "'cups'", ")", "if", "(", "cups", "and", "current_u...
Check if CUPS is allowd by token
[ "Check", "if", "CUPS", "is", "allowd", "by", "token" ]
train
https://github.com/gisce/heman/blob/cf09fca09953f12454b2910ddfa9d7586709657b/heman/auth/__init__.py#L29-L39
majerteam/sqla_inspect
sqla_inspect/py3o.py
format_py3o_val
def format_py3o_val(value): """ format a value to fit py3o's context * Handle linebreaks """ value = force_unicode(value) value = escape(value) value = value.replace(u'\n', u'<text:line-break/>') return Markup(value)
python
def format_py3o_val(value): """ format a value to fit py3o's context * Handle linebreaks """ value = force_unicode(value) value = escape(value) value = value.replace(u'\n', u'<text:line-break/>') return Markup(value)
[ "def", "format_py3o_val", "(", "value", ")", ":", "value", "=", "force_unicode", "(", "value", ")", "value", "=", "escape", "(", "value", ")", "value", "=", "value", ".", "replace", "(", "u'\\n'", ",", "u'<text:line-break/>'", ")", "return", "Markup", "(",...
format a value to fit py3o's context * Handle linebreaks
[ "format", "a", "value", "to", "fit", "py3o", "s", "context" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L39-L48
majerteam/sqla_inspect
sqla_inspect/py3o.py
get_compilation_context
def get_compilation_context(instance): """ Return the compilation context for py3o templating Build a deep dict representation of the given instance and add config values :param obj instance: a SQLAlchemy model instance :return: a multi level dict with context datas :rtype: dict """ co...
python
def get_compilation_context(instance): """ Return the compilation context for py3o templating Build a deep dict representation of the given instance and add config values :param obj instance: a SQLAlchemy model instance :return: a multi level dict with context datas :rtype: dict """ co...
[ "def", "get_compilation_context", "(", "instance", ")", ":", "context_builder", "=", "SqlaContext", "(", "instance", ".", "__class__", ")", "py3o_context", "=", "context_builder", ".", "compile_obj", "(", "instance", ")", "return", "py3o_context" ]
Return the compilation context for py3o templating Build a deep dict representation of the given instance and add config values :param obj instance: a SQLAlchemy model instance :return: a multi level dict with context datas :rtype: dict
[ "Return", "the", "compilation", "context", "for", "py3o", "templating" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L348-L360
majerteam/sqla_inspect
sqla_inspect/py3o.py
compile_template
def compile_template(instance, template, additionnal_context=None): """ Fill the given template with the instance's datas and return the odt file For every instance class, common values are also inserted in the context dict (and so can be used) : * config values :param obj instance: the i...
python
def compile_template(instance, template, additionnal_context=None): """ Fill the given template with the instance's datas and return the odt file For every instance class, common values are also inserted in the context dict (and so can be used) : * config values :param obj instance: the i...
[ "def", "compile_template", "(", "instance", ",", "template", ",", "additionnal_context", "=", "None", ")", ":", "py3o_context", "=", "get_compilation_context", "(", "instance", ")", "if", "additionnal_context", "is", "not", "None", ":", "py3o_context", ".", "updat...
Fill the given template with the instance's datas and return the odt file For every instance class, common values are also inserted in the context dict (and so can be used) : * config values :param obj instance: the instance of a model (like Userdatas, Company) :param template: the template o...
[ "Fill", "the", "given", "template", "with", "the", "instance", "s", "datas", "and", "return", "the", "odt", "file" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L363-L388
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext.collect_columns
def collect_columns(self): """ Collect columns information from a given model. a column info contains the py3 informations exclude Should the column be excluded from the current context ? name the name of t...
python
def collect_columns(self): """ Collect columns information from a given model. a column info contains the py3 informations exclude Should the column be excluded from the current context ? name the name of t...
[ "def", "collect_columns", "(", "self", ")", ":", "res", "=", "[", "]", "for", "prop", "in", "self", ".", "get_sorted_columns", "(", ")", ":", "info_dict", "=", "self", ".", "get_info_field", "(", "prop", ")", "export_infos", "=", "info_dict", ".", "get",...
Collect columns information from a given model. a column info contains the py3 informations exclude Should the column be excluded from the current context ? name the name of the key in the resulting py3o context of the ...
[ "Collect", "columns", "information", "from", "a", "given", "model", "." ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L85-L143
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext.make_doc
def make_doc(self): """ Generate the doc for the current context in the form {'key': 'label'} """ res = {} for column in self.columns: if isinstance(column['__col__'], ColumnProperty): key = column['name'] label = column['__col_...
python
def make_doc(self): """ Generate the doc for the current context in the form {'key': 'label'} """ res = {} for column in self.columns: if isinstance(column['__col__'], ColumnProperty): key = column['name'] label = column['__col_...
[ "def", "make_doc", "(", "self", ")", ":", "res", "=", "{", "}", "for", "column", "in", "self", ".", "columns", ":", "if", "isinstance", "(", "column", "[", "'__col__'", "]", ",", "ColumnProperty", ")", ":", "key", "=", "column", "[", "'name'", "]", ...
Generate the doc for the current context in the form {'key': 'label'}
[ "Generate", "the", "doc", "for", "the", "current", "context", "in", "the", "form", "{", "key", ":", "label", "}" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L145-L203
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext.gen_xml_doc
def gen_xml_doc(self): """ Generate the text tags that should be inserted in the content.xml of a full model """ res = self.make_doc() var_tag = """ <text:user-field-decl office:value-type="string" office:string-value="%s" text:name="py3o.%s"/>""" ...
python
def gen_xml_doc(self): """ Generate the text tags that should be inserted in the content.xml of a full model """ res = self.make_doc() var_tag = """ <text:user-field-decl office:value-type="string" office:string-value="%s" text:name="py3o.%s"/>""" ...
[ "def", "gen_xml_doc", "(", "self", ")", ":", "res", "=", "self", ".", "make_doc", "(", ")", "var_tag", "=", "\"\"\"\n <text:user-field-decl office:value-type=\"string\"\n office:string-value=\"%s\" text:name=\"py3o.%s\"/>\"\"\"", "text_tag", "=", "\"\"\"<text:p text...
Generate the text tags that should be inserted in the content.xml of a full model
[ "Generate", "the", "text", "tags", "that", "should", "be", "inserted", "in", "the", "content", ".", "xml", "of", "a", "full", "model" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L205-L226
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext._get_formatted_val
def _get_formatted_val(self, obj, attribute, column): """ Return the formatted value of the attribute "attribute" of the obj "obj" regarding the column's description :param obj obj: The instance we manage :param str attribute: The string defining the path to access the end ...
python
def _get_formatted_val(self, obj, attribute, column): """ Return the formatted value of the attribute "attribute" of the obj "obj" regarding the column's description :param obj obj: The instance we manage :param str attribute: The string defining the path to access the end ...
[ "def", "_get_formatted_val", "(", "self", ",", "obj", ",", "attribute", ",", "column", ")", ":", "attr_path", "=", "attribute", ".", "split", "(", "'.'", ")", "val", "=", "None", "tmp_val", "=", "obj", "for", "attr", "in", "attr_path", ":", "tmp_val", ...
Return the formatted value of the attribute "attribute" of the obj "obj" regarding the column's description :param obj obj: The instance we manage :param str attribute: The string defining the path to access the end attribute we want to manage :param dict column: The column desc...
[ "Return", "the", "formatted", "value", "of", "the", "attribute", "attribute", "of", "the", "obj", "obj", "regarding", "the", "column", "s", "description" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L228-L250
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext._get_column_value
def _get_column_value(self, obj, column): """ Return a single cell's value :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value """ return self._get_formatted_val(obj, column['__col__'].key, ...
python
def _get_column_value(self, obj, column): """ Return a single cell's value :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value """ return self._get_formatted_val(obj, column['__col__'].key, ...
[ "def", "_get_column_value", "(", "self", ",", "obj", ",", "column", ")", ":", "return", "self", ".", "_get_formatted_val", "(", "obj", ",", "column", "[", "'__col__'", "]", ".", "key", ",", "column", ")" ]
Return a single cell's value :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value
[ "Return", "a", "single", "cell", "s", "value" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L252-L260
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext._get_to_many_relationship_value
def _get_to_many_relationship_value(self, obj, column): """ Get the resulting datas for a One To many or a many to many relationship :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value """ r...
python
def _get_to_many_relationship_value(self, obj, column): """ Get the resulting datas for a One To many or a many to many relationship :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value """ r...
[ "def", "_get_to_many_relationship_value", "(", "self", ",", "obj", ",", "column", ")", ":", "related_key", "=", "column", ".", "get", "(", "'related_key'", ",", "None", ")", "related", "=", "getattr", "(", "obj", ",", "column", "[", "'__col__'", "]", ".", ...
Get the resulting datas for a One To many or a many to many relationship :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value
[ "Get", "the", "resulting", "datas", "for", "a", "One", "To", "many", "or", "a", "many", "to", "many", "relationship" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L262-L295
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext._get_to_one_relationship_value
def _get_to_one_relationship_value(self, obj, column): """ Compute datas produced for a many to one relationship :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value """ related_key = column....
python
def _get_to_one_relationship_value(self, obj, column): """ Compute datas produced for a many to one relationship :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value """ related_key = column....
[ "def", "_get_to_one_relationship_value", "(", "self", ",", "obj", ",", "column", ")", ":", "related_key", "=", "column", ".", "get", "(", "'related_key'", ",", "None", ")", "related", "=", "getattr", "(", "obj", ",", "column", "[", "'__col__'", "]", ".", ...
Compute datas produced for a many to one relationship :param obj obj: The instance we manage :param dict column: The column description dictionnary :returns: The associated value
[ "Compute", "datas", "produced", "for", "a", "many", "to", "one", "relationship" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L297-L316
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext._get_relationship_value
def _get_relationship_value(self, obj, column): """ Compute datas produced for a given relationship """ if column['__col__'].uselist: value = self._get_to_many_relationship_value(obj, column) else: value = self._get_to_one_relationship_value(obj, column) ...
python
def _get_relationship_value(self, obj, column): """ Compute datas produced for a given relationship """ if column['__col__'].uselist: value = self._get_to_many_relationship_value(obj, column) else: value = self._get_to_one_relationship_value(obj, column) ...
[ "def", "_get_relationship_value", "(", "self", ",", "obj", ",", "column", ")", ":", "if", "column", "[", "'__col__'", "]", ".", "uselist", ":", "value", "=", "self", ".", "_get_to_many_relationship_value", "(", "obj", ",", "column", ")", "else", ":", "valu...
Compute datas produced for a given relationship
[ "Compute", "datas", "produced", "for", "a", "given", "relationship" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L318-L327
majerteam/sqla_inspect
sqla_inspect/py3o.py
SqlaContext.compile_obj
def compile_obj(self, obj): """ generate a context based on the given obj :param obj: an instance of the model """ res = {} for column in self.columns: if isinstance(column['__col__'], ColumnProperty): value = self._get_column_value(obj, colum...
python
def compile_obj(self, obj): """ generate a context based on the given obj :param obj: an instance of the model """ res = {} for column in self.columns: if isinstance(column['__col__'], ColumnProperty): value = self._get_column_value(obj, colum...
[ "def", "compile_obj", "(", "self", ",", "obj", ")", ":", "res", "=", "{", "}", "for", "column", "in", "self", ".", "columns", ":", "if", "isinstance", "(", "column", "[", "'__col__'", "]", ",", "ColumnProperty", ")", ":", "value", "=", "self", ".", ...
generate a context based on the given obj :param obj: an instance of the model
[ "generate", "a", "context", "based", "on", "the", "given", "obj" ]
train
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/py3o.py#L329-L345
host-anshu/simpleInterceptor
example/call_graph/advices.py
write
def write(_filename, _long, enter=True): """Write the call info to file""" def method(*arg, **kw): # pylint: disable=W0613 """Reference to the advice in order to facilitate argument support.""" def get_short(_fname): """Get basename of the file. If file is __init__.py, get its direc...
python
def write(_filename, _long, enter=True): """Write the call info to file""" def method(*arg, **kw): # pylint: disable=W0613 """Reference to the advice in order to facilitate argument support.""" def get_short(_fname): """Get basename of the file. If file is __init__.py, get its direc...
[ "def", "write", "(", "_filename", ",", "_long", ",", "enter", "=", "True", ")", ":", "def", "method", "(", "*", "arg", ",", "*", "*", "kw", ")", ":", "# pylint: disable=W0613", "\"\"\"Reference to the advice in order to facilitate argument support.\"\"\"", "def", ...
Write the call info to file
[ "Write", "the", "call", "info", "to", "file" ]
train
https://github.com/host-anshu/simpleInterceptor/blob/71238fed57c62b5f77ce32d0c9b98acad73ab6a8/example/call_graph/advices.py#L24-L69
adsabs/adsutils
adsutils/sourcematchers.py
TrigdictSourceMatcher._addPub
def _addPub(self, stem, source): """Enters stem as value for source. """ key = re.sub("[^A-Za-z0-9&]+", " ", source).strip().upper() self.sourceDict[key] = stem self.bibstemWords.setdefault(stem, set()).update( key.lower().split())
python
def _addPub(self, stem, source): """Enters stem as value for source. """ key = re.sub("[^A-Za-z0-9&]+", " ", source).strip().upper() self.sourceDict[key] = stem self.bibstemWords.setdefault(stem, set()).update( key.lower().split())
[ "def", "_addPub", "(", "self", ",", "stem", ",", "source", ")", ":", "key", "=", "re", ".", "sub", "(", "\"[^A-Za-z0-9&]+\"", ",", "\" \"", ",", "source", ")", ".", "strip", "(", ")", ".", "upper", "(", ")", "self", ".", "sourceDict", "[", "key", ...
Enters stem as value for source.
[ "Enters", "stem", "as", "value", "for", "source", "." ]
train
https://github.com/adsabs/adsutils/blob/fb9d6b4f6ed5e6ca19c552efc3cdd6466c587fdb/adsutils/sourcematchers.py#L75-L81
adsabs/adsutils
adsutils/sourcematchers.py
TrigdictSourceMatcher._loadTwoPartSource
def _loadTwoPartSource(self, sourceFName, sourceLines): """is a helper for _loadOneSource. """ lineno = 1 enterInConfstems = 0 if sourceFName.find("conferences")!=-1: enterInConfstems = 1 for ln in sourceLines: lineno += 1 try: ...
python
def _loadTwoPartSource(self, sourceFName, sourceLines): """is a helper for _loadOneSource. """ lineno = 1 enterInConfstems = 0 if sourceFName.find("conferences")!=-1: enterInConfstems = 1 for ln in sourceLines: lineno += 1 try: ...
[ "def", "_loadTwoPartSource", "(", "self", ",", "sourceFName", ",", "sourceLines", ")", ":", "lineno", "=", "1", "enterInConfstems", "=", "0", "if", "sourceFName", ".", "find", "(", "\"conferences\"", ")", "!=", "-", "1", ":", "enterInConfstems", "=", "1", ...
is a helper for _loadOneSource.
[ "is", "a", "helper", "for", "_loadOneSource", "." ]
train
https://github.com/adsabs/adsutils/blob/fb9d6b4f6ed5e6ca19c552efc3cdd6466c587fdb/adsutils/sourcematchers.py#L83-L102
adsabs/adsutils
adsutils/sourcematchers.py
TrigdictSourceMatcher._loadThreePartSource
def _loadThreePartSource(self, sourceFName, sourceLines): """is a helper for _loadOneSource. """ lineno = 1 for ln in sourceLines: lineno += 1 try: stem, pubType, source = ln.split("\t", 2) stem = stem.strip()[-9:] s...
python
def _loadThreePartSource(self, sourceFName, sourceLines): """is a helper for _loadOneSource. """ lineno = 1 for ln in sourceLines: lineno += 1 try: stem, pubType, source = ln.split("\t", 2) stem = stem.strip()[-9:] s...
[ "def", "_loadThreePartSource", "(", "self", ",", "sourceFName", ",", "sourceLines", ")", ":", "lineno", "=", "1", "for", "ln", "in", "sourceLines", ":", "lineno", "+=", "1", "try", ":", "stem", ",", "pubType", ",", "source", "=", "ln", ".", "split", "(...
is a helper for _loadOneSource.
[ "is", "a", "helper", "for", "_loadOneSource", "." ]
train
https://github.com/adsabs/adsutils/blob/fb9d6b4f6ed5e6ca19c552efc3cdd6466c587fdb/adsutils/sourcematchers.py#L104-L117
adsabs/adsutils
adsutils/sourcematchers.py
TrigdictSourceMatcher._loadOneSource
def _loadOneSource(self, sourceFName): """handles one authority file including format auto-detection. """ sourceLines = open(sourceFName).readlines() del sourceLines[0] if len(sourceLines[0].split("\t"))==2: self._loadTwoPartSource(sourceFName, sourceLines) el...
python
def _loadOneSource(self, sourceFName): """handles one authority file including format auto-detection. """ sourceLines = open(sourceFName).readlines() del sourceLines[0] if len(sourceLines[0].split("\t"))==2: self._loadTwoPartSource(sourceFName, sourceLines) el...
[ "def", "_loadOneSource", "(", "self", ",", "sourceFName", ")", ":", "sourceLines", "=", "open", "(", "sourceFName", ")", ".", "readlines", "(", ")", "del", "sourceLines", "[", "0", "]", "if", "len", "(", "sourceLines", "[", "0", "]", ".", "split", "(",...
handles one authority file including format auto-detection.
[ "handles", "one", "authority", "file", "including", "format", "auto", "-", "detection", "." ]
train
https://github.com/adsabs/adsutils/blob/fb9d6b4f6ed5e6ca19c552efc3cdd6466c587fdb/adsutils/sourcematchers.py#L119-L129
adsabs/adsutils
adsutils/sourcematchers.py
TrigdictSourceMatcher._loadSources
def _loadSources(self): """creates a trigdict and populates it with data from self.autorityFiles """ self.confstems = {} self.sourceDict = newtrigdict.Trigdict() for fName in self.authorityFiles: self._loadOneSource(fName) # We want to allow naked bibstems in ...
python
def _loadSources(self): """creates a trigdict and populates it with data from self.autorityFiles """ self.confstems = {} self.sourceDict = newtrigdict.Trigdict() for fName in self.authorityFiles: self._loadOneSource(fName) # We want to allow naked bibstems in ...
[ "def", "_loadSources", "(", "self", ")", ":", "self", ".", "confstems", "=", "{", "}", "self", ".", "sourceDict", "=", "newtrigdict", ".", "Trigdict", "(", ")", "for", "fName", "in", "self", ".", "authorityFiles", ":", "self", ".", "_loadOneSource", "(",...
creates a trigdict and populates it with data from self.autorityFiles
[ "creates", "a", "trigdict", "and", "populates", "it", "with", "data", "from", "self", ".", "autorityFiles" ]
train
https://github.com/adsabs/adsutils/blob/fb9d6b4f6ed5e6ca19c552efc3cdd6466c587fdb/adsutils/sourcematchers.py#L131-L141
ringly/django-postgres-dbdefaults
setup.py
long_description
def long_description(): """ Build the long description from a README file located in the same directory as this module. """ base_path = os.path.dirname(os.path.realpath(__file__)) with io.open(os.path.join(base_path, 'README.md'), encoding='utf-8') as f: return f.read()
python
def long_description(): """ Build the long description from a README file located in the same directory as this module. """ base_path = os.path.dirname(os.path.realpath(__file__)) with io.open(os.path.join(base_path, 'README.md'), encoding='utf-8') as f: return f.read()
[ "def", "long_description", "(", ")", ":", "base_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "base_path", ","...
Build the long description from a README file located in the same directory as this module.
[ "Build", "the", "long", "description", "from", "a", "README", "file", "located", "in", "the", "same", "directory", "as", "this", "module", "." ]
train
https://github.com/ringly/django-postgres-dbdefaults/blob/fb59ed3e77d15647831434597082fc72161ff55b/setup.py#L7-L14
toumorokoshi/jenks
jenks/subcommand/build.py
get_build_info
def get_build_info(api_instance, build_id=None, keys=DEFAULT_BUILD_KEYS, wait=False): """ print build info about a job """ build = (api_instance.get_build(build_id) if build_id else api_instance.get_last_build()) output = "" if wait: build.block_until_complete() ...
python
def get_build_info(api_instance, build_id=None, keys=DEFAULT_BUILD_KEYS, wait=False): """ print build info about a job """ build = (api_instance.get_build(build_id) if build_id else api_instance.get_last_build()) output = "" if wait: build.block_until_complete() ...
[ "def", "get_build_info", "(", "api_instance", ",", "build_id", "=", "None", ",", "keys", "=", "DEFAULT_BUILD_KEYS", ",", "wait", "=", "False", ")", ":", "build", "=", "(", "api_instance", ".", "get_build", "(", "build_id", ")", "if", "build_id", "else", "a...
print build info about a job
[ "print", "build", "info", "about", "a", "job" ]
train
https://github.com/toumorokoshi/jenks/blob/d3333a7b86ba290b7185aa5b8da75e76a28124f5/jenks/subcommand/build.py#L58-L82
racker/python-twisted-service-registry-client
utils/dist.py
_filter_names
def _filter_names(names): """ Given a list of file names, return those names that should be copied. """ names = [n for n in names if n not in EXCLUDE_NAMES] # This is needed when building a distro from a working # copy (likely a checkout) rather than a pristine export: for patte...
python
def _filter_names(names): """ Given a list of file names, return those names that should be copied. """ names = [n for n in names if n not in EXCLUDE_NAMES] # This is needed when building a distro from a working # copy (likely a checkout) rather than a pristine export: for patte...
[ "def", "_filter_names", "(", "names", ")", ":", "names", "=", "[", "n", "for", "n", "in", "names", "if", "n", "not", "in", "EXCLUDE_NAMES", "]", "# This is needed when building a distro from a working", "# copy (likely a checkout) rather than a pristine export:", "for", ...
Given a list of file names, return those names that should be copied.
[ "Given", "a", "list", "of", "file", "names", "return", "those", "names", "that", "should", "be", "copied", "." ]
train
https://github.com/racker/python-twisted-service-registry-client/blob/72adfce04c609d72f09ee2f21e9d31be12aefd80/utils/dist.py#L28-L40
racker/python-twisted-service-registry-client
utils/dist.py
relative_to
def relative_to(base, relativee): """ Gets 'relativee' relative to 'basepath'. i.e., >>> relative_to('/home/', '/home/radix/') 'radix' >>> relative_to('.', '/home/radix/Projects/Twisted') # curdir is /home/radix 'Projects/Twisted' The 'relativee' must be a child of 'basepath'. """...
python
def relative_to(base, relativee): """ Gets 'relativee' relative to 'basepath'. i.e., >>> relative_to('/home/', '/home/radix/') 'radix' >>> relative_to('.', '/home/radix/Projects/Twisted') # curdir is /home/radix 'Projects/Twisted' The 'relativee' must be a child of 'basepath'. """...
[ "def", "relative_to", "(", "base", ",", "relativee", ")", ":", "basepath", "=", "os", ".", "path", ".", "abspath", "(", "base", ")", "relativee", "=", "os", ".", "path", ".", "abspath", "(", "relativee", ")", "if", "relativee", ".", "startswith", "(", ...
Gets 'relativee' relative to 'basepath'. i.e., >>> relative_to('/home/', '/home/radix/') 'radix' >>> relative_to('.', '/home/radix/Projects/Twisted') # curdir is /home/radix 'Projects/Twisted' The 'relativee' must be a child of 'basepath'.
[ "Gets", "relativee", "relative", "to", "basepath", "." ]
train
https://github.com/racker/python-twisted-service-registry-client/blob/72adfce04c609d72f09ee2f21e9d31be12aefd80/utils/dist.py#L43-L63
racker/python-twisted-service-registry-client
utils/dist.py
get_packages
def get_packages(dname, pkgname=None, results=None, ignore=None, parent=None): """ Get all packages which are under dname. This is necessary for Python 2.2's distutils. Pretty similar arguments to getDataFiles, including 'parent'. """ parent = parent or "" prefix = [] if parent: ...
python
def get_packages(dname, pkgname=None, results=None, ignore=None, parent=None): """ Get all packages which are under dname. This is necessary for Python 2.2's distutils. Pretty similar arguments to getDataFiles, including 'parent'. """ parent = parent or "" prefix = [] if parent: ...
[ "def", "get_packages", "(", "dname", ",", "pkgname", "=", "None", ",", "results", "=", "None", ",", "ignore", "=", "None", ",", "parent", "=", "None", ")", ":", "parent", "=", "parent", "or", "\"\"", "prefix", "=", "[", "]", "if", "parent", ":", "p...
Get all packages which are under dname. This is necessary for Python 2.2's distutils. Pretty similar arguments to getDataFiles, including 'parent'.
[ "Get", "all", "packages", "which", "are", "under", "dname", ".", "This", "is", "necessary", "for", "Python", "2", ".", "2", "s", "distutils", ".", "Pretty", "similar", "arguments", "to", "getDataFiles", "including", "parent", "." ]
train
https://github.com/racker/python-twisted-service-registry-client/blob/72adfce04c609d72f09ee2f21e9d31be12aefd80/utils/dist.py#L65-L93
racker/python-twisted-service-registry-client
utils/dist.py
get_data_files
def get_data_files(dname, ignore=None, parent=None): """ Get all the data files that should be included in this distutils Project. 'dname' should be the path to the package that you're distributing. 'ignore' is a list of sub-packages to ignore. This facilitates disparate package hierarchies. Tha...
python
def get_data_files(dname, ignore=None, parent=None): """ Get all the data files that should be included in this distutils Project. 'dname' should be the path to the package that you're distributing. 'ignore' is a list of sub-packages to ignore. This facilitates disparate package hierarchies. Tha...
[ "def", "get_data_files", "(", "dname", ",", "ignore", "=", "None", ",", "parent", "=", "None", ")", ":", "parent", "=", "parent", "or", "\".\"", "ignore", "=", "ignore", "or", "[", "]", "result", "=", "[", "]", "for", "directory", ",", "subdirectories"...
Get all the data files that should be included in this distutils Project. 'dname' should be the path to the package that you're distributing. 'ignore' is a list of sub-packages to ignore. This facilitates disparate package hierarchies. That's a fancy way of saying that the 'twisted' package doesn't ...
[ "Get", "all", "the", "data", "files", "that", "should", "be", "included", "in", "this", "distutils", "Project", "." ]
train
https://github.com/racker/python-twisted-service-registry-client/blob/72adfce04c609d72f09ee2f21e9d31be12aefd80/utils/dist.py#L96-L134
cltrudeau/wrench
wrench/logtools/srothandler.py
SizeRotatingFileHandler._open
def _open(self, mode=None): """ Open the current base file with the (original) mode and encoding. Return the resulting stream. Note: Copied from stdlib. Added option to override 'mode' """ if mode is None: mode = self.mode if self.encoding i...
python
def _open(self, mode=None): """ Open the current base file with the (original) mode and encoding. Return the resulting stream. Note: Copied from stdlib. Added option to override 'mode' """ if mode is None: mode = self.mode if self.encoding i...
[ "def", "_open", "(", "self", ",", "mode", "=", "None", ")", ":", "if", "mode", "is", "None", ":", "mode", "=", "self", ".", "mode", "if", "self", ".", "encoding", "is", "None", ":", "stream", "=", "open", "(", "self", ".", "baseFilename", ",", "m...
Open the current base file with the (original) mode and encoding. Return the resulting stream. Note: Copied from stdlib. Added option to override 'mode'
[ "Open", "the", "current", "base", "file", "with", "the", "(", "original", ")", "mode", "and", "encoding", ".", "Return", "the", "resulting", "stream", ".", "Note", ":", "Copied", "from", "stdlib", ".", "Added", "option", "to", "override", "mode" ]
train
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/srothandler.py#L91-L104
cltrudeau/wrench
wrench/logtools/srothandler.py
SizeRotatingFileHandler.acquire
def acquire(self): """ Acquire thread and file locks. Re-opening log for 'degraded' mode. """ # handle thread lock if Handler: # under some tests Handler ends up being null due to instantiation # order Handler.acquire(self) # Issue a file loc...
python
def acquire(self): """ Acquire thread and file locks. Re-opening log for 'degraded' mode. """ # handle thread lock if Handler: # under some tests Handler ends up being null due to instantiation # order Handler.acquire(self) # Issue a file loc...
[ "def", "acquire", "(", "self", ")", ":", "# handle thread lock", "if", "Handler", ":", "# under some tests Handler ends up being null due to instantiation", "# order", "Handler", ".", "acquire", "(", "self", ")", "# Issue a file lock. (This is inefficient for multiple active thr...
Acquire thread and file locks. Re-opening log for 'degraded' mode.
[ "Acquire", "thread", "and", "file", "locks", ".", "Re", "-", "opening", "log", "for", "degraded", "mode", "." ]
train
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/srothandler.py#L118-L144
cltrudeau/wrench
wrench/logtools/srothandler.py
SizeRotatingFileHandler.release
def release(self): """ Release file and thread locks. If in 'degraded' mode, close the stream to reduce contention until the log files can be rotated. """ try: if self._rotateFailed: self._close() except Exception: self.handleError(NullLogRecord())...
python
def release(self): """ Release file and thread locks. If in 'degraded' mode, close the stream to reduce contention until the log files can be rotated. """ try: if self._rotateFailed: self._close() except Exception: self.handleError(NullLogRecord())...
[ "def", "release", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_rotateFailed", ":", "self", ".", "_close", "(", ")", "except", "Exception", ":", "self", ".", "handleError", "(", "NullLogRecord", "(", ")", ")", "finally", ":", "try", ":", "i...
Release file and thread locks. If in 'degraded' mode, close the stream to reduce contention until the log files can be rotated.
[ "Release", "file", "and", "thread", "locks", ".", "If", "in", "degraded", "mode", "close", "the", "stream", "to", "reduce", "contention", "until", "the", "log", "files", "can", "be", "rotated", "." ]
train
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/srothandler.py#L147-L164
cltrudeau/wrench
wrench/logtools/srothandler.py
SizeRotatingFileHandler.close
def close(self): """ Close log stream and stream_lock. """ try: self._close() if hasattr(self.stream_lock, 'closed') and \ not self.stream_lock.closed: self.stream_lock.close() finally: self.stream_lock = None ...
python
def close(self): """ Close log stream and stream_lock. """ try: self._close() if hasattr(self.stream_lock, 'closed') and \ not self.stream_lock.closed: self.stream_lock.close() finally: self.stream_lock = None ...
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "_close", "(", ")", "if", "hasattr", "(", "self", ".", "stream_lock", ",", "'closed'", ")", "and", "not", "self", ".", "stream_lock", ".", "closed", ":", "self", ".", "stream_lock", ".",...
Close log stream and stream_lock.
[ "Close", "log", "stream", "and", "stream_lock", "." ]
train
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/srothandler.py#L166-L177
cltrudeau/wrench
wrench/logtools/srothandler.py
SizeRotatingFileHandler._degrade
def _degrade(self, degrade, msg, *args): """ Set degrade mode or not. Ignore msg. """ self._rotateFailed = degrade del msg, args
python
def _degrade(self, degrade, msg, *args): """ Set degrade mode or not. Ignore msg. """ self._rotateFailed = degrade del msg, args
[ "def", "_degrade", "(", "self", ",", "degrade", ",", "msg", ",", "*", "args", ")", ":", "self", ".", "_rotateFailed", "=", "degrade", "del", "msg", ",", "args" ]
Set degrade mode or not. Ignore msg.
[ "Set", "degrade", "mode", "or", "not", ".", "Ignore", "msg", "." ]
train
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/srothandler.py#L179-L182
cltrudeau/wrench
wrench/logtools/srothandler.py
SizeRotatingFileHandler._degrade_debug
def _degrade_debug(self, degrade, msg, *args): """ A more colorful version of _degade(). (This is enabled by passing "debug=True" at initialization). """ if degrade: if not self._rotateFailed: sys.stderr.write("Degrade mode - ENTERING - (pid=%d) %s\n" % ...
python
def _degrade_debug(self, degrade, msg, *args): """ A more colorful version of _degade(). (This is enabled by passing "debug=True" at initialization). """ if degrade: if not self._rotateFailed: sys.stderr.write("Degrade mode - ENTERING - (pid=%d) %s\n" % ...
[ "def", "_degrade_debug", "(", "self", ",", "degrade", ",", "msg", ",", "*", "args", ")", ":", "if", "degrade", ":", "if", "not", "self", ".", "_rotateFailed", ":", "sys", ".", "stderr", ".", "write", "(", "\"Degrade mode - ENTERING - (pid=%d) %s\\n\"", "%",...
A more colorful version of _degade(). (This is enabled by passing "debug=True" at initialization).
[ "A", "more", "colorful", "version", "of", "_degade", "()", ".", "(", "This", "is", "enabled", "by", "passing", "debug", "=", "True", "at", "initialization", ")", "." ]
train
https://github.com/cltrudeau/wrench/blob/bc231dd085050a63a87ff3eb8f0a863928f65a41/wrench/logtools/srothandler.py#L184-L197
roboogle/gtkmvc3
gtkmvco/examples/custom_widget/htmltextview.py
_parse_css_color
def _parse_css_color(color): '''_parse_css_color(css_color) -> gtk.gdk.Color''' if color.startswith("rgb(") and color.endswith(')'): r, g, b = [int(c)*257 for c in color[4:-1].split(',')] return gtk.gdk.Color(r, g, b) else: return gtk.gdk.color_parse(color)
python
def _parse_css_color(color): '''_parse_css_color(css_color) -> gtk.gdk.Color''' if color.startswith("rgb(") and color.endswith(')'): r, g, b = [int(c)*257 for c in color[4:-1].split(',')] return gtk.gdk.Color(r, g, b) else: return gtk.gdk.color_parse(color)
[ "def", "_parse_css_color", "(", "color", ")", ":", "if", "color", ".", "startswith", "(", "\"rgb(\"", ")", "and", "color", ".", "endswith", "(", "')'", ")", ":", "r", ",", "g", ",", "b", "=", "[", "int", "(", "c", ")", "*", "257", "for", "c", "...
_parse_css_color(css_color) -> gtk.gdk.Color
[ "_parse_css_color", "(", "css_color", ")", "-", ">", "gtk", ".", "gdk", ".", "Color" ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/custom_widget/htmltextview.py#L42-L48
roboogle/gtkmvc3
gtkmvco/examples/custom_widget/htmltextview.py
HtmlHandler._parse_length
def _parse_length(self, value, font_relative, callback, *args): '''Parse/calc length, converting to pixels, calls callback(length, *args) when the length is first computed or changes''' if value.endswith('%'): frac = float(value[:-1])/100 if font_relative: ...
python
def _parse_length(self, value, font_relative, callback, *args): '''Parse/calc length, converting to pixels, calls callback(length, *args) when the length is first computed or changes''' if value.endswith('%'): frac = float(value[:-1])/100 if font_relative: ...
[ "def", "_parse_length", "(", "self", ",", "value", ",", "font_relative", ",", "callback", ",", "*", "args", ")", ":", "if", "value", ".", "endswith", "(", "'%'", ")", ":", "frac", "=", "float", "(", "value", "[", ":", "-", "1", "]", ")", "/", "10...
Parse/calc length, converting to pixels, calls callback(length, *args) when the length is first computed or changes
[ "Parse", "/", "calc", "length", "converting", "to", "pixels", "calls", "callback", "(", "length", "*", "args", ")", "when", "the", "length", "is", "first", "computed", "or", "changes" ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/examples/custom_widget/htmltextview.py#L124-L164
gevious/flask_slither
flask_slither/decorators.py
crossdomain
def crossdomain(f): """This decorator sets the rules for the crossdomain request per http method. The settings are taken from the actual resource itself, and returned as per the CORS spec. All CORS requests are rejected if the resource's `allow_methods` doesn't include the 'OPTIONS' met...
python
def crossdomain(f): """This decorator sets the rules for the crossdomain request per http method. The settings are taken from the actual resource itself, and returned as per the CORS spec. All CORS requests are rejected if the resource's `allow_methods` doesn't include the 'OPTIONS' met...
[ "def", "crossdomain", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorator", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# TODO: if a non-cors request has the origin header, this will fail", "if", "not", "self", ".", "cor...
This decorator sets the rules for the crossdomain request per http method. The settings are taken from the actual resource itself, and returned as per the CORS spec. All CORS requests are rejected if the resource's `allow_methods` doesn't include the 'OPTIONS' method.
[ "This", "decorator", "sets", "the", "rules", "for", "the", "crossdomain", "request", "per", "http", "method", ".", "The", "settings", "are", "taken", "from", "the", "actual", "resource", "itself", "and", "returned", "as", "per", "the", "CORS", "spec", "." ]
train
https://github.com/gevious/flask_slither/blob/bf1fd1e58224c19883f4b19c5f727f47ee9857da/flask_slither/decorators.py#L7-L53
gevious/flask_slither
flask_slither/decorators.py
endpoint
def endpoint(f): """This decorator marks this method as an endpoint. It is responsible for the request workflow and will call each relevant method in turn.""" def check_authentication(self, **kwargs): """If the `authentication` variable is defined and not None, the specified method wi...
python
def endpoint(f): """This decorator marks this method as an endpoint. It is responsible for the request workflow and will call each relevant method in turn.""" def check_authentication(self, **kwargs): """If the `authentication` variable is defined and not None, the specified method wi...
[ "def", "endpoint", "(", "f", ")", ":", "def", "check_authentication", "(", "self", ",", "*", "*", "kwargs", ")", ":", "\"\"\"If the `authentication` variable is defined and not None, the\n specified method will be run. On True the request will continue\n otherwise...
This decorator marks this method as an endpoint. It is responsible for the request workflow and will call each relevant method in turn.
[ "This", "decorator", "marks", "this", "method", "as", "an", "endpoint", ".", "It", "is", "responsible", "for", "the", "request", "workflow", "and", "will", "call", "each", "relevant", "method", "in", "turn", "." ]
train
https://github.com/gevious/flask_slither/blob/bf1fd1e58224c19883f4b19c5f727f47ee9857da/flask_slither/decorators.py#L56-L187
mikicz/arca
arca/_arca.py
Arca.get_backend_instance
def get_backend_instance(self, backend: BackendDefinitionType) -> BaseBackend: """ Returns a backend instance, either from the argument or from the settings. :raise ArcaMisconfigured: If the instance is not a subclass of :class:`BaseBackend` """ if backend is NOT_SET: backen...
python
def get_backend_instance(self, backend: BackendDefinitionType) -> BaseBackend: """ Returns a backend instance, either from the argument or from the settings. :raise ArcaMisconfigured: If the instance is not a subclass of :class:`BaseBackend` """ if backend is NOT_SET: backen...
[ "def", "get_backend_instance", "(", "self", ",", "backend", ":", "BackendDefinitionType", ")", "->", "BaseBackend", ":", "if", "backend", "is", "NOT_SET", ":", "backend", "=", "self", ".", "get_setting", "(", "\"backend\"", ",", "\"arca.CurrentEnvironmentBackend\"",...
Returns a backend instance, either from the argument or from the settings. :raise ArcaMisconfigured: If the instance is not a subclass of :class:`BaseBackend`
[ "Returns", "a", "backend", "instance", "either", "from", "the", "argument", "or", "from", "the", "settings", "." ]
train
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/_arca.py#L61-L78
mikicz/arca
arca/_arca.py
Arca.make_region
def make_region(self) -> CacheRegion: """ Returns a :class:`CacheRegion <dogpile.cache.region.CacheRegion>` based on settings. * Firstly, a backend is selected. The default is :class:`NullBackend <dogpile.cache.backends.null.NullBackend`. * Secondly, arguments for the backends...
python
def make_region(self) -> CacheRegion: """ Returns a :class:`CacheRegion <dogpile.cache.region.CacheRegion>` based on settings. * Firstly, a backend is selected. The default is :class:`NullBackend <dogpile.cache.backends.null.NullBackend`. * Secondly, arguments for the backends...
[ "def", "make_region", "(", "self", ")", "->", "CacheRegion", ":", "arguments", "=", "self", ".", "get_setting", "(", "\"cache_backend_arguments\"", ",", "None", ")", "def", "null_cache", "(", ")", ":", "return", "make_region", "(", ")", ".", "configure", "("...
Returns a :class:`CacheRegion <dogpile.cache.region.CacheRegion>` based on settings. * Firstly, a backend is selected. The default is :class:`NullBackend <dogpile.cache.backends.null.NullBackend`. * Secondly, arguments for the backends are generated. The arguments can be passed as a...
[ "Returns", "a", ":", "class", ":", "CacheRegion", "<dogpile", ".", "cache", ".", "region", ".", "CacheRegion", ">", "based", "on", "settings", "." ]
train
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/_arca.py#L80-L134
mikicz/arca
arca/_arca.py
Arca.validate_repo_url
def validate_repo_url(self, repo: str): """ Validates repo URL - if it's a valid git URL and if Arca can handle that type of repo URL :raise ValueError: If the URL is not valid """ # that should match valid git repos if not isinstance(repo, str) or not re.match(r"^(https?|file):...
python
def validate_repo_url(self, repo: str): """ Validates repo URL - if it's a valid git URL and if Arca can handle that type of repo URL :raise ValueError: If the URL is not valid """ # that should match valid git repos if not isinstance(repo, str) or not re.match(r"^(https?|file):...
[ "def", "validate_repo_url", "(", "self", ",", "repo", ":", "str", ")", ":", "# that should match valid git repos", "if", "not", "isinstance", "(", "repo", ",", "str", ")", "or", "not", "re", ".", "match", "(", "r\"^(https?|file)://[\\w._\\-/~]*[.git]?/?$\"", ",", ...
Validates repo URL - if it's a valid git URL and if Arca can handle that type of repo URL :raise ValueError: If the URL is not valid
[ "Validates", "repo", "URL", "-", "if", "it", "s", "a", "valid", "git", "URL", "and", "if", "Arca", "can", "handle", "that", "type", "of", "repo", "URL" ]
train
https://github.com/mikicz/arca/blob/e67fdc00be473ecf8ec16d024e1a3f2c47ca882c/arca/_arca.py#L136-L143