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 |
|---|---|---|---|---|---|---|---|---|---|---|
DEIB-GECO/PyGMQL | gmql/ml/genometric_space.py | GenometricSpace.best_descriptive_meta_dict | def best_descriptive_meta_dict(path_to_bag_of_genomes, cluster_no):
"""
Computes the importance of each metadata by using tf * coverage (the percentage of the term occuring in a cluster)
:param path_to_bag_of_genomes: The directory path
:param cluster_no: cluster number
:param p... | python | def best_descriptive_meta_dict(path_to_bag_of_genomes, cluster_no):
"""
Computes the importance of each metadata by using tf * coverage (the percentage of the term occuring in a cluster)
:param path_to_bag_of_genomes: The directory path
:param cluster_no: cluster number
:param p... | [
"def",
"best_descriptive_meta_dict",
"(",
"path_to_bag_of_genomes",
",",
"cluster_no",
")",
":",
"from",
"nltk",
".",
"corpus",
"import",
"stopwords",
"clusters",
"=",
"[",
"]",
"for",
"file",
"in",
"Parser",
".",
"_get_files",
"(",
"'.bag_of_genome'",
",",
"pat... | Computes the importance of each metadata by using tf * coverage (the percentage of the term occuring in a cluster)
:param path_to_bag_of_genomes: The directory path
:param cluster_no: cluster number
:param preprocess: to remove the redundant information from the metadata
:return: return... | [
"Computes",
"the",
"importance",
"of",
"each",
"metadata",
"by",
"using",
"tf",
"*",
"coverage",
"(",
"the",
"percentage",
"of",
"the",
"term",
"occuring",
"in",
"a",
"cluster",
")"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L251-L301 |
DEIB-GECO/PyGMQL | gmql/ml/genometric_space.py | GenometricSpace.visualize_cloud_of_words | def visualize_cloud_of_words(dictionary, image_path=None):
"""
Renders the cloud of words representation for a given dictionary of frequencies
:param dictionary: the dictionary object that contains key-frequency pairs
:param image_path: the path to the image mask, None if no masking is ... | python | def visualize_cloud_of_words(dictionary, image_path=None):
"""
Renders the cloud of words representation for a given dictionary of frequencies
:param dictionary: the dictionary object that contains key-frequency pairs
:param image_path: the path to the image mask, None if no masking is ... | [
"def",
"visualize_cloud_of_words",
"(",
"dictionary",
",",
"image_path",
"=",
"None",
")",
":",
"from",
"PIL",
"import",
"Image",
"if",
"image_path",
"is",
"not",
"None",
":",
"mask",
"=",
"np",
".",
"array",
"(",
"Image",
".",
"open",
"(",
"image_path",
... | Renders the cloud of words representation for a given dictionary of frequencies
:param dictionary: the dictionary object that contains key-frequency pairs
:param image_path: the path to the image mask, None if no masking is needed | [
"Renders",
"the",
"cloud",
"of",
"words",
"representation",
"for",
"a",
"given",
"dictionary",
"of",
"frequencies"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L304-L329 |
DEIB-GECO/PyGMQL | gmql/ml/genometric_space.py | GenometricSpace.cloud_of_words | def cloud_of_words(path_to_bog, cluster_no, image_path=None):
"""
Draws the cloud of words representation
:param path_to_bog: path to bag of words
:param cluster_no: the number of document to be visualized
:param image_path: path to the image file for the masking, None if no mas... | python | def cloud_of_words(path_to_bog, cluster_no, image_path=None):
"""
Draws the cloud of words representation
:param path_to_bog: path to bag of words
:param cluster_no: the number of document to be visualized
:param image_path: path to the image file for the masking, None if no mas... | [
"def",
"cloud_of_words",
"(",
"path_to_bog",
",",
"cluster_no",
",",
"image_path",
"=",
"None",
")",
":",
"dictionary",
"=",
"GenometricSpace",
".",
"best_descriptive_meta_dict",
"(",
"path_to_bog",
",",
"cluster_no",
")",
"GenometricSpace",
".",
"visualize_cloud_of_w... | Draws the cloud of words representation
:param path_to_bog: path to bag of words
:param cluster_no: the number of document to be visualized
:param image_path: path to the image file for the masking, None if no masking is needed | [
"Draws",
"the",
"cloud",
"of",
"words",
"representation"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/genometric_space.py#L332-L342 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser._get_files | def _get_files(extension, path):
"""
Returns a sorted list of all of the files having the same extension under the same directory
:param extension: the extension of the data files such as 'gdm'
:param path: path to the folder containing the files
:return: sorted list of files
... | python | def _get_files(extension, path):
"""
Returns a sorted list of all of the files having the same extension under the same directory
:param extension: the extension of the data files such as 'gdm'
:param path: path to the folder containing the files
:return: sorted list of files
... | [
"def",
"_get_files",
"(",
"extension",
",",
"path",
")",
":",
"# retrieves the files sharing the same extension",
"files",
"=",
"[",
"]",
"for",
"file",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
":",
"if",
"file",
".",
"endswith",
"(",
"extension",
")",
... | Returns a sorted list of all of the files having the same extension under the same directory
:param extension: the extension of the data files such as 'gdm'
:param path: path to the folder containing the files
:return: sorted list of files | [
"Returns",
"a",
"sorted",
"list",
"of",
"all",
"of",
"the",
"files",
"having",
"the",
"same",
"extension",
"under",
"the",
"same",
"directory",
":",
"param",
"extension",
":",
"the",
"extension",
"of",
"the",
"data",
"files",
"such",
"as",
"gdm",
":",
"p... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L32-L44 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser._get_schema_file | def _get_schema_file(extension, path):
"""
Returns the schema file
:param extension: extension of the schema file usually .schema
:param path: path to the folder containing the schema file
:return: the path to the schema file
"""
for file in os.listdir(path):
... | python | def _get_schema_file(extension, path):
"""
Returns the schema file
:param extension: extension of the schema file usually .schema
:param path: path to the folder containing the schema file
:return: the path to the schema file
"""
for file in os.listdir(path):
... | [
"def",
"_get_schema_file",
"(",
"extension",
",",
"path",
")",
":",
"for",
"file",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
":",
"if",
"file",
".",
"endswith",
"(",
"extension",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"path",
... | Returns the schema file
:param extension: extension of the schema file usually .schema
:param path: path to the folder containing the schema file
:return: the path to the schema file | [
"Returns",
"the",
"schema",
"file",
":",
"param",
"extension",
":",
"extension",
"of",
"the",
"schema",
"file",
"usually",
".",
"schema",
":",
"param",
"path",
":",
"path",
"to",
"the",
"folder",
"containing",
"the",
"schema",
"file",
":",
"return",
":",
... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L47-L56 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser.parse_schema | def parse_schema(schema_file):
"""
parses the schema file and returns the columns that are later going to represent the columns of the genometric space dataframe
:param schema_file: the path to the schema file
:return: the columns of the schema file
"""
e = xml.etree.Elem... | python | def parse_schema(schema_file):
"""
parses the schema file and returns the columns that are later going to represent the columns of the genometric space dataframe
:param schema_file: the path to the schema file
:return: the columns of the schema file
"""
e = xml.etree.Elem... | [
"def",
"parse_schema",
"(",
"schema_file",
")",
":",
"e",
"=",
"xml",
".",
"etree",
".",
"ElementTree",
".",
"parse",
"(",
"schema_file",
")",
"root",
"=",
"e",
".",
"getroot",
"(",
")",
"cols",
"=",
"[",
"]",
"for",
"elem",
"in",
"root",
".",
"fin... | parses the schema file and returns the columns that are later going to represent the columns of the genometric space dataframe
:param schema_file: the path to the schema file
:return: the columns of the schema file | [
"parses",
"the",
"schema",
"file",
"and",
"returns",
"the",
"columns",
"that",
"are",
"later",
"going",
"to",
"represent",
"the",
"columns",
"of",
"the",
"genometric",
"space",
"dataframe",
":",
"param",
"schema_file",
":",
"the",
"path",
"to",
"the",
"schem... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L59-L70 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser.parse_single_meta | def parse_single_meta(self, fname, selected_meta_data):
"""
Parses a single meta data file
:param fname: name of the file
:param selected_meta_data: If not none then only the specified columns of metadata are parsed
:return: the resulting pandas series
"""
# reads... | python | def parse_single_meta(self, fname, selected_meta_data):
"""
Parses a single meta data file
:param fname: name of the file
:param selected_meta_data: If not none then only the specified columns of metadata are parsed
:return: the resulting pandas series
"""
# reads... | [
"def",
"parse_single_meta",
"(",
"self",
",",
"fname",
",",
"selected_meta_data",
")",
":",
"# reads a meta data file into a dataframe",
"columns",
"=",
"[",
"]",
"data",
"=",
"[",
"]",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"for",
"line",
"in",
... | Parses a single meta data file
:param fname: name of the file
:param selected_meta_data: If not none then only the specified columns of metadata are parsed
:return: the resulting pandas series | [
"Parses",
"a",
"single",
"meta",
"data",
"file",
":",
"param",
"fname",
":",
"name",
"of",
"the",
"file",
":",
"param",
"selected_meta_data",
":",
"If",
"not",
"none",
"then",
"only",
"the",
"specified",
"columns",
"of",
"metadata",
"are",
"parsed",
":",
... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L83-L107 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser.parse_meta | def parse_meta(self, selected_meta_data):
"""
Parses all of the metadata files
:param selected_meta_data: if specified then only the columns that are contained here are going to be parsed
:return:
"""
# reads all meta data files
files = self._get_files("meta", sel... | python | def parse_meta(self, selected_meta_data):
"""
Parses all of the metadata files
:param selected_meta_data: if specified then only the columns that are contained here are going to be parsed
:return:
"""
# reads all meta data files
files = self._get_files("meta", sel... | [
"def",
"parse_meta",
"(",
"self",
",",
"selected_meta_data",
")",
":",
"# reads all meta data files",
"files",
"=",
"self",
".",
"_get_files",
"(",
"\"meta\"",
",",
"self",
".",
"path",
")",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"print",
"(",
"\"Par... | Parses all of the metadata files
:param selected_meta_data: if specified then only the columns that are contained here are going to be parsed
:return: | [
"Parses",
"all",
"of",
"the",
"metadata",
"files",
":",
"param",
"selected_meta_data",
":",
"if",
"specified",
"then",
"only",
"the",
"columns",
"that",
"are",
"contained",
"here",
"are",
"going",
"to",
"be",
"parsed",
":",
"return",
":"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L109-L126 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser.parse_single_data | def parse_single_data(self, path, cols, selected_region_data, selected_values, full_load):
"""
Parses a single region data file
:param path: path to the file
:param cols: the column names coming from the schema file
:param selected_region_data: the selected of the region data to ... | python | def parse_single_data(self, path, cols, selected_region_data, selected_values, full_load):
"""
Parses a single region data file
:param path: path to the file
:param cols: the column names coming from the schema file
:param selected_region_data: the selected of the region data to ... | [
"def",
"parse_single_data",
"(",
"self",
",",
"path",
",",
"cols",
",",
"selected_region_data",
",",
"selected_values",
",",
"full_load",
")",
":",
"# reads a sample file",
"df",
"=",
"pd",
".",
"read_table",
"(",
"path",
",",
"engine",
"=",
"'c'",
",",
"sep... | Parses a single region data file
:param path: path to the file
:param cols: the column names coming from the schema file
:param selected_region_data: the selected of the region data to be parsed
In most cases the analyst only needs a small subset of the region data
:param selecte... | [
"Parses",
"a",
"single",
"region",
"data",
"file",
":",
"param",
"path",
":",
"path",
"to",
"the",
"file",
":",
"param",
"cols",
":",
"the",
"column",
"names",
"coming",
"from",
"the",
"schema",
"file",
":",
"param",
"selected_region_data",
":",
"the",
"... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L128-L159 |
DEIB-GECO/PyGMQL | gmql/ml/dataset/parser/parser.py | Parser.parse_data | def parse_data(self, selected_region_data, selected_values, full_load=False, extension="gdm"):
"""
Parses all of the region data
:param selected_region_data: the columns of region data that are needed
:param selected_values: the selected values to be put in the matrix cells
:para... | python | def parse_data(self, selected_region_data, selected_values, full_load=False, extension="gdm"):
"""
Parses all of the region data
:param selected_region_data: the columns of region data that are needed
:param selected_values: the selected values to be put in the matrix cells
:para... | [
"def",
"parse_data",
"(",
"self",
",",
"selected_region_data",
",",
"selected_values",
",",
"full_load",
"=",
"False",
",",
"extension",
"=",
"\"gdm\"",
")",
":",
"regions",
"=",
"list",
"(",
"selected_region_data",
")",
"if",
"type",
"(",
"selected_values",
"... | Parses all of the region data
:param selected_region_data: the columns of region data that are needed
:param selected_values: the selected values to be put in the matrix cells
:param full_load: Specifies the method of parsing the data. If False then parser omits the parsing of zero(0)
... | [
"Parses",
"all",
"of",
"the",
"region",
"data",
":",
"param",
"selected_region_data",
":",
"the",
"columns",
"of",
"region",
"data",
"that",
"are",
"needed",
":",
"param",
"selected_values",
":",
"the",
"selected",
"values",
"to",
"be",
"put",
"in",
"the",
... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/ml/dataset/parser/parser.py#L161-L190 |
DEIB-GECO/PyGMQL | gmql/dataset/GDataframe.py | from_pandas | def from_pandas(regs, meta=None, chr_name=None, start_name=None, stop_name=None,
strand_name=None, sample_name=None):
""" Creates a GDataframe from a pandas dataframe of region and a pandas dataframe of metadata
:param regs: a pandas Dataframe of regions that is coherent with the GMQL data mode... | python | def from_pandas(regs, meta=None, chr_name=None, start_name=None, stop_name=None,
strand_name=None, sample_name=None):
""" Creates a GDataframe from a pandas dataframe of region and a pandas dataframe of metadata
:param regs: a pandas Dataframe of regions that is coherent with the GMQL data mode... | [
"def",
"from_pandas",
"(",
"regs",
",",
"meta",
"=",
"None",
",",
"chr_name",
"=",
"None",
",",
"start_name",
"=",
"None",
",",
"stop_name",
"=",
"None",
",",
"strand_name",
"=",
"None",
",",
"sample_name",
"=",
"None",
")",
":",
"regs",
"=",
"check_re... | Creates a GDataframe from a pandas dataframe of region and a pandas dataframe of metadata
:param regs: a pandas Dataframe of regions that is coherent with the GMQL data model
:param meta: (optional) a pandas Dataframe of metadata that is coherent with the regions
:param chr_name: (optional) which column of... | [
"Creates",
"a",
"GDataframe",
"from",
"a",
"pandas",
"dataframe",
"of",
"region",
"and",
"a",
"pandas",
"dataframe",
"of",
"metadata"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GDataframe.py#L146-L167 |
DEIB-GECO/PyGMQL | gmql/dataset/GDataframe.py | check_regs | def check_regs(region_df, chr_name=None, start_name=None, stop_name=None,
strand_name=None, sample_name=None):
""" Modifies a region dataframe to be coherent with the GMQL data model
:param region_df: a pandas Dataframe of regions that is coherent with the GMQL data model
:param chr_name: (o... | python | def check_regs(region_df, chr_name=None, start_name=None, stop_name=None,
strand_name=None, sample_name=None):
""" Modifies a region dataframe to be coherent with the GMQL data model
:param region_df: a pandas Dataframe of regions that is coherent with the GMQL data model
:param chr_name: (o... | [
"def",
"check_regs",
"(",
"region_df",
",",
"chr_name",
"=",
"None",
",",
"start_name",
"=",
"None",
",",
"stop_name",
"=",
"None",
",",
"strand_name",
"=",
"None",
",",
"sample_name",
"=",
"None",
")",
":",
"if",
"sample_name",
"is",
"None",
":",
"regio... | Modifies a region dataframe to be coherent with the GMQL data model
:param region_df: a pandas Dataframe of regions that is coherent with the GMQL data model
:param chr_name: (optional) which column of :attr:`~.region_df` is the chromosome
:param start_name: (optional) which column of :attr:`~.region_df` i... | [
"Modifies",
"a",
"region",
"dataframe",
"to",
"be",
"coherent",
"with",
"the",
"GMQL",
"data",
"model"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GDataframe.py#L170-L194 |
DEIB-GECO/PyGMQL | gmql/dataset/GDataframe.py | GDataframe.to_dataset_files | def to_dataset_files(self, local_path=None, remote_path=None):
""" Save the GDataframe to a local or remote location
:param local_path: a local path to the folder in which the data must be saved
:param remote_path: a remote dataset name that wants to be used for these data
:return: None... | python | def to_dataset_files(self, local_path=None, remote_path=None):
""" Save the GDataframe to a local or remote location
:param local_path: a local path to the folder in which the data must be saved
:param remote_path: a remote dataset name that wants to be used for these data
:return: None... | [
"def",
"to_dataset_files",
"(",
"self",
",",
"local_path",
"=",
"None",
",",
"remote_path",
"=",
"None",
")",
":",
"return",
"FrameToGMQL",
".",
"to_dataset_files",
"(",
"self",
",",
"path_local",
"=",
"local_path",
",",
"path_remote",
"=",
"remote_path",
")"
... | Save the GDataframe to a local or remote location
:param local_path: a local path to the folder in which the data must be saved
:param remote_path: a remote dataset name that wants to be used for these data
:return: None | [
"Save",
"the",
"GDataframe",
"to",
"a",
"local",
"or",
"remote",
"location"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GDataframe.py#L50-L57 |
DEIB-GECO/PyGMQL | gmql/dataset/GDataframe.py | GDataframe.to_GMQLDataset | def to_GMQLDataset(self, local_path=None, remote_path=None):
""" Converts the GDataframe in a GMQLDataset for later local or remote computation
:return: a GMQLDataset
"""
local = None
remote = None
if (local_path is None) and (remote_path is None):
# get a te... | python | def to_GMQLDataset(self, local_path=None, remote_path=None):
""" Converts the GDataframe in a GMQLDataset for later local or remote computation
:return: a GMQLDataset
"""
local = None
remote = None
if (local_path is None) and (remote_path is None):
# get a te... | [
"def",
"to_GMQLDataset",
"(",
"self",
",",
"local_path",
"=",
"None",
",",
"remote_path",
"=",
"None",
")",
":",
"local",
"=",
"None",
"remote",
"=",
"None",
"if",
"(",
"local_path",
"is",
"None",
")",
"and",
"(",
"remote_path",
"is",
"None",
")",
":",... | Converts the GDataframe in a GMQLDataset for later local or remote computation
:return: a GMQLDataset | [
"Converts",
"the",
"GDataframe",
"in",
"a",
"GMQLDataset",
"for",
"later",
"local",
"or",
"remote",
"computation"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GDataframe.py#L59-L78 |
DEIB-GECO/PyGMQL | gmql/dataset/GDataframe.py | GDataframe.project_meta | def project_meta(self, attributes):
""" Projects the specified metadata attributes to new region fields
:param attributes: a list of metadata attributes
:return: a new GDataframe with additional region fields
"""
if not isinstance(attributes, list):
raise TypeError('... | python | def project_meta(self, attributes):
""" Projects the specified metadata attributes to new region fields
:param attributes: a list of metadata attributes
:return: a new GDataframe with additional region fields
"""
if not isinstance(attributes, list):
raise TypeError('... | [
"def",
"project_meta",
"(",
"self",
",",
"attributes",
")",
":",
"if",
"not",
"isinstance",
"(",
"attributes",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"'attributes must be a list'",
")",
"meta_to_project",
"=",
"self",
".",
"meta",
"[",
"attributes",... | Projects the specified metadata attributes to new region fields
:param attributes: a list of metadata attributes
:return: a new GDataframe with additional region fields | [
"Projects",
"the",
"specified",
"metadata",
"attributes",
"to",
"new",
"region",
"fields"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GDataframe.py#L85-L95 |
DEIB-GECO/PyGMQL | gmql/dataset/GDataframe.py | GDataframe.to_matrix | def to_matrix(self, index_regs=None, index_meta=None,
columns_regs=None, columns_meta=None,
values_regs=None, values_meta=None, **kwargs):
""" Transforms the GDataframe to a pivot matrix having as index and columns the
ones specified. This function is a wrapper around... | python | def to_matrix(self, index_regs=None, index_meta=None,
columns_regs=None, columns_meta=None,
values_regs=None, values_meta=None, **kwargs):
""" Transforms the GDataframe to a pivot matrix having as index and columns the
ones specified. This function is a wrapper around... | [
"def",
"to_matrix",
"(",
"self",
",",
"index_regs",
"=",
"None",
",",
"index_meta",
"=",
"None",
",",
"columns_regs",
"=",
"None",
",",
"columns_meta",
"=",
"None",
",",
"values_regs",
"=",
"None",
",",
"values_meta",
"=",
"None",
",",
"*",
"*",
"kwargs"... | Transforms the GDataframe to a pivot matrix having as index and columns the
ones specified. This function is a wrapper around the pivot_table function of Pandas.
:param index_regs: list of region fields to use as index
:param index_meta: list of metadata attributes to use as index
:para... | [
"Transforms",
"the",
"GDataframe",
"to",
"a",
"pivot",
"matrix",
"having",
"as",
"index",
"and",
"columns",
"the",
"ones",
"specified",
".",
"This",
"function",
"is",
"a",
"wrapper",
"around",
"the",
"pivot_table",
"function",
"of",
"Pandas",
"."
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GDataframe.py#L97-L134 |
huffpostdata/python-pollster | pollster/api.py | Api.charts_get | def charts_get(self, **kwargs):
"""
Charts
Returns a list of Charts, ordered by creation date (newest first). A Chart is chosen by Pollster editors. One example is \"Obama job approval - Democrats\". It is always based upon a single Question. Users should strongly consider basing their analysi... | python | def charts_get(self, **kwargs):
"""
Charts
Returns a list of Charts, ordered by creation date (newest first). A Chart is chosen by Pollster editors. One example is \"Obama job approval - Democrats\". It is always based upon a single Question. Users should strongly consider basing their analysi... | [
"def",
"charts_get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"charts_get_with_http_info",
"(",
"*",
"*",
... | Charts
Returns a list of Charts, ordered by creation date (newest first). A Chart is chosen by Pollster editors. One example is \"Obama job approval - Democrats\". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pol... | [
"Charts",
"Returns",
"a",
"list",
"of",
"Charts",
"ordered",
"by",
"creation",
"date",
"(",
"newest",
"first",
")",
".",
"A",
"Chart",
"is",
"chosen",
"by",
"Pollster",
"editors",
".",
"One",
"example",
"is",
"\\",
"Obama",
"job",
"approval",
"-",
"Democ... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L23-L50 |
huffpostdata/python-pollster | pollster/api.py | Api.charts_slug_get | def charts_slug_get(self, slug, **kwargs):
"""
Chart
A Chart is chosen by Pollster editors. One example is \"Obama job approval - Democrats\". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster ... | python | def charts_slug_get(self, slug, **kwargs):
"""
Chart
A Chart is chosen by Pollster editors. One example is \"Obama job approval - Democrats\". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster ... | [
"def",
"charts_slug_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"charts_slug_get_with_http_inf... | Chart
A Chart is chosen by Pollster editors. One example is \"Obama job approval - Democrats\". It is always based upon a single Question. Users should strongly consider basing their analysis on Questions instead. Charts are derived data; Pollster editors publish them and change them as editorial priorities ch... | [
"Chart",
"A",
"Chart",
"is",
"chosen",
"by",
"Pollster",
"editors",
".",
"One",
"example",
"is",
"\\",
"Obama",
"job",
"approval",
"-",
"Democrats",
"\\",
".",
"It",
"is",
"always",
"based",
"upon",
"a",
"single",
"Question",
".",
"Users",
"should",
"str... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L140-L165 |
huffpostdata/python-pollster | pollster/api.py | Api.charts_slug_pollster_chart_poll_questions_tsv_get | def charts_slug_pollster_chart_poll_questions_tsv_get(self, slug, **kwargs):
"""
One row per poll plotted on a Chart
Derived data presented on a Pollster Chart. Rules for which polls and responses are plotted on a chart can shift over time. Here are some examples of behaviors Pollster has used ... | python | def charts_slug_pollster_chart_poll_questions_tsv_get(self, slug, **kwargs):
"""
One row per poll plotted on a Chart
Derived data presented on a Pollster Chart. Rules for which polls and responses are plotted on a chart can shift over time. Here are some examples of behaviors Pollster has used ... | [
"def",
"charts_slug_pollster_chart_poll_questions_tsv_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
"."... | One row per poll plotted on a Chart
Derived data presented on a Pollster Chart. Rules for which polls and responses are plotted on a chart can shift over time. Here are some examples of behaviors Pollster has used in the past: * We've omitted \"Registered Voters\" from a chart when \"Likely Voters\" respond... | [
"One",
"row",
"per",
"poll",
"plotted",
"on",
"a",
"Chart",
"Derived",
"data",
"presented",
"on",
"a",
"Pollster",
"Chart",
".",
"Rules",
"for",
"which",
"polls",
"and",
"responses",
"are",
"plotted",
"on",
"a",
"chart",
"can",
"shift",
"over",
"time",
"... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L252-L277 |
huffpostdata/python-pollster | pollster/api.py | Api.charts_slug_pollster_trendlines_tsv_get | def charts_slug_pollster_trendlines_tsv_get(self, slug, **kwargs):
"""
Estimates of what the polls suggest about trends
Derived data presented on a Pollster Chart. The trendlines on a Pollster chart don't add up to 100: we calculate each label's trendline separately. Use the `charts/{slug}` re... | python | def charts_slug_pollster_trendlines_tsv_get(self, slug, **kwargs):
"""
Estimates of what the polls suggest about trends
Derived data presented on a Pollster Chart. The trendlines on a Pollster chart don't add up to 100: we calculate each label's trendline separately. Use the `charts/{slug}` re... | [
"def",
"charts_slug_pollster_trendlines_tsv_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"chart... | Estimates of what the polls suggest about trends
Derived data presented on a Pollster Chart. The trendlines on a Pollster chart don't add up to 100: we calculate each label's trendline separately. Use the `charts/{slug}` response's `chart.pollster_estimates[0].algorithm` to find the algorithm Pollster used to... | [
"Estimates",
"of",
"what",
"the",
"polls",
"suggest",
"about",
"trends",
"Derived",
"data",
"presented",
"on",
"a",
"Pollster",
"Chart",
".",
"The",
"trendlines",
"on",
"a",
"Pollster",
"chart",
"don",
"t",
"add",
"up",
"to",
"100",
":",
"we",
"calculate",... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L379-L404 |
huffpostdata/python-pollster | pollster/api.py | Api.polls_get | def polls_get(self, **kwargs):
"""
Polls
A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include every question... | python | def polls_get(self, **kwargs):
"""
Polls
A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include every question... | [
"def",
"polls_get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"polls_get_with_http_info",
"(",
"*",
"*",
"k... | Polls
A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include every question when they enter Polls, and they don't necessarily ... | [
"Polls",
"A",
"Poll",
"on",
"Pollster",
"is",
"a",
"collection",
"of",
"questions",
"and",
"responses",
"published",
"by",
"a",
"reputable",
"survey",
"house",
".",
"This",
"endpoint",
"provides",
"raw",
"data",
"from",
"the",
"survey",
"house",
"plus",
"Pol... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L500-L528 |
huffpostdata/python-pollster | pollster/api.py | Api.polls_slug_get | def polls_slug_get(self, slug, **kwargs):
"""
Poll
A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include ever... | python | def polls_slug_get(self, slug, **kwargs):
"""
Poll
A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include ever... | [
"def",
"polls_slug_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"polls_slug_get_with_http_info"... | Poll
A Poll on Pollster is a collection of questions and responses published by a reputable survey house. This endpoint provides raw data from the survey house, plus Pollster-provided metadata about each question. Pollster editors don't include every question when they enter Polls, and they don't necessarily e... | [
"Poll",
"A",
"Poll",
"on",
"Pollster",
"is",
"a",
"collection",
"of",
"questions",
"and",
"responses",
"published",
"by",
"a",
"reputable",
"survey",
"house",
".",
"This",
"endpoint",
"provides",
"raw",
"data",
"from",
"the",
"survey",
"house",
"plus",
"Poll... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L621-L646 |
huffpostdata/python-pollster | pollster/api.py | Api.questions_get | def questions_get(self, **kwargs):
"""
Questions
Returns a list of Questions. A Question is chosen by Pollster editors. One example is \"Obama job approval\". Different survey houses may publish varying phrasings (\"Do you approve or disapprove\" vs \"What do you think of the job\") and prompt... | python | def questions_get(self, **kwargs):
"""
Questions
Returns a list of Questions. A Question is chosen by Pollster editors. One example is \"Obama job approval\". Different survey houses may publish varying phrasings (\"Do you approve or disapprove\" vs \"What do you think of the job\") and prompt... | [
"def",
"questions_get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"questions_get_with_http_info",
"(",
"*",
"... | Questions
Returns a list of Questions. A Question is chosen by Pollster editors. One example is \"Obama job approval\". Different survey houses may publish varying phrasings (\"Do you approve or disapprove\" vs \"What do you think of the job\") and prompt readers with varying responses (one poll might have \"... | [
"Questions",
"Returns",
"a",
"list",
"of",
"Questions",
".",
"A",
"Question",
"is",
"chosen",
"by",
"Pollster",
"editors",
".",
"One",
"example",
"is",
"\\",
"Obama",
"job",
"approval",
"\\",
".",
"Different",
"survey",
"houses",
"may",
"publish",
"varying",... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L733-L760 |
huffpostdata/python-pollster | pollster/api.py | Api.questions_slug_get | def questions_slug_get(self, slug, **kwargs):
"""
Question
A Question is chosen by Pollster editors. One example is \"Obama job approval\". Different survey houses may publish varying phrasings (\"Do you approve or disapprove\" vs \"What do you think of the job\") and prompt readers with varyin... | python | def questions_slug_get(self, slug, **kwargs):
"""
Question
A Question is chosen by Pollster editors. One example is \"Obama job approval\". Different survey houses may publish varying phrasings (\"Do you approve or disapprove\" vs \"What do you think of the job\") and prompt readers with varyin... | [
"def",
"questions_slug_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"questions_slug_get_with_ht... | Question
A Question is chosen by Pollster editors. One example is \"Obama job approval\". Different survey houses may publish varying phrasings (\"Do you approve or disapprove\" vs \"What do you think of the job\") and prompt readers with varying responses (one poll might have \"Approve\" and \"Disapprove\"; a... | [
"Question",
"A",
"Question",
"is",
"chosen",
"by",
"Pollster",
"editors",
".",
"One",
"example",
"is",
"\\",
"Obama",
"job",
"approval",
"\\",
".",
"Different",
"survey",
"houses",
"may",
"publish",
"varying",
"phrasings",
"(",
"\\",
"Do",
"you",
"approve",
... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L850-L875 |
huffpostdata/python-pollster | pollster/api.py | Api.questions_slug_poll_responses_clean_tsv_get | def questions_slug_poll_responses_clean_tsv_get(self, slug, **kwargs):
"""
One row of response values per PollQuestion+Subpopulation concerning the given Question
We include one TSV column per response label. See `questions/{slug}` for the Question's list of response labels, which are chosen by ... | python | def questions_slug_poll_responses_clean_tsv_get(self, slug, **kwargs):
"""
One row of response values per PollQuestion+Subpopulation concerning the given Question
We include one TSV column per response label. See `questions/{slug}` for the Question's list of response labels, which are chosen by ... | [
"def",
"questions_slug_poll_responses_clean_tsv_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"q... | One row of response values per PollQuestion+Subpopulation concerning the given Question
We include one TSV column per response label. See `questions/{slug}` for the Question's list of response labels, which are chosen by Pollster editors. Each row represents a single PollQuestion+Subpopulation. The value for ea... | [
"One",
"row",
"of",
"response",
"values",
"per",
"PollQuestion",
"+",
"Subpopulation",
"concerning",
"the",
"given",
"Question",
"We",
"include",
"one",
"TSV",
"column",
"per",
"response",
"label",
".",
"See",
"questions",
"/",
"{",
"slug",
"}",
"for",
"the"... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L962-L987 |
huffpostdata/python-pollster | pollster/api.py | Api.questions_slug_poll_responses_raw_tsv_get | def questions_slug_poll_responses_raw_tsv_get(self, slug, **kwargs):
"""
One row per PollQuestion+Subpopulation+Response concerning the given Question (Large)
Raw data from which we derived `poll-responses-clean.tsv`. Each row represents a single PollQuestion+Subpopulation+Response. See the Pol... | python | def questions_slug_poll_responses_raw_tsv_get(self, slug, **kwargs):
"""
One row per PollQuestion+Subpopulation+Response concerning the given Question (Large)
Raw data from which we derived `poll-responses-clean.tsv`. Each row represents a single PollQuestion+Subpopulation+Response. See the Pol... | [
"def",
"questions_slug_poll_responses_raw_tsv_get",
"(",
"self",
",",
"slug",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"que... | One row per PollQuestion+Subpopulation+Response concerning the given Question (Large)
Raw data from which we derived `poll-responses-clean.tsv`. Each row represents a single PollQuestion+Subpopulation+Response. See the Poll API for a description of these terms. Group results by `(poll_slug, subpopulation, que... | [
"One",
"row",
"per",
"PollQuestion",
"+",
"Subpopulation",
"+",
"Response",
"concerning",
"the",
"given",
"Question",
"(",
"Large",
")",
"Raw",
"data",
"from",
"which",
"we",
"derived",
"poll",
"-",
"responses",
"-",
"clean",
".",
"tsv",
".",
"Each",
"row"... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L1089-L1114 |
huffpostdata/python-pollster | pollster/api.py | Api.tags_get | def tags_get(self, **kwargs):
"""
Tags
Returns the list of Tags. A Tag can apply to any number of Charts and Questions; Charts and Questions, in turn, can have any number of Tags. Tags all look `like-this`: lowercase letters, numbers and hyphens.
This method makes a synchronous HTTP ... | python | def tags_get(self, **kwargs):
"""
Tags
Returns the list of Tags. A Tag can apply to any number of Charts and Questions; Charts and Questions, in turn, can have any number of Tags. Tags all look `like-this`: lowercase letters, numbers and hyphens.
This method makes a synchronous HTTP ... | [
"def",
"tags_get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"tags_get_with_http_info",
"(",
"*",
"*",
"kwa... | Tags
Returns the list of Tags. A Tag can apply to any number of Charts and Questions; Charts and Questions, in turn, can have any number of Tags. Tags all look `like-this`: lowercase letters, numbers and hyphens.
This method makes a synchronous HTTP request by default. To make an
asynchronou... | [
"Tags",
"Returns",
"the",
"list",
"of",
"Tags",
".",
"A",
"Tag",
"can",
"apply",
"to",
"any",
"number",
"of",
"Charts",
"and",
"Questions",
";",
"Charts",
"and",
"Questions",
"in",
"turn",
"can",
"have",
"any",
"number",
"of",
"Tags",
".",
"Tags",
"all... | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api.py#L1218-L1242 |
huffpostdata/python-pollster | pollster/api_client.py | ApiClient.sanitize_for_serialization | def sanitize_for_serialization(self, obj):
"""
Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sani... | python | def sanitize_for_serialization(self, obj):
"""
Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sani... | [
"def",
"sanitize_for_serialization",
"(",
"self",
",",
"obj",
")",
":",
"types",
"=",
"(",
"str",
",",
"float",
",",
"bool",
",",
"bytes",
")",
"+",
"tuple",
"(",
"integer_types",
")",
"+",
"(",
"text_type",
",",
")",
"if",
"isinstance",
"(",
"obj",
... | Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return t... | [
"Builds",
"a",
"JSON",
"POST",
"object",
"."
] | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api_client.py#L177-L219 |
huffpostdata/python-pollster | pollster/api_client.py | ApiClient.select_header_content_type | def select_header_content_type(self, content_types):
"""
Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'applicat... | python | def select_header_content_type(self, content_types):
"""
Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'applicat... | [
"def",
"select_header_content_type",
"(",
"self",
",",
"content_types",
")",
":",
"if",
"not",
"content_types",
":",
"return",
"'application/json'",
"content_types",
"=",
"list",
"(",
"map",
"(",
"lambda",
"x",
":",
"x",
".",
"lower",
"(",
")",
",",
"content... | Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json). | [
"Returns",
"Content",
"-",
"Type",
"based",
"on",
"an",
"array",
"of",
"content_types",
"provided",
"."
] | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api_client.py#L491-L506 |
huffpostdata/python-pollster | pollster/api_client.py | ApiClient.__deserialize_model | def __deserialize_model(self, data, klass):
"""
Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object.
"""
instance = klass()
if not instance.swagger_types:
return data
for at... | python | def __deserialize_model(self, data, klass):
"""
Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object.
"""
instance = klass()
if not instance.swagger_types:
return data
for at... | [
"def",
"__deserialize_model",
"(",
"self",
",",
"data",
",",
"klass",
")",
":",
"instance",
"=",
"klass",
"(",
")",
"if",
"not",
"instance",
".",
"swagger_types",
":",
"return",
"data",
"for",
"attr",
",",
"attr_type",
"in",
"iteritems",
"(",
"instance",
... | Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object. | [
"Deserializes",
"list",
"or",
"dict",
"to",
"model",
"."
] | train | https://github.com/huffpostdata/python-pollster/blob/276de8d66a92577b1143fd92a70cff9c35a1dfcf/pollster/api_client.py#L626-L646 |
PragmaticMates/django-flatpages-i18n | flatpages_i18n/views.py | flatpage | def flatpage(request, url):
"""
Public interface to the flat page view.
Models: `flatpages.flatpages`
Templates: Uses the template defined by the ``template_name`` field,
or `flatpages/default.html` if template_name is not defined.
Context:
flatpage
`flatpages.flatpages`... | python | def flatpage(request, url):
"""
Public interface to the flat page view.
Models: `flatpages.flatpages`
Templates: Uses the template defined by the ``template_name`` field,
or `flatpages/default.html` if template_name is not defined.
Context:
flatpage
`flatpages.flatpages`... | [
"def",
"flatpage",
"(",
"request",
",",
"url",
")",
":",
"if",
"not",
"url",
".",
"startswith",
"(",
"'/'",
")",
":",
"url",
"=",
"'/'",
"+",
"url",
"language",
"=",
"request",
".",
"LANGUAGE_CODE",
"language_prefix",
"=",
"'/%s'",
"%",
"language",
"la... | Public interface to the flat page view.
Models: `flatpages.flatpages`
Templates: Uses the template defined by the ``template_name`` field,
or `flatpages/default.html` if template_name is not defined.
Context:
flatpage
`flatpages.flatpages` object | [
"Public",
"interface",
"to",
"the",
"flat",
"page",
"view",
"."
] | train | https://github.com/PragmaticMates/django-flatpages-i18n/blob/2d3ed45c14fb0c7fd6ff5263c84f501c6a0c3e9a/flatpages_i18n/views.py#L28-L65 |
PragmaticMates/django-flatpages-i18n | flatpages_i18n/views.py | render_flatpage | def render_flatpage(request, f):
"""
Internal interface to the flat page view.
"""
# If registration is required for accessing this page, and the user isn't
# logged in, redirect to the login page.
if f.registration_required and not request.user.is_authenticated():
from django.contrib.au... | python | def render_flatpage(request, f):
"""
Internal interface to the flat page view.
"""
# If registration is required for accessing this page, and the user isn't
# logged in, redirect to the login page.
if f.registration_required and not request.user.is_authenticated():
from django.contrib.au... | [
"def",
"render_flatpage",
"(",
"request",
",",
"f",
")",
":",
"# If registration is required for accessing this page, and the user isn't",
"# logged in, redirect to the login page.",
"if",
"f",
".",
"registration_required",
"and",
"not",
"request",
".",
"user",
".",
"is_authe... | Internal interface to the flat page view. | [
"Internal",
"interface",
"to",
"the",
"flat",
"page",
"view",
"."
] | train | https://github.com/PragmaticMates/django-flatpages-i18n/blob/2d3ed45c14fb0c7fd6ff5263c84f501c6a0c3e9a/flatpages_i18n/views.py#L69-L98 |
kevinconway/daemons | daemons/interfaces/pid.py | PidManager.pidfile | def pidfile(self):
"""Get the absolute path of the pidfile."""
return os.path.abspath(
os.path.expandvars(
os.path.expanduser(
self._pidfile,
),
),
) | python | def pidfile(self):
"""Get the absolute path of the pidfile."""
return os.path.abspath(
os.path.expandvars(
os.path.expanduser(
self._pidfile,
),
),
) | [
"def",
"pidfile",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expandvars",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"self",
".",
"_pidfile",
",",
")",
",",
")",
",",
")"
] | Get the absolute path of the pidfile. | [
"Get",
"the",
"absolute",
"path",
"of",
"the",
"pidfile",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/interfaces/pid.py#L25-L33 |
DEIB-GECO/PyGMQL | gmql/dataset/DataStructures/ExpressionNodes.py | SQRT | def SQRT(argument):
""" Computes the square matrix of the argument
:param argument: a dataset region field (dataset.field) or metadata (dataset['field'])
"""
if isinstance(argument, MetaField):
return argument._unary_expression("SQRT")
elif isinstance(argument, RegField):
return arg... | python | def SQRT(argument):
""" Computes the square matrix of the argument
:param argument: a dataset region field (dataset.field) or metadata (dataset['field'])
"""
if isinstance(argument, MetaField):
return argument._unary_expression("SQRT")
elif isinstance(argument, RegField):
return arg... | [
"def",
"SQRT",
"(",
"argument",
")",
":",
"if",
"isinstance",
"(",
"argument",
",",
"MetaField",
")",
":",
"return",
"argument",
".",
"_unary_expression",
"(",
"\"SQRT\"",
")",
"elif",
"isinstance",
"(",
"argument",
",",
"RegField",
")",
":",
"return",
"ar... | Computes the square matrix of the argument
:param argument: a dataset region field (dataset.field) or metadata (dataset['field']) | [
"Computes",
"the",
"square",
"matrix",
"of",
"the",
"argument"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/DataStructures/ExpressionNodes.py#L5-L16 |
DEIB-GECO/PyGMQL | gmql/managers.py | login | def login():
""" Enables the user to login to the remote GMQL service.
If both username and password are None, the user will be connected as guest.
"""
from .RemoteConnection.RemoteManager import RemoteManager
global __remote_manager, __session_manager
logger = logging.getLogger()
remote_ad... | python | def login():
""" Enables the user to login to the remote GMQL service.
If both username and password are None, the user will be connected as guest.
"""
from .RemoteConnection.RemoteManager import RemoteManager
global __remote_manager, __session_manager
logger = logging.getLogger()
remote_ad... | [
"def",
"login",
"(",
")",
":",
"from",
".",
"RemoteConnection",
".",
"RemoteManager",
"import",
"RemoteManager",
"global",
"__remote_manager",
",",
"__session_manager",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"remote_address",
"=",
"get_remote_address"... | Enables the user to login to the remote GMQL service.
If both username and password are None, the user will be connected as guest. | [
"Enables",
"the",
"user",
"to",
"login",
"to",
"the",
"remote",
"GMQL",
"service",
".",
"If",
"both",
"username",
"and",
"password",
"are",
"None",
"the",
"user",
"will",
"be",
"connected",
"as",
"guest",
"."
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/managers.py#L205-L233 |
kevinconway/daemons | samples/wrapper.py | main | def main(idle):
"""Any normal python logic which runs a loop. Can take arguments."""
while True:
LOG.debug("Sleeping for {0} seconds.".format(idle))
time.sleep(idle) | python | def main(idle):
"""Any normal python logic which runs a loop. Can take arguments."""
while True:
LOG.debug("Sleeping for {0} seconds.".format(idle))
time.sleep(idle) | [
"def",
"main",
"(",
"idle",
")",
":",
"while",
"True",
":",
"LOG",
".",
"debug",
"(",
"\"Sleeping for {0} seconds.\"",
".",
"format",
"(",
"idle",
")",
")",
"time",
".",
"sleep",
"(",
"idle",
")"
] | Any normal python logic which runs a loop. Can take arguments. | [
"Any",
"normal",
"python",
"logic",
"which",
"runs",
"a",
"loop",
".",
"Can",
"take",
"arguments",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/samples/wrapper.py#L28-L33 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.get_metadata | def get_metadata(self):
""" Returns the metadata related to the current GMQLDataset. This function can be used only
when a local dataset is loaded using the :meth:`~gmql.dataset.loaders.Loader.load_from_path` and no other
operation has been called on the GMQLDataset.
The metadata are re... | python | def get_metadata(self):
""" Returns the metadata related to the current GMQLDataset. This function can be used only
when a local dataset is loaded using the :meth:`~gmql.dataset.loaders.Loader.load_from_path` and no other
operation has been called on the GMQLDataset.
The metadata are re... | [
"def",
"get_metadata",
"(",
"self",
")",
":",
"if",
"self",
".",
"path_or_name",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"You cannot explore the metadata of an intermediate query.\"",
"\"You can get metadata only after a load_from_local or load_from_remote\"",
")",
"if... | Returns the metadata related to the current GMQLDataset. This function can be used only
when a local dataset is loaded using the :meth:`~gmql.dataset.loaders.Loader.load_from_path` and no other
operation has been called on the GMQLDataset.
The metadata are returned in the form of a Pandas Dataf... | [
"Returns",
"the",
"metadata",
"related",
"to",
"the",
"current",
"GMQLDataset",
".",
"This",
"function",
"can",
"be",
"used",
"only",
"when",
"a",
"local",
"dataset",
"is",
"loaded",
"using",
"the",
":",
"meth",
":",
"~gmql",
".",
"dataset",
".",
"loaders"... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L88-L104 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.MetaField | def MetaField(self, name, t=None):
"""
Creates an instance of a metadata field of the dataset. It can be used in building expressions
or conditions for projection or selection.
Notice that this function is equivalent to call::
dataset["name"]
If the Meta... | python | def MetaField(self, name, t=None):
"""
Creates an instance of a metadata field of the dataset. It can be used in building expressions
or conditions for projection or selection.
Notice that this function is equivalent to call::
dataset["name"]
If the Meta... | [
"def",
"MetaField",
"(",
"self",
",",
"name",
",",
"t",
"=",
"None",
")",
":",
"return",
"MetaField",
"(",
"name",
"=",
"name",
",",
"index",
"=",
"self",
".",
"__index",
",",
"t",
"=",
"t",
")"
] | Creates an instance of a metadata field of the dataset. It can be used in building expressions
or conditions for projection or selection.
Notice that this function is equivalent to call::
dataset["name"]
If the MetaField is used in a region projection (:meth:`~.reg_proj... | [
"Creates",
"an",
"instance",
"of",
"a",
"metadata",
"field",
"of",
"the",
"dataset",
".",
"It",
"can",
"be",
"used",
"in",
"building",
"expressions",
"or",
"conditions",
"for",
"projection",
"or",
"selection",
".",
"Notice",
"that",
"this",
"function",
"is",... | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L121-L139 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.select | def select(self, meta_predicate=None, region_predicate=None,
semiJoinDataset=None, semiJoinMeta=None):
""" *Wrapper of* ``SELECT``
Selection operation. Enables to filter datasets on the basis of region features or metadata attributes. In
addition it is possibile to perform a sel... | python | def select(self, meta_predicate=None, region_predicate=None,
semiJoinDataset=None, semiJoinMeta=None):
""" *Wrapper of* ``SELECT``
Selection operation. Enables to filter datasets on the basis of region features or metadata attributes. In
addition it is possibile to perform a sel... | [
"def",
"select",
"(",
"self",
",",
"meta_predicate",
"=",
"None",
",",
"region_predicate",
"=",
"None",
",",
"semiJoinDataset",
"=",
"None",
",",
"semiJoinMeta",
"=",
"None",
")",
":",
"semiJoinDataset_exists",
"=",
"False",
"if",
"isinstance",
"(",
"meta_pred... | *Wrapper of* ``SELECT``
Selection operation. Enables to filter datasets on the basis of region features or metadata attributes. In
addition it is possibile to perform a selection based on the existence of certain metadata
:attr:`~.semiJoinMeta` attributes and the matching of their values with t... | [
"*",
"Wrapper",
"of",
"*",
"SELECT"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L154-L243 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.meta_select | def meta_select(self, predicate=None, semiJoinDataset=None, semiJoinMeta=None):
"""
*Wrapper of* ``SELECT``
Wrapper of the :meth:`~.select` function filtering samples only based on metadata.
:param predicate: logical predicate on the values of the rows
:param semiJoinDataset: a... | python | def meta_select(self, predicate=None, semiJoinDataset=None, semiJoinMeta=None):
"""
*Wrapper of* ``SELECT``
Wrapper of the :meth:`~.select` function filtering samples only based on metadata.
:param predicate: logical predicate on the values of the rows
:param semiJoinDataset: a... | [
"def",
"meta_select",
"(",
"self",
",",
"predicate",
"=",
"None",
",",
"semiJoinDataset",
"=",
"None",
",",
"semiJoinMeta",
"=",
"None",
")",
":",
"return",
"self",
".",
"select",
"(",
"meta_predicate",
"=",
"predicate",
",",
"semiJoinDataset",
"=",
"semiJoi... | *Wrapper of* ``SELECT``
Wrapper of the :meth:`~.select` function filtering samples only based on metadata.
:param predicate: logical predicate on the values of the rows
:param semiJoinDataset: an other GMQLDataset
:param semiJoinMeta: a list of metadata
:return: a new GMQLData... | [
"*",
"Wrapper",
"of",
"*",
"SELECT"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L245-L282 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.reg_select | def reg_select(self, predicate=None, semiJoinDataset=None, semiJoinMeta=None):
"""
*Wrapper of* ``SELECT``
Wrapper of the :meth:`~.select` function filtering regions only based on region attributes.
:param predicate: logical predicate on the values of the regions
:param semiJoi... | python | def reg_select(self, predicate=None, semiJoinDataset=None, semiJoinMeta=None):
"""
*Wrapper of* ``SELECT``
Wrapper of the :meth:`~.select` function filtering regions only based on region attributes.
:param predicate: logical predicate on the values of the regions
:param semiJoi... | [
"def",
"reg_select",
"(",
"self",
",",
"predicate",
"=",
"None",
",",
"semiJoinDataset",
"=",
"None",
",",
"semiJoinMeta",
"=",
"None",
")",
":",
"return",
"self",
".",
"select",
"(",
"region_predicate",
"=",
"predicate",
",",
"semiJoinMeta",
"=",
"semiJoinM... | *Wrapper of* ``SELECT``
Wrapper of the :meth:`~.select` function filtering regions only based on region attributes.
:param predicate: logical predicate on the values of the regions
:param semiJoinDataset: an other GMQLDataset
:param semiJoinMeta: a list of metadata
:return: a ... | [
"*",
"Wrapper",
"of",
"*",
"SELECT"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L284-L313 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.project | def project(self, projected_meta=None, new_attr_dict=None, all_but_meta=None,
projected_regs=None, new_field_dict=None, all_but_regs=None):
"""
*Wrapper of* ``PROJECT``
The PROJECT operator creates, from an existing dataset, a new dataset with all the samples
(with their... | python | def project(self, projected_meta=None, new_attr_dict=None, all_but_meta=None,
projected_regs=None, new_field_dict=None, all_but_regs=None):
"""
*Wrapper of* ``PROJECT``
The PROJECT operator creates, from an existing dataset, a new dataset with all the samples
(with their... | [
"def",
"project",
"(",
"self",
",",
"projected_meta",
"=",
"None",
",",
"new_attr_dict",
"=",
"None",
",",
"all_but_meta",
"=",
"None",
",",
"projected_regs",
"=",
"None",
",",
"new_field_dict",
"=",
"None",
",",
"all_but_regs",
"=",
"None",
")",
":",
"pro... | *Wrapper of* ``PROJECT``
The PROJECT operator creates, from an existing dataset, a new dataset with all the samples
(with their regions and region values) in the input one, but keeping for each sample in the input
dataset only those metadata and/or region attributes expressed in the operator pa... | [
"*",
"Wrapper",
"of",
"*",
"PROJECT"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L315-L449 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.meta_project | def meta_project(self, attr_list=None, all_but=None, new_attr_dict=None):
"""
*Wrapper of* ``PROJECT``
Project the metadata based on a list of attribute names
:param attr_list: list of the metadata fields to select
:param all_but: list of metadata that must be excluded ... | python | def meta_project(self, attr_list=None, all_but=None, new_attr_dict=None):
"""
*Wrapper of* ``PROJECT``
Project the metadata based on a list of attribute names
:param attr_list: list of the metadata fields to select
:param all_but: list of metadata that must be excluded ... | [
"def",
"meta_project",
"(",
"self",
",",
"attr_list",
"=",
"None",
",",
"all_but",
"=",
"None",
",",
"new_attr_dict",
"=",
"None",
")",
":",
"return",
"self",
".",
"project",
"(",
"projected_meta",
"=",
"attr_list",
",",
"new_attr_dict",
"=",
"new_attr_dict"... | *Wrapper of* ``PROJECT``
Project the metadata based on a list of attribute names
:param attr_list: list of the metadata fields to select
:param all_but: list of metadata that must be excluded from the projection.
:param new_attr_dict: an optional dictionary of the form {'new_fi... | [
"*",
"Wrapper",
"of",
"*",
"PROJECT"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L451-L472 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.reg_project | def reg_project(self, field_list=None, all_but=None, new_field_dict=None):
"""
*Wrapper of* ``PROJECT``
Project the region data based on a list of field names
:param field_list: list of the fields to select
:param all_but: keep only the region fields different from the ones
... | python | def reg_project(self, field_list=None, all_but=None, new_field_dict=None):
"""
*Wrapper of* ``PROJECT``
Project the region data based on a list of field names
:param field_list: list of the fields to select
:param all_but: keep only the region fields different from the ones
... | [
"def",
"reg_project",
"(",
"self",
",",
"field_list",
"=",
"None",
",",
"all_but",
"=",
"None",
",",
"new_field_dict",
"=",
"None",
")",
":",
"return",
"self",
".",
"project",
"(",
"projected_regs",
"=",
"field_list",
",",
"all_but_regs",
"=",
"all_but",
"... | *Wrapper of* ``PROJECT``
Project the region data based on a list of field names
:param field_list: list of the fields to select
:param all_but: keep only the region fields different from the ones
specified
:param new_field_dict: an optional dictionary of the form {'new_f... | [
"*",
"Wrapper",
"of",
"*",
"PROJECT"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L474-L504 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.extend | def extend(self, new_attr_dict):
"""
*Wrapper of* ``EXTEND``
For each sample in an input dataset, the EXTEND operator builds new metadata attributes,
assigns their values as the result of arithmetic and/or aggregate functions calculated on
sample region attributes, and adds the... | python | def extend(self, new_attr_dict):
"""
*Wrapper of* ``EXTEND``
For each sample in an input dataset, the EXTEND operator builds new metadata attributes,
assigns their values as the result of arithmetic and/or aggregate functions calculated on
sample region attributes, and adds the... | [
"def",
"extend",
"(",
"self",
",",
"new_attr_dict",
")",
":",
"if",
"isinstance",
"(",
"new_attr_dict",
",",
"dict",
")",
":",
"expBuild",
"=",
"self",
".",
"pmg",
".",
"getNewExpressionBuilder",
"(",
"self",
".",
"__index",
")",
"aggregates",
"=",
"[",
... | *Wrapper of* ``EXTEND``
For each sample in an input dataset, the EXTEND operator builds new metadata attributes,
assigns their values as the result of arithmetic and/or aggregate functions calculated on
sample region attributes, and adds them to the existing metadata attribute-value pairs of
... | [
"*",
"Wrapper",
"of",
"*",
"EXTEND"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L506-L552 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.cover | def cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None, cover_type="normal"):
"""
*Wrapper of* ``COVER``
COVER is a GMQL operator that takes as input a dataset (of usually,
but not necessarily, multiple samples) and returns another dataset
(with a single sample, if ... | python | def cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None, cover_type="normal"):
"""
*Wrapper of* ``COVER``
COVER is a GMQL operator that takes as input a dataset (of usually,
but not necessarily, multiple samples) and returns another dataset
(with a single sample, if ... | [
"def",
"cover",
"(",
"self",
",",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
"=",
"None",
",",
"new_reg_fields",
"=",
"None",
",",
"cover_type",
"=",
"\"normal\"",
")",
":",
"if",
"isinstance",
"(",
"cover_type",
",",
"str",
")",
":",
"coverFlag",
"=",
"... | *Wrapper of* ``COVER``
COVER is a GMQL operator that takes as input a dataset (of usually,
but not necessarily, multiple samples) and returns another dataset
(with a single sample, if no groupby option is specified) by “collapsing”
the input samples and their regions according to cert... | [
"*",
"Wrapper",
"of",
"*",
"COVER"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L554-L650 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.normal_cover | def normal_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
The normal cover operation as described in :meth:`~.cover`.
Equivalent to calling::
dataset.cover("normal", ...)
"""
return self.cover(minAcc, maxAc... | python | def normal_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
The normal cover operation as described in :meth:`~.cover`.
Equivalent to calling::
dataset.cover("normal", ...)
"""
return self.cover(minAcc, maxAc... | [
"def",
"normal_cover",
"(",
"self",
",",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
"=",
"None",
",",
"new_reg_fields",
"=",
"None",
")",
":",
"return",
"self",
".",
"cover",
"(",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
",",
"new_reg_fields",
",",
"cover_... | *Wrapper of* ``COVER``
The normal cover operation as described in :meth:`~.cover`.
Equivalent to calling::
dataset.cover("normal", ...) | [
"*",
"Wrapper",
"of",
"*",
"COVER"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L652-L661 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.flat_cover | def flat_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns the union of all the regions
which contribute to the COVER. More precisely, it returns the contiguous regions
that start fro... | python | def flat_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns the union of all the regions
which contribute to the COVER. More precisely, it returns the contiguous regions
that start fro... | [
"def",
"flat_cover",
"(",
"self",
",",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
"=",
"None",
",",
"new_reg_fields",
"=",
"None",
")",
":",
"return",
"self",
".",
"cover",
"(",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
",",
"new_reg_fields",
",",
"cover_ty... | *Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns the union of all the regions
which contribute to the COVER. More precisely, it returns the contiguous regions
that start from the first end and stop at the last end of the regions which would
contribute to ea... | [
"*",
"Wrapper",
"of",
"*",
"COVER"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L663-L676 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.summit_cover | def summit_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns only those portions of the COVER
result where the maximum number of regions overlap (this is done by returning only
regions ... | python | def summit_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns only those portions of the COVER
result where the maximum number of regions overlap (this is done by returning only
regions ... | [
"def",
"summit_cover",
"(",
"self",
",",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
"=",
"None",
",",
"new_reg_fields",
"=",
"None",
")",
":",
"return",
"self",
".",
"cover",
"(",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
",",
"new_reg_fields",
",",
"cover_... | *Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns only those portions of the COVER
result where the maximum number of regions overlap (this is done by returning only
regions that start from a position after which the number of overlaps does not
increase, and s... | [
"*",
"Wrapper",
"of",
"*",
"COVER"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L678-L692 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.histogram_cover | def histogram_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns all regions contributing to
the COVER divided in different (contiguous) parts according to their accumulation
index val... | python | def histogram_cover(self, minAcc, maxAcc, groupBy=None, new_reg_fields=None):
"""
*Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns all regions contributing to
the COVER divided in different (contiguous) parts according to their accumulation
index val... | [
"def",
"histogram_cover",
"(",
"self",
",",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
"=",
"None",
",",
"new_reg_fields",
"=",
"None",
")",
":",
"return",
"self",
".",
"cover",
"(",
"minAcc",
",",
"maxAcc",
",",
"groupBy",
",",
"new_reg_fields",
",",
"cov... | *Wrapper of* ``COVER``
Variant of the function :meth:`~.cover` that returns all regions contributing to
the COVER divided in different (contiguous) parts according to their accumulation
index value (one part for each different accumulation value), which is assigned to
the AccIndex re... | [
"*",
"Wrapper",
"of",
"*",
"COVER"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L694-L707 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.join | def join(self, experiment, genometric_predicate, output="LEFT", joinBy=None,
refName="REF", expName="EXP", left_on=None, right_on=None):
"""
*Wrapper of* ``JOIN``
The JOIN operator takes in input two datasets, respectively known as anchor
(the first/left one) and experiment... | python | def join(self, experiment, genometric_predicate, output="LEFT", joinBy=None,
refName="REF", expName="EXP", left_on=None, right_on=None):
"""
*Wrapper of* ``JOIN``
The JOIN operator takes in input two datasets, respectively known as anchor
(the first/left one) and experiment... | [
"def",
"join",
"(",
"self",
",",
"experiment",
",",
"genometric_predicate",
",",
"output",
"=",
"\"LEFT\"",
",",
"joinBy",
"=",
"None",
",",
"refName",
"=",
"\"REF\"",
",",
"expName",
"=",
"\"EXP\"",
",",
"left_on",
"=",
"None",
",",
"right_on",
"=",
"No... | *Wrapper of* ``JOIN``
The JOIN operator takes in input two datasets, respectively known as anchor
(the first/left one) and experiment (the second/right one) and returns a
dataset of samples consisting of regions extracted from the operands
according to the specified condition (known as... | [
"*",
"Wrapper",
"of",
"*",
"JOIN"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L709-L827 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.map | def map(self, experiment, new_reg_fields=None, joinBy=None, refName="REF", expName="EXP"):
"""
*Wrapper of* ``MAP``
MAP is a non-symmetric operator over two datasets, respectively called
reference and experiment. The operation computes, for each sample in
the experiment dataset... | python | def map(self, experiment, new_reg_fields=None, joinBy=None, refName="REF", expName="EXP"):
"""
*Wrapper of* ``MAP``
MAP is a non-symmetric operator over two datasets, respectively called
reference and experiment. The operation computes, for each sample in
the experiment dataset... | [
"def",
"map",
"(",
"self",
",",
"experiment",
",",
"new_reg_fields",
"=",
"None",
",",
"joinBy",
"=",
"None",
",",
"refName",
"=",
"\"REF\"",
",",
"expName",
"=",
"\"EXP\"",
")",
":",
"if",
"isinstance",
"(",
"experiment",
",",
"GMQLDataset",
")",
":",
... | *Wrapper of* ``MAP``
MAP is a non-symmetric operator over two datasets, respectively called
reference and experiment. The operation computes, for each sample in
the experiment dataset, aggregates over the values of the experiment
regions that intersect with a region in a reference sam... | [
"*",
"Wrapper",
"of",
"*",
"MAP"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L829-L932 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.order | def order(self, meta=None, meta_ascending=None, meta_top=None, meta_k=None,
regs=None, regs_ascending=None, region_top=None, region_k=None):
"""
*Wrapper of* ``ORDER``
The ORDER operator is used to order either samples, sample regions, or both,
in a dataset according to a ... | python | def order(self, meta=None, meta_ascending=None, meta_top=None, meta_k=None,
regs=None, regs_ascending=None, region_top=None, region_k=None):
"""
*Wrapper of* ``ORDER``
The ORDER operator is used to order either samples, sample regions, or both,
in a dataset according to a ... | [
"def",
"order",
"(",
"self",
",",
"meta",
"=",
"None",
",",
"meta_ascending",
"=",
"None",
",",
"meta_top",
"=",
"None",
",",
"meta_k",
"=",
"None",
",",
"regs",
"=",
"None",
",",
"regs_ascending",
"=",
"None",
",",
"region_top",
"=",
"None",
",",
"r... | *Wrapper of* ``ORDER``
The ORDER operator is used to order either samples, sample regions, or both,
in a dataset according to a set of metadata and/or region attributes, and/or
region coordinates. The number of samples and their regions in the output dataset
is as in the input dataset... | [
"*",
"Wrapper",
"of",
"*",
"ORDER"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L934-L1073 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.difference | def difference(self, other, joinBy=None, exact=False):
"""
*Wrapper of* ``DIFFERENCE``
DIFFERENCE is a binary, non-symmetric operator that produces one sample
in the result for each sample of the first operand, by keeping the same
metadata of the first operand sample and only th... | python | def difference(self, other, joinBy=None, exact=False):
"""
*Wrapper of* ``DIFFERENCE``
DIFFERENCE is a binary, non-symmetric operator that produces one sample
in the result for each sample of the first operand, by keeping the same
metadata of the first operand sample and only th... | [
"def",
"difference",
"(",
"self",
",",
"other",
",",
"joinBy",
"=",
"None",
",",
"exact",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"GMQLDataset",
")",
":",
"other_idx",
"=",
"other",
".",
"__index",
"else",
":",
"raise",
"TypeErro... | *Wrapper of* ``DIFFERENCE``
DIFFERENCE is a binary, non-symmetric operator that produces one sample
in the result for each sample of the first operand, by keeping the same
metadata of the first operand sample and only those regions (with their
schema and values) of the first operand sam... | [
"*",
"Wrapper",
"of",
"*",
"DIFFERENCE"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1075-L1131 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.union | def union(self, other, left_name="LEFT", right_name="RIGHT"):
"""
*Wrapper of* ``UNION``
The UNION operation is used to integrate homogeneous or heterogeneous samples of two
datasets within a single dataset; for each sample of either one of the input datasets, a
sample is create... | python | def union(self, other, left_name="LEFT", right_name="RIGHT"):
"""
*Wrapper of* ``UNION``
The UNION operation is used to integrate homogeneous or heterogeneous samples of two
datasets within a single dataset; for each sample of either one of the input datasets, a
sample is create... | [
"def",
"union",
"(",
"self",
",",
"other",
",",
"left_name",
"=",
"\"LEFT\"",
",",
"right_name",
"=",
"\"RIGHT\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"left_name",
",",
"str",
")",
"or",
"not",
"isinstance",
"(",
"right_name",
",",
"str",
")",
":... | *Wrapper of* ``UNION``
The UNION operation is used to integrate homogeneous or heterogeneous samples of two
datasets within a single dataset; for each sample of either one of the input datasets, a
sample is created in the result as follows:
* its metadata are the same as in... | [
"*",
"Wrapper",
"of",
"*",
"UNION"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1133-L1182 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.merge | def merge(self, groupBy=None):
"""
*Wrapper of* ``MERGE``
The MERGE operator builds a new dataset consisting of a single sample having
* as regions all the regions of all the input samples, with the
same attributes and values
* as metadata the uni... | python | def merge(self, groupBy=None):
"""
*Wrapper of* ``MERGE``
The MERGE operator builds a new dataset consisting of a single sample having
* as regions all the regions of all the input samples, with the
same attributes and values
* as metadata the uni... | [
"def",
"merge",
"(",
"self",
",",
"groupBy",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"groupBy",
",",
"list",
")",
"and",
"all",
"(",
"[",
"isinstance",
"(",
"x",
",",
"str",
")",
"for",
"x",
"in",
"groupBy",
"]",
")",
":",
"groupBy",
"=",... | *Wrapper of* ``MERGE``
The MERGE operator builds a new dataset consisting of a single sample having
* as regions all the regions of all the input samples, with the
same attributes and values
* as metadata the union of all the metadata attribute-values
... | [
"*",
"Wrapper",
"of",
"*",
"MERGE"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1184-L1225 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.group | def group(self, meta=None, meta_aggregates=None, regs=None,
regs_aggregates=None, meta_group_name="_group"):
"""
*Wrapper of* ``GROUP``
The GROUP operator is used for grouping both regions and/or metadata of input
dataset samples according to distinct values of certain att... | python | def group(self, meta=None, meta_aggregates=None, regs=None,
regs_aggregates=None, meta_group_name="_group"):
"""
*Wrapper of* ``GROUP``
The GROUP operator is used for grouping both regions and/or metadata of input
dataset samples according to distinct values of certain att... | [
"def",
"group",
"(",
"self",
",",
"meta",
"=",
"None",
",",
"meta_aggregates",
"=",
"None",
",",
"regs",
"=",
"None",
",",
"regs_aggregates",
"=",
"None",
",",
"meta_group_name",
"=",
"\"_group\"",
")",
":",
"if",
"isinstance",
"(",
"meta",
",",
"list",
... | *Wrapper of* ``GROUP``
The GROUP operator is used for grouping both regions and/or metadata of input
dataset samples according to distinct values of certain attributes (known as grouping
attributes); new grouping attributes are added to samples in the output dataset,
storing the results... | [
"*",
"Wrapper",
"of",
"*",
"GROUP"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1227-L1343 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.meta_group | def meta_group(self, meta, meta_aggregates=None):
"""
*Wrapper of* ``GROUP``
Group operation only for metadata. For further information check :meth:`~.group`
"""
return self.group(meta=meta, meta_aggregates=meta_aggregates) | python | def meta_group(self, meta, meta_aggregates=None):
"""
*Wrapper of* ``GROUP``
Group operation only for metadata. For further information check :meth:`~.group`
"""
return self.group(meta=meta, meta_aggregates=meta_aggregates) | [
"def",
"meta_group",
"(",
"self",
",",
"meta",
",",
"meta_aggregates",
"=",
"None",
")",
":",
"return",
"self",
".",
"group",
"(",
"meta",
"=",
"meta",
",",
"meta_aggregates",
"=",
"meta_aggregates",
")"
] | *Wrapper of* ``GROUP``
Group operation only for metadata. For further information check :meth:`~.group` | [
"*",
"Wrapper",
"of",
"*",
"GROUP"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1345-L1351 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.regs_group | def regs_group(self, regs, regs_aggregates=None):
"""
*Wrapper of* ``GROUP``
Group operation only for region data. For further information check :meth:`~.group`
"""
return self.group(regs=regs, regs_aggregates=regs_aggregates) | python | def regs_group(self, regs, regs_aggregates=None):
"""
*Wrapper of* ``GROUP``
Group operation only for region data. For further information check :meth:`~.group`
"""
return self.group(regs=regs, regs_aggregates=regs_aggregates) | [
"def",
"regs_group",
"(",
"self",
",",
"regs",
",",
"regs_aggregates",
"=",
"None",
")",
":",
"return",
"self",
".",
"group",
"(",
"regs",
"=",
"regs",
",",
"regs_aggregates",
"=",
"regs_aggregates",
")"
] | *Wrapper of* ``GROUP``
Group operation only for region data. For further information check :meth:`~.group` | [
"*",
"Wrapper",
"of",
"*",
"GROUP"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1353-L1359 |
DEIB-GECO/PyGMQL | gmql/dataset/GMQLDataset.py | GMQLDataset.materialize | def materialize(self, output_path=None, output_name=None, all_load=True):
"""
*Wrapper of* ``MATERIALIZE``
Starts the execution of the operations for the GMQLDataset. PyGMQL implements lazy execution
and no operation is performed until the materialization of the results is requestd.
... | python | def materialize(self, output_path=None, output_name=None, all_load=True):
"""
*Wrapper of* ``MATERIALIZE``
Starts the execution of the operations for the GMQLDataset. PyGMQL implements lazy execution
and no operation is performed until the materialization of the results is requestd.
... | [
"def",
"materialize",
"(",
"self",
",",
"output_path",
"=",
"None",
",",
"output_name",
"=",
"None",
",",
"all_load",
"=",
"True",
")",
":",
"current_mode",
"=",
"get_mode",
"(",
")",
"new_index",
"=",
"self",
".",
"__modify_dag",
"(",
"current_mode",
")",... | *Wrapper of* ``MATERIALIZE``
Starts the execution of the operations for the GMQLDataset. PyGMQL implements lazy execution
and no operation is performed until the materialization of the results is requestd.
This operation can happen both locally or remotely.
* Local mode: if the GMQLDat... | [
"*",
"Wrapper",
"of",
"*",
"MATERIALIZE"
] | train | https://github.com/DEIB-GECO/PyGMQL/blob/e58b2f9402a86056dcda484a32e3de0bb06ed991/gmql/dataset/GMQLDataset.py#L1363-L1388 |
kevinconway/daemons | daemons/interfaces/message.py | MessageManager.step | def step(self):
"""Grab a new message and dispatch it to the handler.
This method should not be extended or overwritten. Instead,
implementations of this daemon should implement the 'get_message()'
and 'handle_message()' methods.
"""
message = self.get_message()
... | python | def step(self):
"""Grab a new message and dispatch it to the handler.
This method should not be extended or overwritten. Instead,
implementations of this daemon should implement the 'get_message()'
and 'handle_message()' methods.
"""
message = self.get_message()
... | [
"def",
"step",
"(",
"self",
")",
":",
"message",
"=",
"self",
".",
"get_message",
"(",
")",
"if",
"message",
"is",
"None",
":",
"self",
".",
"sleep",
"(",
"self",
".",
"idle_time",
")",
"return",
"None",
"self",
".",
"dispatch",
"(",
"message",
")",
... | Grab a new message and dispatch it to the handler.
This method should not be extended or overwritten. Instead,
implementations of this daemon should implement the 'get_message()'
and 'handle_message()' methods. | [
"Grab",
"a",
"new",
"message",
"and",
"dispatch",
"it",
"to",
"the",
"handler",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/interfaces/message.py#L35-L52 |
VeryCB/flask-slack | flask_slack/slack.py | Slack.init_app | def init_app(self, app=None):
"""Initialize application configuration"""
config = getattr(app, 'config', app)
self.team_id = config.get('TEAM_ID') | python | def init_app(self, app=None):
"""Initialize application configuration"""
config = getattr(app, 'config', app)
self.team_id = config.get('TEAM_ID') | [
"def",
"init_app",
"(",
"self",
",",
"app",
"=",
"None",
")",
":",
"config",
"=",
"getattr",
"(",
"app",
",",
"'config'",
",",
"app",
")",
"self",
".",
"team_id",
"=",
"config",
".",
"get",
"(",
"'TEAM_ID'",
")"
] | Initialize application configuration | [
"Initialize",
"application",
"configuration"
] | train | https://github.com/VeryCB/flask-slack/blob/ec7e08e6603f0d2d06cfbaff6699df02ee507077/flask_slack/slack.py#L15-L19 |
VeryCB/flask-slack | flask_slack/slack.py | Slack.command | def command(self, command, token, team_id=None, methods=['GET'], **kwargs):
"""A decorator used to register a command.
Example::
@slack.command('your_command', token='your_token',
team_id='your_team_id', methods=['POST'])
def your_method(**kwargs):
... | python | def command(self, command, token, team_id=None, methods=['GET'], **kwargs):
"""A decorator used to register a command.
Example::
@slack.command('your_command', token='your_token',
team_id='your_team_id', methods=['POST'])
def your_method(**kwargs):
... | [
"def",
"command",
"(",
"self",
",",
"command",
",",
"token",
",",
"team_id",
"=",
"None",
",",
"methods",
"=",
"[",
"'GET'",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"team_id",
"is",
"None",
":",
"team_id",
"=",
"self",
".",
"team_id",
"if",
... | A decorator used to register a command.
Example::
@slack.command('your_command', token='your_token',
team_id='your_team_id', methods=['POST'])
def your_method(**kwargs):
text = kwargs.get('text')
return slack.response(text)
... | [
"A",
"decorator",
"used",
"to",
"register",
"a",
"command",
".",
"Example",
"::"
] | train | https://github.com/VeryCB/flask-slack/blob/ec7e08e6603f0d2d06cfbaff6699df02ee507077/flask_slack/slack.py#L21-L49 |
VeryCB/flask-slack | flask_slack/slack.py | Slack.dispatch | def dispatch(self):
"""Dispatch http request to registerd commands.
Example::
slack = Slack(app)
app.add_url_rule('/', view_func=slack.dispatch)
"""
from flask import request
method = request.method
data = request.args
if method == 'POST... | python | def dispatch(self):
"""Dispatch http request to registerd commands.
Example::
slack = Slack(app)
app.add_url_rule('/', view_func=slack.dispatch)
"""
from flask import request
method = request.method
data = request.args
if method == 'POST... | [
"def",
"dispatch",
"(",
"self",
")",
":",
"from",
"flask",
"import",
"request",
"method",
"=",
"request",
".",
"method",
"data",
"=",
"request",
".",
"args",
"if",
"method",
"==",
"'POST'",
":",
"data",
"=",
"request",
".",
"form",
"token",
"=",
"data"... | Dispatch http request to registerd commands.
Example::
slack = Slack(app)
app.add_url_rule('/', view_func=slack.dispatch) | [
"Dispatch",
"http",
"request",
"to",
"registerd",
"commands",
".",
"Example",
"::"
] | train | https://github.com/VeryCB/flask-slack/blob/ec7e08e6603f0d2d06cfbaff6699df02ee507077/flask_slack/slack.py#L51-L81 |
VeryCB/flask-slack | flask_slack/slack.py | Slack.validate | def validate(self, command, token, team_id, method):
"""Validate request queries with registerd commands
:param command: command parameter from request
:param token: token parameter from request
:param team_id: team_id parameter from request
:param method: the request method
... | python | def validate(self, command, token, team_id, method):
"""Validate request queries with registerd commands
:param command: command parameter from request
:param token: token parameter from request
:param team_id: team_id parameter from request
:param method: the request method
... | [
"def",
"validate",
"(",
"self",
",",
"command",
",",
"token",
",",
"team_id",
",",
"method",
")",
":",
"if",
"(",
"team_id",
",",
"command",
")",
"not",
"in",
"self",
".",
"_commands",
":",
"raise",
"SlackError",
"(",
"'Command {0} is not found in team {1}'"... | Validate request queries with registerd commands
:param command: command parameter from request
:param token: token parameter from request
:param team_id: team_id parameter from request
:param method: the request method | [
"Validate",
"request",
"queries",
"with",
"registerd",
"commands"
] | train | https://github.com/VeryCB/flask-slack/blob/ec7e08e6603f0d2d06cfbaff6699df02ee507077/flask_slack/slack.py#L85-L103 |
VeryCB/flask-slack | flask_slack/slack.py | Slack.response | def response(self, text, response_type='ephemeral', attachments=None):
"""Return a response with json format
:param text: the text returned to the client
:param response_type: optional. When `in_channel` is assigned,
both the response message and the initial
... | python | def response(self, text, response_type='ephemeral', attachments=None):
"""Return a response with json format
:param text: the text returned to the client
:param response_type: optional. When `in_channel` is assigned,
both the response message and the initial
... | [
"def",
"response",
"(",
"self",
",",
"text",
",",
"response_type",
"=",
"'ephemeral'",
",",
"attachments",
"=",
"None",
")",
":",
"from",
"flask",
"import",
"jsonify",
"if",
"attachments",
"is",
"None",
":",
"attachments",
"=",
"[",
"]",
"data",
"=",
"{"... | Return a response with json format
:param text: the text returned to the client
:param response_type: optional. When `in_channel` is assigned,
both the response message and the initial
message typed by the user will be shared
... | [
"Return",
"a",
"response",
"with",
"json",
"format"
] | train | https://github.com/VeryCB/flask-slack/blob/ec7e08e6603f0d2d06cfbaff6699df02ee507077/flask_slack/slack.py#L105-L128 |
kevinconway/daemons | daemons/pid/simple.py | SimplePidManager.pid | def pid(self):
"""Get the pid which represents a daemonized process.
The result should be None if the process is not running.
"""
try:
with open(self.pidfile, 'r') as pidfile:
try:
pid = int(pidfile.read().strip())
exce... | python | def pid(self):
"""Get the pid which represents a daemonized process.
The result should be None if the process is not running.
"""
try:
with open(self.pidfile, 'r') as pidfile:
try:
pid = int(pidfile.read().strip())
exce... | [
"def",
"pid",
"(",
"self",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"pidfile",
",",
"'r'",
")",
"as",
"pidfile",
":",
"try",
":",
"pid",
"=",
"int",
"(",
"pidfile",
".",
"read",
"(",
")",
".",
"strip",
"(",
")",
")",
"except",
... | Get the pid which represents a daemonized process.
The result should be None if the process is not running. | [
"Get",
"the",
"pid",
"which",
"represents",
"a",
"daemonized",
"process",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/pid/simple.py#L25-L71 |
kevinconway/daemons | daemons/pid/simple.py | SimplePidManager.pid | def pid(self, pidnum):
"""Set the pid for a running process."""
try:
with open(self.pidfile, "w+") as pidfile:
pidfile.write("{0}\n".format(pidnum))
except IOError:
LOG.exception("Failed to write pidfile {0}).".format(self.pidfile))
sys.exi... | python | def pid(self, pidnum):
"""Set the pid for a running process."""
try:
with open(self.pidfile, "w+") as pidfile:
pidfile.write("{0}\n".format(pidnum))
except IOError:
LOG.exception("Failed to write pidfile {0}).".format(self.pidfile))
sys.exi... | [
"def",
"pid",
"(",
"self",
",",
"pidnum",
")",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"pidfile",
",",
"\"w+\"",
")",
"as",
"pidfile",
":",
"pidfile",
".",
"write",
"(",
"\"{0}\\n\"",
".",
"format",
"(",
"pidnum",
")",
")",
"except",
"IO... | Set the pid for a running process. | [
"Set",
"the",
"pid",
"for",
"a",
"running",
"process",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/pid/simple.py#L74-L85 |
kevinconway/daemons | daemons/pid/simple.py | SimplePidManager.pid | def pid(self):
"""Stop managing the current pid."""
try:
os.remove(self.pidfile)
except IOError:
if not os.path.isfile(self.pidfile):
return None
LOG.exception("Failed to clear pidfile {0}).".format(self.pidfile))
sys.exit(exit... | python | def pid(self):
"""Stop managing the current pid."""
try:
os.remove(self.pidfile)
except IOError:
if not os.path.isfile(self.pidfile):
return None
LOG.exception("Failed to clear pidfile {0}).".format(self.pidfile))
sys.exit(exit... | [
"def",
"pid",
"(",
"self",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"self",
".",
"pidfile",
")",
"except",
"IOError",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"pidfile",
")",
":",
"return",
"None",
"LOG",
".",
... | Stop managing the current pid. | [
"Stop",
"managing",
"the",
"current",
"pid",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/pid/simple.py#L88-L101 |
kevinconway/daemons | daemons/message/gevent.py | GeventMessageManager.pool | def pool(self):
"""Get an gevent pool used to dispatch requests."""
self._pool = self._pool or gevent.pool.Pool(size=self.pool_size)
return self._pool | python | def pool(self):
"""Get an gevent pool used to dispatch requests."""
self._pool = self._pool or gevent.pool.Pool(size=self.pool_size)
return self._pool | [
"def",
"pool",
"(",
"self",
")",
":",
"self",
".",
"_pool",
"=",
"self",
".",
"_pool",
"or",
"gevent",
".",
"pool",
".",
"Pool",
"(",
"size",
"=",
"self",
".",
"pool_size",
")",
"return",
"self",
".",
"_pool"
] | Get an gevent pool used to dispatch requests. | [
"Get",
"an",
"gevent",
"pool",
"used",
"to",
"dispatch",
"requests",
"."
] | train | https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/message/gevent.py#L18-L21 |
nathan-hoad/python-iwlib | iwlib/iwconfig.py | set_essid | def set_essid(interface, essid):
"""
Set the ESSID of a given interface
Arguments:
interface - device to work on (e.g. eth1, wlan0).
essid - ESSID to set. Must be no longer than IW_ESSID_MAX_SIZE (typically 32 characters).
"""
interface = _get_bytes(interface)
essid = _get_byte... | python | def set_essid(interface, essid):
"""
Set the ESSID of a given interface
Arguments:
interface - device to work on (e.g. eth1, wlan0).
essid - ESSID to set. Must be no longer than IW_ESSID_MAX_SIZE (typically 32 characters).
"""
interface = _get_bytes(interface)
essid = _get_byte... | [
"def",
"set_essid",
"(",
"interface",
",",
"essid",
")",
":",
"interface",
"=",
"_get_bytes",
"(",
"interface",
")",
"essid",
"=",
"_get_bytes",
"(",
"essid",
")",
"wrq",
"=",
"ffi",
".",
"new",
"(",
"'struct iwreq*'",
")",
"with",
"iwlib_socket",
"(",
"... | Set the ESSID of a given interface
Arguments:
interface - device to work on (e.g. eth1, wlan0).
essid - ESSID to set. Must be no longer than IW_ESSID_MAX_SIZE (typically 32 characters). | [
"Set",
"the",
"ESSID",
"of",
"a",
"given",
"interface"
] | train | https://github.com/nathan-hoad/python-iwlib/blob/f7604de0a27709fca139c4bada58263bdce4f08e/iwlib/iwconfig.py#L126-L165 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/datautil/asu_datautil/asu_read_data.py | read_adjacency_matrix | def read_adjacency_matrix(file_path, separator):
"""
Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format.
Inputs: - file_path: The path where the adjacency matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
Outp... | python | def read_adjacency_matrix(file_path, separator):
"""
Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format.
Inputs: - file_path: The path where the adjacency matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
Outp... | [
"def",
"read_adjacency_matrix",
"(",
"file_path",
",",
"separator",
")",
":",
"# Open file",
"file_row_generator",
"=",
"get_file_row_generator",
"(",
"file_path",
",",
"separator",
")",
"# Initialize lists for row and column sparse matrix arguments",
"row",
"=",
"list",
"(... | Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format.
Inputs: - file_path: The path where the adjacency matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
Outputs: - adjacency_matrix: The adjacency matrix in SciPy Sparse... | [
"Reads",
"an",
"edge",
"list",
"in",
"csv",
"format",
"and",
"returns",
"the",
"adjacency",
"matrix",
"in",
"SciPy",
"Sparse",
"COOrdinate",
"format",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/datautil/asu_datautil/asu_read_data.py#L9-L53 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/datautil/asu_datautil/asu_read_data.py | read_node_label_matrix | def read_node_label_matrix(file_path, separator, number_of_nodes):
"""
Reads node-label pairs in csv format and returns a list of tuples and a node-label matrix.
Inputs: - file_path: The path where the node-label matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
... | python | def read_node_label_matrix(file_path, separator, number_of_nodes):
"""
Reads node-label pairs in csv format and returns a list of tuples and a node-label matrix.
Inputs: - file_path: The path where the node-label matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
... | [
"def",
"read_node_label_matrix",
"(",
"file_path",
",",
"separator",
",",
"number_of_nodes",
")",
":",
"# Open file",
"file_row_generator",
"=",
"get_file_row_generator",
"(",
"file_path",
",",
"separator",
")",
"# Initialize lists for row and column sparse matrix arguments",
... | Reads node-label pairs in csv format and returns a list of tuples and a node-label matrix.
Inputs: - file_path: The path where the node-label matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
- number_of_nodes: The number of nodes of the full graph. It is po... | [
"Reads",
"node",
"-",
"label",
"pairs",
"in",
"csv",
"format",
"and",
"returns",
"a",
"list",
"of",
"tuples",
"and",
"a",
"node",
"-",
"label",
"matrix",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/datautil/asu_datautil/asu_read_data.py#L56-L102 |
dhilipsiva/garuda | garuda/management/commands/garuda.py | ensure_data | def ensure_data():
'''
Ensure that the Garuda directory and files
'''
if not os.path.exists(GARUDA_DIR):
os.makedirs(GARUDA_DIR)
Path(f'{GARUDA_DIR}/__init__.py').touch() | python | def ensure_data():
'''
Ensure that the Garuda directory and files
'''
if not os.path.exists(GARUDA_DIR):
os.makedirs(GARUDA_DIR)
Path(f'{GARUDA_DIR}/__init__.py').touch() | [
"def",
"ensure_data",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"GARUDA_DIR",
")",
":",
"os",
".",
"makedirs",
"(",
"GARUDA_DIR",
")",
"Path",
"(",
"f'{GARUDA_DIR}/__init__.py'",
")",
".",
"touch",
"(",
")"
] | Ensure that the Garuda directory and files | [
"Ensure",
"that",
"the",
"Garuda",
"directory",
"and",
"files"
] | train | https://github.com/dhilipsiva/garuda/blob/b8188f5d6141be9f3f9e3fddd0494143c2066184/garuda/management/commands/garuda.py#L27-L33 |
dhilipsiva/garuda | garuda/management/commands/garuda.py | protoc_arguments | def protoc_arguments():
'''
Construct protobuf compiler arguments
'''
proto_include = resource_filename('grpc_tools', '_proto')
return [
protoc.__file__, '-I', GARUDA_DIR, f'--python_out={GARUDA_DIR}',
f'--grpc_python_out={GARUDA_DIR}', GARUDA_PROTO_PATH,
f'-I{proto_include}'... | python | def protoc_arguments():
'''
Construct protobuf compiler arguments
'''
proto_include = resource_filename('grpc_tools', '_proto')
return [
protoc.__file__, '-I', GARUDA_DIR, f'--python_out={GARUDA_DIR}',
f'--grpc_python_out={GARUDA_DIR}', GARUDA_PROTO_PATH,
f'-I{proto_include}'... | [
"def",
"protoc_arguments",
"(",
")",
":",
"proto_include",
"=",
"resource_filename",
"(",
"'grpc_tools'",
",",
"'_proto'",
")",
"return",
"[",
"protoc",
".",
"__file__",
",",
"'-I'",
",",
"GARUDA_DIR",
",",
"f'--python_out={GARUDA_DIR}'",
",",
"f'--grpc_python_out={... | Construct protobuf compiler arguments | [
"Construct",
"protobuf",
"compiler",
"arguments"
] | train | https://github.com/dhilipsiva/garuda/blob/b8188f5d6141be9f3f9e3fddd0494143c2066184/garuda/management/commands/garuda.py#L270-L278 |
dhilipsiva/garuda | garuda/management/commands/garuda.py | fix_grpc_import | def fix_grpc_import():
'''
Snippet to fix the gRPC import path
'''
with open(GARUDA_GRPC_PATH, 'r') as f:
filedata = f.read()
filedata = filedata.replace(
'import garuda_pb2 as garuda__pb2',
f'import {GARUDA_DIR}.garuda_pb2 as garuda__pb2')
with open(GARUDA_GRPC_PATH, 'w'... | python | def fix_grpc_import():
'''
Snippet to fix the gRPC import path
'''
with open(GARUDA_GRPC_PATH, 'r') as f:
filedata = f.read()
filedata = filedata.replace(
'import garuda_pb2 as garuda__pb2',
f'import {GARUDA_DIR}.garuda_pb2 as garuda__pb2')
with open(GARUDA_GRPC_PATH, 'w'... | [
"def",
"fix_grpc_import",
"(",
")",
":",
"with",
"open",
"(",
"GARUDA_GRPC_PATH",
",",
"'r'",
")",
"as",
"f",
":",
"filedata",
"=",
"f",
".",
"read",
"(",
")",
"filedata",
"=",
"filedata",
".",
"replace",
"(",
"'import garuda_pb2 as garuda__pb2'",
",",
"f'... | Snippet to fix the gRPC import path | [
"Snippet",
"to",
"fix",
"the",
"gRPC",
"import",
"path"
] | train | https://github.com/dhilipsiva/garuda/blob/b8188f5d6141be9f3f9e3fddd0494143c2066184/garuda/management/commands/garuda.py#L281-L291 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/datautil/score_rw_util.py | write_average_score_row | def write_average_score_row(fp, score_name, scores):
"""
Simple utility function that writes an average score row in a file designated by a file pointer.
Inputs: - fp: A file pointer.
- score_name: What it says on the tin.
- scores: An array of average score values corresponding ... | python | def write_average_score_row(fp, score_name, scores):
"""
Simple utility function that writes an average score row in a file designated by a file pointer.
Inputs: - fp: A file pointer.
- score_name: What it says on the tin.
- scores: An array of average score values corresponding ... | [
"def",
"write_average_score_row",
"(",
"fp",
",",
"score_name",
",",
"scores",
")",
":",
"row",
"=",
"\"--\"",
"+",
"score_name",
"+",
"\"--\"",
"fp",
".",
"write",
"(",
"row",
")",
"for",
"vector",
"in",
"scores",
":",
"row",
"=",
"list",
"(",
"vector... | Simple utility function that writes an average score row in a file designated by a file pointer.
Inputs: - fp: A file pointer.
- score_name: What it says on the tin.
- scores: An array of average score values corresponding to each of the training set percentages. | [
"Simple",
"utility",
"function",
"that",
"writes",
"an",
"average",
"score",
"row",
"in",
"a",
"file",
"designated",
"by",
"a",
"file",
"pointer",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/datautil/score_rw_util.py#L76-L90 |
WhyNotHugo/django-afip | django_afip/admin.py | catch_errors | def catch_errors(f):
"""
Catches specific errors in admin actions and shows a friendly error.
"""
@functools.wraps(f)
def wrapper(self, request, *args, **kwargs):
try:
return f(self, request, *args, **kwargs)
except exceptions.CertificateExpired:
self.message... | python | def catch_errors(f):
"""
Catches specific errors in admin actions and shows a friendly error.
"""
@functools.wraps(f)
def wrapper(self, request, *args, **kwargs):
try:
return f(self, request, *args, **kwargs)
except exceptions.CertificateExpired:
self.message... | [
"def",
"catch_errors",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"f",
"(",
"self",
",",
"request",
... | Catches specific errors in admin actions and shows a friendly error. | [
"Catches",
"specific",
"errors",
"in",
"admin",
"actions",
"and",
"shows",
"a",
"friendly",
"error",
"."
] | train | https://github.com/WhyNotHugo/django-afip/blob/5fb73213f1fe86ca52b501ffd0737911ef26ddb3/django_afip/admin.py#L24-L59 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/embedding/text_graph.py | augmented_tf_idf | def augmented_tf_idf(attribute_matrix):
"""
Performs augmented TF-IDF normalization on a bag-of-words vector representation of data.
Augmented TF-IDF introduced in: Manning, C. D., Raghavan, P., & Schütze, H. (2008).
Introduction to information retrieval (Vol. 1, p. 6).
... | python | def augmented_tf_idf(attribute_matrix):
"""
Performs augmented TF-IDF normalization on a bag-of-words vector representation of data.
Augmented TF-IDF introduced in: Manning, C. D., Raghavan, P., & Schütze, H. (2008).
Introduction to information retrieval (Vol. 1, p. 6).
... | [
"def",
"augmented_tf_idf",
"(",
"attribute_matrix",
")",
":",
"number_of_documents",
"=",
"attribute_matrix",
".",
"shape",
"[",
"0",
"]",
"max_term_frequencies",
"=",
"np",
".",
"ones",
"(",
"number_of_documents",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
... | Performs augmented TF-IDF normalization on a bag-of-words vector representation of data.
Augmented TF-IDF introduced in: Manning, C. D., Raghavan, P., & Schütze, H. (2008).
Introduction to information retrieval (Vol. 1, p. 6).
Cambridge: Cambr... | [
"Performs",
"augmented",
"TF",
"-",
"IDF",
"normalization",
"on",
"a",
"bag",
"-",
"of",
"-",
"words",
"vector",
"representation",
"of",
"data",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/embedding/text_graph.py#L48-L86 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/common.py | get_file_row_generator | def get_file_row_generator(file_path, separator, encoding=None):
"""
Reads an separated value file row by row.
Inputs: - file_path: The path of the separated value format file.
- separator: The delimiter among values (e.g. ",", "\t", " ")
- encoding: The encoding used in the stored ... | python | def get_file_row_generator(file_path, separator, encoding=None):
"""
Reads an separated value file row by row.
Inputs: - file_path: The path of the separated value format file.
- separator: The delimiter among values (e.g. ",", "\t", " ")
- encoding: The encoding used in the stored ... | [
"def",
"get_file_row_generator",
"(",
"file_path",
",",
"separator",
",",
"encoding",
"=",
"None",
")",
":",
"with",
"open",
"(",
"file_path",
",",
"encoding",
"=",
"encoding",
")",
"as",
"file_object",
":",
"for",
"line",
"in",
"file_object",
":",
"words",
... | Reads an separated value file row by row.
Inputs: - file_path: The path of the separated value format file.
- separator: The delimiter among values (e.g. ",", "\t", " ")
- encoding: The encoding used in the stored text.
Yields: - words: A list of strings corresponding to each of the fi... | [
"Reads",
"an",
"separated",
"value",
"file",
"row",
"by",
"row",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/common.py#L36-L49 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/common.py | store_pickle | def store_pickle(file_path, data):
"""
Pickle some data to a given path.
Inputs: - file_path: Target file path.
- data: The python object to be serialized via pickle.
"""
pkl_file = open(file_path, 'wb')
pickle.dump(data, pkl_file)
pkl_file.close() | python | def store_pickle(file_path, data):
"""
Pickle some data to a given path.
Inputs: - file_path: Target file path.
- data: The python object to be serialized via pickle.
"""
pkl_file = open(file_path, 'wb')
pickle.dump(data, pkl_file)
pkl_file.close() | [
"def",
"store_pickle",
"(",
"file_path",
",",
"data",
")",
":",
"pkl_file",
"=",
"open",
"(",
"file_path",
",",
"'wb'",
")",
"pickle",
".",
"dump",
"(",
"data",
",",
"pkl_file",
")",
"pkl_file",
".",
"close",
"(",
")"
] | Pickle some data to a given path.
Inputs: - file_path: Target file path.
- data: The python object to be serialized via pickle. | [
"Pickle",
"some",
"data",
"to",
"a",
"given",
"path",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/common.py#L52-L61 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/common.py | load_pickle | def load_pickle(file_path):
"""
Unpickle some data from a given path.
Input: - file_path: Target file path.
Output: - data: The python object that was serialized and stored in disk.
"""
pkl_file = open(file_path, 'rb')
data = pickle.load(pkl_file)
pkl_file.close()
return data | python | def load_pickle(file_path):
"""
Unpickle some data from a given path.
Input: - file_path: Target file path.
Output: - data: The python object that was serialized and stored in disk.
"""
pkl_file = open(file_path, 'rb')
data = pickle.load(pkl_file)
pkl_file.close()
return data | [
"def",
"load_pickle",
"(",
"file_path",
")",
":",
"pkl_file",
"=",
"open",
"(",
"file_path",
",",
"'rb'",
")",
"data",
"=",
"pickle",
".",
"load",
"(",
"pkl_file",
")",
"pkl_file",
".",
"close",
"(",
")",
"return",
"data"
] | Unpickle some data from a given path.
Input: - file_path: Target file path.
Output: - data: The python object that was serialized and stored in disk. | [
"Unpickle",
"some",
"data",
"from",
"a",
"given",
"path",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/common.py#L64-L75 |
MultipedRobotics/pyxl320 | bin/set_id.py | makeServoIDPacket | def makeServoIDPacket(curr_id, new_id):
"""
Given the current ID, returns a packet to set the servo to a new ID
"""
pkt = Packet.makeWritePacket(curr_id, xl320.XL320_ID, [new_id])
return pkt | python | def makeServoIDPacket(curr_id, new_id):
"""
Given the current ID, returns a packet to set the servo to a new ID
"""
pkt = Packet.makeWritePacket(curr_id, xl320.XL320_ID, [new_id])
return pkt | [
"def",
"makeServoIDPacket",
"(",
"curr_id",
",",
"new_id",
")",
":",
"pkt",
"=",
"Packet",
".",
"makeWritePacket",
"(",
"curr_id",
",",
"xl320",
".",
"XL320_ID",
",",
"[",
"new_id",
"]",
")",
"return",
"pkt"
] | Given the current ID, returns a packet to set the servo to a new ID | [
"Given",
"the",
"current",
"ID",
"returns",
"a",
"packet",
"to",
"set",
"the",
"servo",
"to",
"a",
"new",
"ID"
] | train | https://github.com/MultipedRobotics/pyxl320/blob/1a56540e208b028ee47d5fa0a7c7babcee0d9214/bin/set_id.py#L28-L33 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/embedding/common.py | normalize_rows | def normalize_rows(features):
"""
This performs row normalization to 1 of community embedding features.
Input: - X in R^(nxC_n): The community indicator matrix.
Output: - X_norm in R^(nxC_n): The row normalized community indicator matrix.
"""
# Normalize each row of term frequencies to 1
... | python | def normalize_rows(features):
"""
This performs row normalization to 1 of community embedding features.
Input: - X in R^(nxC_n): The community indicator matrix.
Output: - X_norm in R^(nxC_n): The row normalized community indicator matrix.
"""
# Normalize each row of term frequencies to 1
... | [
"def",
"normalize_rows",
"(",
"features",
")",
":",
"# Normalize each row of term frequencies to 1",
"features",
"=",
"features",
".",
"tocsr",
"(",
")",
"features",
"=",
"normalize",
"(",
"features",
",",
"norm",
"=",
"\"l2\"",
")",
"# for i in range(features.shape[0... | This performs row normalization to 1 of community embedding features.
Input: - X in R^(nxC_n): The community indicator matrix.
Output: - X_norm in R^(nxC_n): The row normalized community indicator matrix. | [
"This",
"performs",
"row",
"normalization",
"to",
"1",
"of",
"community",
"embedding",
"features",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/embedding/common.py#L29-L46 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/embedding/common.py | normalize_columns | def normalize_columns(features):
"""
This performs column normalization of community embedding features.
Input: - X in R^(nxC_n): The community indicator matrix.
Output: - X_norm in R^(nxC_n): The tf-idf + row normalized community indicator matrix.
"""
# Calculate inverse document frequency.
... | python | def normalize_columns(features):
"""
This performs column normalization of community embedding features.
Input: - X in R^(nxC_n): The community indicator matrix.
Output: - X_norm in R^(nxC_n): The tf-idf + row normalized community indicator matrix.
"""
# Calculate inverse document frequency.
... | [
"def",
"normalize_columns",
"(",
"features",
")",
":",
"# Calculate inverse document frequency.",
"features",
"=",
"features",
".",
"tocsc",
"(",
")",
"for",
"j",
"in",
"range",
"(",
"features",
".",
"shape",
"[",
"1",
"]",
")",
":",
"document_frequency",
"=",... | This performs column normalization of community embedding features.
Input: - X in R^(nxC_n): The community indicator matrix.
Output: - X_norm in R^(nxC_n): The tf-idf + row normalized community indicator matrix. | [
"This",
"performs",
"column",
"normalization",
"of",
"community",
"embedding",
"features",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/embedding/common.py#L49-L67 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/eps_randomwalk/push.py | pagerank_limit_push | def pagerank_limit_push(s, r, w_i, a_i, push_node, rho):
"""
Performs a random step without a self-loop.
"""
# Calculate the A and B quantities to infinity
A_inf = rho*r[push_node]
B_inf = (1-rho)*r[push_node]
# Update approximate Pagerank and residual vectors
s[push_node] += A_inf
... | python | def pagerank_limit_push(s, r, w_i, a_i, push_node, rho):
"""
Performs a random step without a self-loop.
"""
# Calculate the A and B quantities to infinity
A_inf = rho*r[push_node]
B_inf = (1-rho)*r[push_node]
# Update approximate Pagerank and residual vectors
s[push_node] += A_inf
... | [
"def",
"pagerank_limit_push",
"(",
"s",
",",
"r",
",",
"w_i",
",",
"a_i",
",",
"push_node",
",",
"rho",
")",
":",
"# Calculate the A and B quantities to infinity",
"A_inf",
"=",
"rho",
"*",
"r",
"[",
"push_node",
"]",
"B_inf",
"=",
"(",
"1",
"-",
"rho",
... | Performs a random step without a self-loop. | [
"Performs",
"a",
"random",
"step",
"without",
"a",
"self",
"-",
"loop",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/eps_randomwalk/push.py#L4-L17 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/eps_randomwalk/push.py | pagerank_lazy_push | def pagerank_lazy_push(s, r, w_i, a_i, push_node, rho, lazy):
"""
Performs a random step with a self-loop.
Introduced in: Andersen, R., Chung, F., & Lang, K. (2006, October).
Local graph partitioning using pagerank vectors.
In Foundations of Computer Science, 2006. FOC... | python | def pagerank_lazy_push(s, r, w_i, a_i, push_node, rho, lazy):
"""
Performs a random step with a self-loop.
Introduced in: Andersen, R., Chung, F., & Lang, K. (2006, October).
Local graph partitioning using pagerank vectors.
In Foundations of Computer Science, 2006. FOC... | [
"def",
"pagerank_lazy_push",
"(",
"s",
",",
"r",
",",
"w_i",
",",
"a_i",
",",
"push_node",
",",
"rho",
",",
"lazy",
")",
":",
"# Calculate the A, B and C quantities",
"A",
"=",
"rho",
"*",
"r",
"[",
"push_node",
"]",
"B",
"=",
"(",
"1",
"-",
"rho",
"... | Performs a random step with a self-loop.
Introduced in: Andersen, R., Chung, F., & Lang, K. (2006, October).
Local graph partitioning using pagerank vectors.
In Foundations of Computer Science, 2006. FOCS'06. 47th Annual IEEE Symposium on (pp. 475-486). IEEE. | [
"Performs",
"a",
"random",
"step",
"with",
"a",
"self",
"-",
"loop",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/eps_randomwalk/push.py#L20-L38 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/eps_randomwalk/push.py | cumulative_pagerank_difference_limit_push | def cumulative_pagerank_difference_limit_push(s, r, w_i, a_i, push_node, rho):
"""
Performs a random step without a self-loop.
Inputs: - s: A NumPy array that contains the approximate absorbing random walk cumulative probabilities.
- r: A NumPy array that contains the residual probability dis... | python | def cumulative_pagerank_difference_limit_push(s, r, w_i, a_i, push_node, rho):
"""
Performs a random step without a self-loop.
Inputs: - s: A NumPy array that contains the approximate absorbing random walk cumulative probabilities.
- r: A NumPy array that contains the residual probability dis... | [
"def",
"cumulative_pagerank_difference_limit_push",
"(",
"s",
",",
"r",
",",
"w_i",
",",
"a_i",
",",
"push_node",
",",
"rho",
")",
":",
"# Calculate the commute quantity",
"commute",
"=",
"(",
"1",
"-",
"rho",
")",
"*",
"r",
"[",
"push_node",
"]",
"# Update ... | Performs a random step without a self-loop.
Inputs: - s: A NumPy array that contains the approximate absorbing random walk cumulative probabilities.
- r: A NumPy array that contains the residual probability distribution.
- w_i: A NumPy array of probability transition weights from the see... | [
"Performs",
"a",
"random",
"step",
"without",
"a",
"self",
"-",
"loop",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/eps_randomwalk/push.py#L41-L64 |
mozilla-services/pyramid_multiauth | pyramid_multiauth/__init__.py | includeme | def includeme(config):
"""Include pyramid_multiauth into a pyramid configurator.
This function provides a hook for pyramid to include the default settings
for auth via pyramid_multiauth. Activate it like so:
config.include("pyramid_multiauth")
This will pull the list of registered authn poli... | python | def includeme(config):
"""Include pyramid_multiauth into a pyramid configurator.
This function provides a hook for pyramid to include the default settings
for auth via pyramid_multiauth. Activate it like so:
config.include("pyramid_multiauth")
This will pull the list of registered authn poli... | [
"def",
"includeme",
"(",
"config",
")",
":",
"# Grab the pyramid-wide settings, to look for any auth config.",
"settings",
"=",
"config",
".",
"get_settings",
"(",
")",
"# Hook up a default AuthorizationPolicy.",
"# Get the authorization policy from config if present.",
"# Default AC... | Include pyramid_multiauth into a pyramid configurator.
This function provides a hook for pyramid to include the default settings
for auth via pyramid_multiauth. Activate it like so:
config.include("pyramid_multiauth")
This will pull the list of registered authn policies from the deployment
s... | [
"Include",
"pyramid_multiauth",
"into",
"a",
"pyramid",
"configurator",
"."
] | train | https://github.com/mozilla-services/pyramid_multiauth/blob/9548aa55f726920a666791d7c89ac2b9779d2bc1/pyramid_multiauth/__init__.py#L188-L290 |
mozilla-services/pyramid_multiauth | pyramid_multiauth/__init__.py | policy_factory_from_module | def policy_factory_from_module(config, module):
"""Create a policy factory that works by config.include()'ing a module.
This function does some trickery with the Pyramid config system. Loosely,
it does config.include(module), and then sucks out information about the
authn policy that was registered. I... | python | def policy_factory_from_module(config, module):
"""Create a policy factory that works by config.include()'ing a module.
This function does some trickery with the Pyramid config system. Loosely,
it does config.include(module), and then sucks out information about the
authn policy that was registered. I... | [
"def",
"policy_factory_from_module",
"(",
"config",
",",
"module",
")",
":",
"# Remember the policy that's active before including the module, if any.",
"orig_policy",
"=",
"config",
".",
"registry",
".",
"queryUtility",
"(",
"IAuthenticationPolicy",
")",
"# Include the module,... | Create a policy factory that works by config.include()'ing a module.
This function does some trickery with the Pyramid config system. Loosely,
it does config.include(module), and then sucks out information about the
authn policy that was registered. It's complicated by pyramid's delayed-
commit system... | [
"Create",
"a",
"policy",
"factory",
"that",
"works",
"by",
"config",
".",
"include",
"()",
"ing",
"a",
"module",
"."
] | train | https://github.com/mozilla-services/pyramid_multiauth/blob/9548aa55f726920a666791d7c89ac2b9779d2bc1/pyramid_multiauth/__init__.py#L293-L336 |
mozilla-services/pyramid_multiauth | pyramid_multiauth/__init__.py | get_policy_definitions | def get_policy_definitions(settings):
"""Find all multiauth policy definitions from the settings dict.
This function processes the paster deployment settings looking for items
that start with "multiauth.policy.<policyname>.". It pulls them all out
into a dict indexed by the policy name.
"""
po... | python | def get_policy_definitions(settings):
"""Find all multiauth policy definitions from the settings dict.
This function processes the paster deployment settings looking for items
that start with "multiauth.policy.<policyname>.". It pulls them all out
into a dict indexed by the policy name.
"""
po... | [
"def",
"get_policy_definitions",
"(",
"settings",
")",
":",
"policy_definitions",
"=",
"{",
"}",
"for",
"name",
"in",
"settings",
":",
"if",
"not",
"name",
".",
"startswith",
"(",
"\"multiauth.policy.\"",
")",
":",
"continue",
"value",
"=",
"settings",
"[",
... | Find all multiauth policy definitions from the settings dict.
This function processes the paster deployment settings looking for items
that start with "multiauth.policy.<policyname>.". It pulls them all out
into a dict indexed by the policy name. | [
"Find",
"all",
"multiauth",
"policy",
"definitions",
"from",
"the",
"settings",
"dict",
"."
] | train | https://github.com/mozilla-services/pyramid_multiauth/blob/9548aa55f726920a666791d7c89ac2b9779d2bc1/pyramid_multiauth/__init__.py#L339-L356 |
Robpol86/flake8-pydocstyle | flake8_pydocstyle.py | load_file | def load_file(filename):
"""Read file to memory.
For stdin sourced files, this function does something super duper incredibly hacky and shameful. So so shameful. I'm
obtaining the original source code of the target module from the only instance of pycodestyle.Checker through the
Python garbage collecto... | python | def load_file(filename):
"""Read file to memory.
For stdin sourced files, this function does something super duper incredibly hacky and shameful. So so shameful. I'm
obtaining the original source code of the target module from the only instance of pycodestyle.Checker through the
Python garbage collecto... | [
"def",
"load_file",
"(",
"filename",
")",
":",
"if",
"filename",
"in",
"(",
"'stdin'",
",",
"'-'",
",",
"None",
")",
":",
"instances",
"=",
"[",
"i",
"for",
"i",
"in",
"gc",
".",
"get_objects",
"(",
")",
"if",
"isinstance",
"(",
"i",
",",
"pycodest... | Read file to memory.
For stdin sourced files, this function does something super duper incredibly hacky and shameful. So so shameful. I'm
obtaining the original source code of the target module from the only instance of pycodestyle.Checker through the
Python garbage collector. Flake8's API doesn't give me ... | [
"Read",
"file",
"to",
"memory",
"."
] | train | https://github.com/Robpol86/flake8-pydocstyle/blob/657425541e1d868a6a5241a83c3a16a9a715d6b5/flake8_pydocstyle.py#L20-L43 |
Robpol86/flake8-pydocstyle | flake8_pydocstyle.py | ignore | def ignore(code):
"""Should this code be ignored.
:param str code: Error code (e.g. D201).
:return: True if code should be ignored, False otherwise.
:rtype: bool
"""
if code in Main.options['ignore']:
return True
if any(c in code for c in Main.options['ignore']):
return Tru... | python | def ignore(code):
"""Should this code be ignored.
:param str code: Error code (e.g. D201).
:return: True if code should be ignored, False otherwise.
:rtype: bool
"""
if code in Main.options['ignore']:
return True
if any(c in code for c in Main.options['ignore']):
return Tru... | [
"def",
"ignore",
"(",
"code",
")",
":",
"if",
"code",
"in",
"Main",
".",
"options",
"[",
"'ignore'",
"]",
":",
"return",
"True",
"if",
"any",
"(",
"c",
"in",
"code",
"for",
"c",
"in",
"Main",
".",
"options",
"[",
"'ignore'",
"]",
")",
":",
"retur... | Should this code be ignored.
:param str code: Error code (e.g. D201).
:return: True if code should be ignored, False otherwise.
:rtype: bool | [
"Should",
"this",
"code",
"be",
"ignored",
"."
] | train | https://github.com/Robpol86/flake8-pydocstyle/blob/657425541e1d868a6a5241a83c3a16a9a715d6b5/flake8_pydocstyle.py#L46-L58 |
Robpol86/flake8-pydocstyle | flake8_pydocstyle.py | Main.add_options | def add_options(cls, parser):
"""Add options to flake8.
:param parser: optparse.OptionParser from pycodestyle.
"""
parser.add_option('--show-pydocstyle', action='store_true', help='show explanation of each PEP 257 error')
parser.config_options.append('show-pydocstyle') | python | def add_options(cls, parser):
"""Add options to flake8.
:param parser: optparse.OptionParser from pycodestyle.
"""
parser.add_option('--show-pydocstyle', action='store_true', help='show explanation of each PEP 257 error')
parser.config_options.append('show-pydocstyle') | [
"def",
"add_options",
"(",
"cls",
",",
"parser",
")",
":",
"parser",
".",
"add_option",
"(",
"'--show-pydocstyle'",
",",
"action",
"=",
"'store_true'",
",",
"help",
"=",
"'show explanation of each PEP 257 error'",
")",
"parser",
".",
"config_options",
".",
"append... | Add options to flake8.
:param parser: optparse.OptionParser from pycodestyle. | [
"Add",
"options",
"to",
"flake8",
"."
] | train | https://github.com/Robpol86/flake8-pydocstyle/blob/657425541e1d868a6a5241a83c3a16a9a715d6b5/flake8_pydocstyle.py#L78-L84 |
Robpol86/flake8-pydocstyle | flake8_pydocstyle.py | Main.parse_options | def parse_options(cls, options):
"""Read parsed options from flake8.
:param options: Options to add to flake8's command line options.
"""
# Handle flake8 options.
cls.options['explain'] = bool(options.show_pydocstyle)
cls.options['ignore'] = options.ignore
# Han... | python | def parse_options(cls, options):
"""Read parsed options from flake8.
:param options: Options to add to flake8's command line options.
"""
# Handle flake8 options.
cls.options['explain'] = bool(options.show_pydocstyle)
cls.options['ignore'] = options.ignore
# Han... | [
"def",
"parse_options",
"(",
"cls",
",",
"options",
")",
":",
"# Handle flake8 options.",
"cls",
".",
"options",
"[",
"'explain'",
"]",
"=",
"bool",
"(",
"options",
".",
"show_pydocstyle",
")",
"cls",
".",
"options",
"[",
"'ignore'",
"]",
"=",
"options",
"... | Read parsed options from flake8.
:param options: Options to add to flake8's command line options. | [
"Read",
"parsed",
"options",
"from",
"flake8",
"."
] | train | https://github.com/Robpol86/flake8-pydocstyle/blob/657425541e1d868a6a5241a83c3a16a9a715d6b5/flake8_pydocstyle.py#L87-L112 |
Robpol86/flake8-pydocstyle | flake8_pydocstyle.py | Main.run | def run(self):
"""Run analysis on a single file."""
pydocstyle.Error.explain = self.options['explain']
filename, source = load_file(self.filename)
for error in pydocstyle.PEP257Checker().check_source(source, filename):
if not hasattr(error, 'code') or ignore(error.code):
... | python | def run(self):
"""Run analysis on a single file."""
pydocstyle.Error.explain = self.options['explain']
filename, source = load_file(self.filename)
for error in pydocstyle.PEP257Checker().check_source(source, filename):
if not hasattr(error, 'code') or ignore(error.code):
... | [
"def",
"run",
"(",
"self",
")",
":",
"pydocstyle",
".",
"Error",
".",
"explain",
"=",
"self",
".",
"options",
"[",
"'explain'",
"]",
"filename",
",",
"source",
"=",
"load_file",
"(",
"self",
".",
"filename",
")",
"for",
"error",
"in",
"pydocstyle",
"."... | Run analysis on a single file. | [
"Run",
"analysis",
"on",
"a",
"single",
"file",
"."
] | train | https://github.com/Robpol86/flake8-pydocstyle/blob/657425541e1d868a6a5241a83c3a16a9a715d6b5/flake8_pydocstyle.py#L114-L125 |
WhyNotHugo/django-afip | django_afip/pdf.py | ReceiptBarcodeGenerator.numbers | def numbers(self):
""""
Returns the barcode's number without the verification digit.
:return: list(int)
"""
numstring = '{:011d}{:02d}{:04d}{}{}'.format(
self._receipt.point_of_sales.owner.cuit, # 11 digits
int(self._receipt.receipt_type.code), # 2 digi... | python | def numbers(self):
""""
Returns the barcode's number without the verification digit.
:return: list(int)
"""
numstring = '{:011d}{:02d}{:04d}{}{}'.format(
self._receipt.point_of_sales.owner.cuit, # 11 digits
int(self._receipt.receipt_type.code), # 2 digi... | [
"def",
"numbers",
"(",
"self",
")",
":",
"numstring",
"=",
"'{:011d}{:02d}{:04d}{}{}'",
".",
"format",
"(",
"self",
".",
"_receipt",
".",
"point_of_sales",
".",
"owner",
".",
"cuit",
",",
"# 11 digits",
"int",
"(",
"self",
".",
"_receipt",
".",
"receipt_type... | Returns the barcode's number without the verification digit.
:return: list(int) | [
"Returns",
"the",
"barcode",
"s",
"number",
"without",
"the",
"verification",
"digit",
"."
] | train | https://github.com/WhyNotHugo/django-afip/blob/5fb73213f1fe86ca52b501ffd0737911ef26ddb3/django_afip/pdf.py#L22-L35 |
WhyNotHugo/django-afip | django_afip/pdf.py | ReceiptBarcodeGenerator.verification_digit | def verification_digit(numbers):
"""
Returns the verification digit for a given numbre.
The verification digit is calculated as follows:
* A = sum of all even-positioned numbers
* B = A * 3
* C = sum of all odd-positioned numbers
* D = B + C
* The result... | python | def verification_digit(numbers):
"""
Returns the verification digit for a given numbre.
The verification digit is calculated as follows:
* A = sum of all even-positioned numbers
* B = A * 3
* C = sum of all odd-positioned numbers
* D = B + C
* The result... | [
"def",
"verification_digit",
"(",
"numbers",
")",
":",
"a",
"=",
"sum",
"(",
"numbers",
"[",
":",
":",
"2",
"]",
")",
"b",
"=",
"a",
"*",
"3",
"c",
"=",
"sum",
"(",
"numbers",
"[",
"1",
":",
":",
"2",
"]",
")",
"d",
"=",
"b",
"+",
"c",
"e... | Returns the verification digit for a given numbre.
The verification digit is calculated as follows:
* A = sum of all even-positioned numbers
* B = A * 3
* C = sum of all odd-positioned numbers
* D = B + C
* The results is the smallset number N, such that (D + N) % 10 ==... | [
"Returns",
"the",
"verification",
"digit",
"for",
"a",
"given",
"numbre",
"."
] | train | https://github.com/WhyNotHugo/django-afip/blob/5fb73213f1fe86ca52b501ffd0737911ef26ddb3/django_afip/pdf.py#L38-L64 |
WhyNotHugo/django-afip | django_afip/pdf.py | ReceiptBarcodeGenerator.full_number | def full_number(self):
"""
Returns the full number including the verification digit.
:return: str
"""
return '{}{}'.format(
''.join(str(n) for n in self.numbers),
ReceiptBarcodeGenerator.verification_digit(self.numbers),
) | python | def full_number(self):
"""
Returns the full number including the verification digit.
:return: str
"""
return '{}{}'.format(
''.join(str(n) for n in self.numbers),
ReceiptBarcodeGenerator.verification_digit(self.numbers),
) | [
"def",
"full_number",
"(",
"self",
")",
":",
"return",
"'{}{}'",
".",
"format",
"(",
"''",
".",
"join",
"(",
"str",
"(",
"n",
")",
"for",
"n",
"in",
"self",
".",
"numbers",
")",
",",
"ReceiptBarcodeGenerator",
".",
"verification_digit",
"(",
"self",
".... | Returns the full number including the verification digit.
:return: str | [
"Returns",
"the",
"full",
"number",
"including",
"the",
"verification",
"digit",
"."
] | train | https://github.com/WhyNotHugo/django-afip/blob/5fb73213f1fe86ca52b501ffd0737911ef26ddb3/django_afip/pdf.py#L67-L76 |
MKLab-ITI/reveal-graph-embedding | reveal_graph_embedding/datautil/snow_datautil/snow_read_data.py | read_adjacency_matrix | def read_adjacency_matrix(file_path, separator, numbering="matlab"):
"""
Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format.
Inputs: - file_path: The path where the adjacency matrix is stored.
- separator: The delimiter among values (e.g. ",", ... | python | def read_adjacency_matrix(file_path, separator, numbering="matlab"):
"""
Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format.
Inputs: - file_path: The path where the adjacency matrix is stored.
- separator: The delimiter among values (e.g. ",", ... | [
"def",
"read_adjacency_matrix",
"(",
"file_path",
",",
"separator",
",",
"numbering",
"=",
"\"matlab\"",
")",
":",
"# Open file",
"file_row_generator",
"=",
"get_file_row_generator",
"(",
"file_path",
",",
"separator",
")",
"file_row",
"=",
"next",
"(",
"file_row_ge... | Reads an edge list in csv format and returns the adjacency matrix in SciPy Sparse COOrdinate format.
Inputs: - file_path: The path where the adjacency matrix is stored.
- separator: The delimiter among values (e.g. ",", "\t", " ")
- numbering: Array numbering style: * "matlab"
... | [
"Reads",
"an",
"edge",
"list",
"in",
"csv",
"format",
"and",
"returns",
"the",
"adjacency",
"matrix",
"in",
"SciPy",
"Sparse",
"COOrdinate",
"format",
"."
] | train | https://github.com/MKLab-ITI/reveal-graph-embedding/blob/eda862687aa5a64b79c6b12de1b4dca6ce986dc8/reveal_graph_embedding/datautil/snow_datautil/snow_read_data.py#L10-L78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.