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
bahattincinic/apistar_shell
apistar_shell/commands.py
shell_sqlalchemy
def shell_sqlalchemy(session: SqlalchemySession, backend: ShellBackend): """ This command includes SQLAlchemy DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
python
def shell_sqlalchemy(session: SqlalchemySession, backend: ShellBackend): """ This command includes SQLAlchemy DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
[ "def", "shell_sqlalchemy", "(", "session", ":", "SqlalchemySession", ",", "backend", ":", "ShellBackend", ")", ":", "namespace", "=", "{", "'session'", ":", "session", "}", "namespace", ".", "update", "(", "backend", ".", "get_namespace", "(", ")", ")", "emb...
This command includes SQLAlchemy DB Session
[ "This", "command", "includes", "SQLAlchemy", "DB", "Session" ]
train
https://github.com/bahattincinic/apistar_shell/blob/8b291fc514d668d6f8ff159da488adae242a338a/apistar_shell/commands.py#L9-L17
bahattincinic/apistar_shell
apistar_shell/commands.py
shell_django
def shell_django(session: DjangoSession, backend: ShellBackend): """ This command includes Django DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
python
def shell_django(session: DjangoSession, backend: ShellBackend): """ This command includes Django DB Session """ namespace = { 'session': session } namespace.update(backend.get_namespace()) embed(user_ns=namespace, header=backend.header)
[ "def", "shell_django", "(", "session", ":", "DjangoSession", ",", "backend", ":", "ShellBackend", ")", ":", "namespace", "=", "{", "'session'", ":", "session", "}", "namespace", ".", "update", "(", "backend", ".", "get_namespace", "(", ")", ")", "embed", "...
This command includes Django DB Session
[ "This", "command", "includes", "Django", "DB", "Session" ]
train
https://github.com/bahattincinic/apistar_shell/blob/8b291fc514d668d6f8ff159da488adae242a338a/apistar_shell/commands.py#L20-L28
Othernet-Project/squery-pg
squery_pg/squery_pg.py
Database.serialize_query
def serialize_query(func): """ Ensure any SQLExpression instances are serialized""" @functools.wraps(func) def wrapper(self, query, *args, **kwargs): if hasattr(query, 'serialize'): query = query.serialize() assert isinstance(query, basestring), 'Expected...
python
def serialize_query(func): """ Ensure any SQLExpression instances are serialized""" @functools.wraps(func) def wrapper(self, query, *args, **kwargs): if hasattr(query, 'serialize'): query = query.serialize() assert isinstance(query, basestring), 'Expected...
[ "def", "serialize_query", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "query", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "query", ",", "'serialize'", ...
Ensure any SQLExpression instances are serialized
[ "Ensure", "any", "SQLExpression", "instances", "are", "serialized" ]
train
https://github.com/Othernet-Project/squery-pg/blob/eaa695c3719e2d2b7e1b049bb58c987c132b6b34/squery_pg/squery_pg.py#L68-L80
rsalmaso/django-fluo
fluo/admin/models.py
ModelAdmin.autocomplete_view
def autocomplete_view(self, request): """ Searches in the fields of the given related model and returns the result as a simple string to be used by the jQuery Autocomplete plugin """ query = request.GET.get('q', None) app_label = request.GET.get('app_label', None) ...
python
def autocomplete_view(self, request): """ Searches in the fields of the given related model and returns the result as a simple string to be used by the jQuery Autocomplete plugin """ query = request.GET.get('q', None) app_label = request.GET.get('app_label', None) ...
[ "def", "autocomplete_view", "(", "self", ",", "request", ")", ":", "query", "=", "request", ".", "GET", ".", "get", "(", "'q'", ",", "None", ")", "app_label", "=", "request", ".", "GET", ".", "get", "(", "'app_label'", ",", "None", ")", "model_name", ...
Searches in the fields of the given related model and returns the result as a simple string to be used by the jQuery Autocomplete plugin
[ "Searches", "in", "the", "fields", "of", "the", "given", "related", "model", "and", "returns", "the", "result", "as", "a", "simple", "string", "to", "be", "used", "by", "the", "jQuery", "Autocomplete", "plugin" ]
train
https://github.com/rsalmaso/django-fluo/blob/1321c1e7d6a912108f79be02a9e7f2108c57f89f/fluo/admin/models.py#L137-L198
cuescience/goat
goat/model.py
Match.run
def run(self, context): """We have to overwrite this method because we don't want an implicit context """ args = [] kwargs = {} for arg in self.explicit_arguments: if arg.name is not None: kwargs[arg.name] = arg.value else: ...
python
def run(self, context): """We have to overwrite this method because we don't want an implicit context """ args = [] kwargs = {} for arg in self.explicit_arguments: if arg.name is not None: kwargs[arg.name] = arg.value else: ...
[ "def", "run", "(", "self", ",", "context", ")", ":", "args", "=", "[", "]", "kwargs", "=", "{", "}", "for", "arg", "in", "self", ".", "explicit_arguments", ":", "if", "arg", ".", "name", "is", "not", "None", ":", "kwargs", "[", "arg", ".", "name"...
We have to overwrite this method because we don't want an implicit context
[ "We", "have", "to", "overwrite", "this", "method", "because", "we", "don", "t", "want", "an", "implicit", "context" ]
train
https://github.com/cuescience/goat/blob/d76f44b9ec5dc40ad33abca50830c0d7492ef152/goat/model.py#L46-L99
cdeboever3/cdpybio
cdpybio/analysis.py
generate_null_snvs
def generate_null_snvs(df, snvs, num_null_sets=5): """ Generate a set of null SNVs based on an input list of SNVs and categorical annotations. Parameters ---------- df : pandas.DataFrame Pandas dataframe where each column is a categorization of SNPs. The index should be SN...
python
def generate_null_snvs(df, snvs, num_null_sets=5): """ Generate a set of null SNVs based on an input list of SNVs and categorical annotations. Parameters ---------- df : pandas.DataFrame Pandas dataframe where each column is a categorization of SNPs. The index should be SN...
[ "def", "generate_null_snvs", "(", "df", ",", "snvs", ",", "num_null_sets", "=", "5", ")", ":", "import", "numpy", "as", "np", "import", "random", "random", ".", "seed", "(", "20151007", ")", "input_snvs", "=", "list", "(", "set", "(", "df", ".", "index...
Generate a set of null SNVs based on an input list of SNVs and categorical annotations. Parameters ---------- df : pandas.DataFrame Pandas dataframe where each column is a categorization of SNPs. The index should be SNPs of the form chrom:pos. snvs : list List...
[ "Generate", "a", "set", "of", "null", "SNVs", "based", "on", "an", "input", "list", "of", "SNVs", "and", "categorical", "annotations", ".", "Parameters", "----------", "df", ":", "pandas", ".", "DataFrame", "Pandas", "dataframe", "where", "each", "column", "...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L47-L129
cdeboever3/cdpybio
cdpybio/analysis.py
make_grasp_phenotype_file
def make_grasp_phenotype_file(fn, pheno, out): """ Subset the GRASP database on a specific phenotype. Parameters ---------- fn : str Path to GRASP database file. pheno : str Phenotype to extract from database. out : sttr Path to output file for subset of GRASP ...
python
def make_grasp_phenotype_file(fn, pheno, out): """ Subset the GRASP database on a specific phenotype. Parameters ---------- fn : str Path to GRASP database file. pheno : str Phenotype to extract from database. out : sttr Path to output file for subset of GRASP ...
[ "def", "make_grasp_phenotype_file", "(", "fn", ",", "pheno", ",", "out", ")", ":", "import", "subprocess", "c", "=", "'awk -F \"\\\\t\" \\'NR == 1 || $12 == \"{}\" \\' {} > {}'", ".", "format", "(", "pheno", ".", "replace", "(", "\"'\"", ",", "'\\\\x27'", ")", ","...
Subset the GRASP database on a specific phenotype. Parameters ---------- fn : str Path to GRASP database file. pheno : str Phenotype to extract from database. out : sttr Path to output file for subset of GRASP database.
[ "Subset", "the", "GRASP", "database", "on", "a", "specific", "phenotype", ".", "Parameters", "----------", "fn", ":", "str", "Path", "to", "GRASP", "database", "file", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L131-L149
cdeboever3/cdpybio
cdpybio/analysis.py
parse_grasp_gwas
def parse_grasp_gwas(fn): """ Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of ...
python
def parse_grasp_gwas(fn): """ Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of ...
[ "def", "parse_grasp_gwas", "(", "fn", ")", ":", "df", "=", "pd", ".", "read_table", "(", "fn", ",", "low_memory", "=", "False", ")", "df", "=", "df", "[", "df", ".", "Pvalue", "<", "1e-5", "]", "df", "=", "df", ".", "sort", "(", "columns", "=", ...
Read GRASP database and filter for unique hits. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of the form chrom:pos where pos is the on...
[ "Read", "GRASP", "database", "and", "filter", "for", "unique", "hits", ".", "Parameters", "----------", "fn", ":", "str", "Path", "to", "(", "subset", "of", ")", "GRASP", "database", ".", "Returns", "-------", "df", ":", "pandas", ".", "DataFrame", "Pandas...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L151-L181
cdeboever3/cdpybio
cdpybio/analysis.py
parse_roadmap_gwas
def parse_roadmap_gwas(fn): """ Read Roadmap GWAS file and filter for unique, significant (p < 1e-5) SNPs. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significa...
python
def parse_roadmap_gwas(fn): """ Read Roadmap GWAS file and filter for unique, significant (p < 1e-5) SNPs. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significa...
[ "def", "parse_roadmap_gwas", "(", "fn", ")", ":", "df", "=", "pd", ".", "read_table", "(", "fn", ",", "low_memory", "=", "False", ",", "names", "=", "[", "'chrom'", ",", "'start'", ",", "'end'", ",", "'rsid'", ",", "'pvalue'", "]", ")", "df", "=", ...
Read Roadmap GWAS file and filter for unique, significant (p < 1e-5) SNPs. Parameters ---------- fn : str Path to (subset of) GRASP database. Returns ------- df : pandas.DataFrame Pandas dataframe with de-duplicated, significant SNPs. The index is of the for...
[ "Read", "Roadmap", "GWAS", "file", "and", "filter", "for", "unique", "significant", "(", "p", "<", "1e", "-", "5", ")", "SNPs", ".", "Parameters", "----------", "fn", ":", "str", "Path", "to", "(", "subset", "of", ")", "GRASP", "database", ".", "Return...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L183-L209
cdeboever3/cdpybio
cdpybio/analysis.py
ld_prune
def ld_prune(df, ld_beds, snvs=None): """ Prune set of GWAS based on LD and significance. A graph of all SNVs is constructed with edges for LD >= 0.8 and the most significant SNV per connected component is kept. Parameters ---------- df : pandas.DataFrame Pandas dataframe with ...
python
def ld_prune(df, ld_beds, snvs=None): """ Prune set of GWAS based on LD and significance. A graph of all SNVs is constructed with edges for LD >= 0.8 and the most significant SNV per connected component is kept. Parameters ---------- df : pandas.DataFrame Pandas dataframe with ...
[ "def", "ld_prune", "(", "df", ",", "ld_beds", ",", "snvs", "=", "None", ")", ":", "import", "networkx", "as", "nx", "import", "tabix", "if", "snvs", ":", "df", "=", "df", ".", "ix", "[", "set", "(", "df", ".", "index", ")", "&", "set", "(", "sn...
Prune set of GWAS based on LD and significance. A graph of all SNVs is constructed with edges for LD >= 0.8 and the most significant SNV per connected component is kept. Parameters ---------- df : pandas.DataFrame Pandas dataframe with unique SNVs. The index is of the form chrom:pos ...
[ "Prune", "set", "of", "GWAS", "based", "on", "LD", "and", "significance", ".", "A", "graph", "of", "all", "SNVs", "is", "constructed", "with", "edges", "for", "LD", ">", "=", "0", ".", "8", "and", "the", "most", "significant", "SNV", "per", "connected"...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L211-L299
cdeboever3/cdpybio
cdpybio/analysis.py
ld_expand
def ld_expand(df, ld_beds): """ Expand a set of SNVs into all SNVs with LD >= 0.8 and return a BedTool of the expanded SNPs. Parameters ---------- df : pandas.DataFrame Pandas dataframe with SNVs. The index is of the form chrom:pos where pos is the one-based position of the ...
python
def ld_expand(df, ld_beds): """ Expand a set of SNVs into all SNVs with LD >= 0.8 and return a BedTool of the expanded SNPs. Parameters ---------- df : pandas.DataFrame Pandas dataframe with SNVs. The index is of the form chrom:pos where pos is the one-based position of the ...
[ "def", "ld_expand", "(", "df", ",", "ld_beds", ")", ":", "import", "pybedtools", "as", "pbt", "import", "tabix", "out_snps", "=", "[", "]", "for", "chrom", "in", "ld_beds", ".", "keys", "(", ")", ":", "t", "=", "tabix", ".", "open", "(", "ld_beds", ...
Expand a set of SNVs into all SNVs with LD >= 0.8 and return a BedTool of the expanded SNPs. Parameters ---------- df : pandas.DataFrame Pandas dataframe with SNVs. The index is of the form chrom:pos where pos is the one-based position of the SNV. The columns are chrom, start, end. ...
[ "Expand", "a", "set", "of", "SNVs", "into", "all", "SNVs", "with", "LD", ">", "=", "0", ".", "8", "and", "return", "a", "BedTool", "of", "the", "expanded", "SNPs", ".", "Parameters", "----------", "df", ":", "pandas", ".", "DataFrame", "Pandas", "dataf...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L301-L352
cdeboever3/cdpybio
cdpybio/analysis.py
liftover_bed
def liftover_bed( bed, chain, mapped=None, unmapped=None, liftOver_path='liftOver', ): """ Lift over a bed file using a given chain file. Parameters ---------- bed : str or pybedtools.BedTool Coordinates to lift over. chain : str Path to chain fi...
python
def liftover_bed( bed, chain, mapped=None, unmapped=None, liftOver_path='liftOver', ): """ Lift over a bed file using a given chain file. Parameters ---------- bed : str or pybedtools.BedTool Coordinates to lift over. chain : str Path to chain fi...
[ "def", "liftover_bed", "(", "bed", ",", "chain", ",", "mapped", "=", "None", ",", "unmapped", "=", "None", ",", "liftOver_path", "=", "'liftOver'", ",", ")", ":", "import", "subprocess", "import", "pybedtools", "as", "pbt", "if", "mapped", "==", "None", ...
Lift over a bed file using a given chain file. Parameters ---------- bed : str or pybedtools.BedTool Coordinates to lift over. chain : str Path to chain file to use for lift over. mapped : str Path for bed file with coordinates that are lifted over correctly. ...
[ "Lift", "over", "a", "bed", "file", "using", "a", "given", "chain", "file", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L354-L437
cdeboever3/cdpybio
cdpybio/analysis.py
deseq2_size_factors
def deseq2_size_factors(counts, meta, design): """ Get size factors for counts using DESeq2. Parameters ---------- counts : pandas.DataFrame Counts to pass to DESeq2. meta : pandas.DataFrame Pandas dataframe whose index matches the columns of counts. This is passed to D...
python
def deseq2_size_factors(counts, meta, design): """ Get size factors for counts using DESeq2. Parameters ---------- counts : pandas.DataFrame Counts to pass to DESeq2. meta : pandas.DataFrame Pandas dataframe whose index matches the columns of counts. This is passed to D...
[ "def", "deseq2_size_factors", "(", "counts", ",", "meta", ",", "design", ")", ":", "import", "rpy2", ".", "robjects", "as", "r", "from", "rpy2", ".", "robjects", "import", "pandas2ri", "pandas2ri", ".", "activate", "(", ")", "r", ".", "r", "(", "'suppres...
Get size factors for counts using DESeq2. Parameters ---------- counts : pandas.DataFrame Counts to pass to DESeq2. meta : pandas.DataFrame Pandas dataframe whose index matches the columns of counts. This is passed to DESeq2's colData. design : str Design like ~sub...
[ "Get", "size", "factors", "for", "counts", "using", "DESeq2", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L439-L475
cdeboever3/cdpybio
cdpybio/analysis.py
goseq_gene_enrichment
def goseq_gene_enrichment(genes, sig, plot_fn=None, length_correct=True): """ Perform goseq enrichment for an Ensembl gene set. Parameters ---------- genes : list List of all genes as Ensembl IDs. sig : list List of boolean values indicating whether each gene is signifi...
python
def goseq_gene_enrichment(genes, sig, plot_fn=None, length_correct=True): """ Perform goseq enrichment for an Ensembl gene set. Parameters ---------- genes : list List of all genes as Ensembl IDs. sig : list List of boolean values indicating whether each gene is signifi...
[ "def", "goseq_gene_enrichment", "(", "genes", ",", "sig", ",", "plot_fn", "=", "None", ",", "length_correct", "=", "True", ")", ":", "import", "os", "import", "readline", "import", "statsmodels", ".", "stats", ".", "multitest", "as", "smm", "import", "rpy2",...
Perform goseq enrichment for an Ensembl gene set. Parameters ---------- genes : list List of all genes as Ensembl IDs. sig : list List of boolean values indicating whether each gene is significant or not. plot_fn : str Path to save length bias plot to. If n...
[ "Perform", "goseq", "enrichment", "for", "an", "Ensembl", "gene", "set", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L477-L537
cdeboever3/cdpybio
cdpybio/analysis.py
categories_to_colors
def categories_to_colors(cats, colormap=None): """ Map categorical data to colors. Parameters ---------- cats : pandas.Series or list Categorical data as a list or in a Series. colormap : list List of RGB triples. If not provided, the tableau20 colormap defined in this...
python
def categories_to_colors(cats, colormap=None): """ Map categorical data to colors. Parameters ---------- cats : pandas.Series or list Categorical data as a list or in a Series. colormap : list List of RGB triples. If not provided, the tableau20 colormap defined in this...
[ "def", "categories_to_colors", "(", "cats", ",", "colormap", "=", "None", ")", ":", "if", "colormap", "is", "None", ":", "colormap", "=", "tableau20", "if", "type", "(", "cats", ")", "!=", "pd", ".", "Series", ":", "cats", "=", "pd", ".", "Series", "...
Map categorical data to colors. Parameters ---------- cats : pandas.Series or list Categorical data as a list or in a Series. colormap : list List of RGB triples. If not provided, the tableau20 colormap defined in this module will be used. Returns ------- legend : ...
[ "Map", "categorical", "data", "to", "colors", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L539-L569
cdeboever3/cdpybio
cdpybio/analysis.py
plot_color_legend
def plot_color_legend(legend, horizontal=False, ax=None): """ Plot a pandas Series with labels and colors. Parameters ---------- legend : pandas.Series Pandas Series whose values are RGB triples and whose index contains categorical labels. horizontal : bool If True, plo...
python
def plot_color_legend(legend, horizontal=False, ax=None): """ Plot a pandas Series with labels and colors. Parameters ---------- legend : pandas.Series Pandas Series whose values are RGB triples and whose index contains categorical labels. horizontal : bool If True, plo...
[ "def", "plot_color_legend", "(", "legend", ",", "horizontal", "=", "False", ",", "ax", "=", "None", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "import", "numpy", "as", "np", "t", "=", "np", ".", "array", "(", "[", "np", ".", "array...
Plot a pandas Series with labels and colors. Parameters ---------- legend : pandas.Series Pandas Series whose values are RGB triples and whose index contains categorical labels. horizontal : bool If True, plot horizontally. ax : matplotlib.axis Axis to plot on. ...
[ "Plot", "a", "pandas", "Series", "with", "labels", "and", "colors", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L571-L609
cdeboever3/cdpybio
cdpybio/analysis.py
make_color_legend_rects
def make_color_legend_rects(colors, labels=None): """ Make list of rectangles and labels for making legends. Parameters ---------- colors : pandas.Series or list Pandas series whose values are colors and index is labels. Alternatively, you can provide a list with colors and provide...
python
def make_color_legend_rects(colors, labels=None): """ Make list of rectangles and labels for making legends. Parameters ---------- colors : pandas.Series or list Pandas series whose values are colors and index is labels. Alternatively, you can provide a list with colors and provide...
[ "def", "make_color_legend_rects", "(", "colors", ",", "labels", "=", "None", ")", ":", "from", "matplotlib", ".", "pyplot", "import", "Rectangle", "if", "labels", ":", "d", "=", "dict", "(", "zip", "(", "labels", ",", "colors", ")", ")", "se", "=", "pd...
Make list of rectangles and labels for making legends. Parameters ---------- colors : pandas.Series or list Pandas series whose values are colors and index is labels. Alternatively, you can provide a list with colors and provide the labels as a list. labels : list If co...
[ "Make", "list", "of", "rectangles", "and", "labels", "for", "making", "legends", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L611-L649
cdeboever3/cdpybio
cdpybio/analysis.py
manhattan_plot
def manhattan_plot( res, ax, p_filter=1, p_cutoff=None, marker_size=10, font_size=8, chrom_labels=range(1, 23)[0::2], label_column=None, category_order=None, legend=True, ): """ Make Manhattan plot for GWAS results. Currently only support autosomes. Parameter...
python
def manhattan_plot( res, ax, p_filter=1, p_cutoff=None, marker_size=10, font_size=8, chrom_labels=range(1, 23)[0::2], label_column=None, category_order=None, legend=True, ): """ Make Manhattan plot for GWAS results. Currently only support autosomes. Parameter...
[ "def", "manhattan_plot", "(", "res", ",", "ax", ",", "p_filter", "=", "1", ",", "p_cutoff", "=", "None", ",", "marker_size", "=", "10", ",", "font_size", "=", "8", ",", "chrom_labels", "=", "range", "(", "1", ",", "23", ")", "[", "0", ":", ":", "...
Make Manhattan plot for GWAS results. Currently only support autosomes. Parameters ---------- res : pandas.DataFrame GWAS results. The following columns are required - chrom (chromsome, int), pos (genomic position, int), P (GWAS p-value, float). ax : matplotlib.axis ...
[ "Make", "Manhattan", "plot", "for", "GWAS", "results", ".", "Currently", "only", "support", "autosomes", ".", "Parameters", "----------", "res", ":", "pandas", ".", "DataFrame", "GWAS", "results", ".", "The", "following", "columns", "are", "required", "-", "ch...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L992-L1208
cdeboever3/cdpybio
cdpybio/analysis.py
SVD.plot_variance_explained
def plot_variance_explained(self, cumulative=False, xtick_start=1, xtick_spacing=1, num_pc=None): """ Plot amount of variance explained by each principal component. Parameters ---------- num_pc : int Number of principal components...
python
def plot_variance_explained(self, cumulative=False, xtick_start=1, xtick_spacing=1, num_pc=None): """ Plot amount of variance explained by each principal component. Parameters ---------- num_pc : int Number of principal components...
[ "def", "plot_variance_explained", "(", "self", ",", "cumulative", "=", "False", ",", "xtick_start", "=", "1", ",", "xtick_spacing", "=", "1", ",", "num_pc", "=", "None", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "from", "numpy", "import...
Plot amount of variance explained by each principal component. Parameters ---------- num_pc : int Number of principal components to plot. If None, plot all. cumulative : bool If True, include cumulative variance. xtick_start : int ...
[ "Plot", "amount", "of", "variance", "explained", "by", "each", "principal", "component", ".", "Parameters", "----------", "num_pc", ":", "int", "Number", "of", "principal", "components", "to", "plot", ".", "If", "None", "plot", "all", ".", "cumulative", ":", ...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L704-L753
cdeboever3/cdpybio
cdpybio/analysis.py
SVD.plot_pc_scatter
def plot_pc_scatter(self, pc1, pc2, v=True, subset=None, ax=None, color=None, s=None, marker=None, color_name=None, s_name=None, marker_name=None): """ Make a scatter plot of two principal components. You can create differently colored, sized, or m...
python
def plot_pc_scatter(self, pc1, pc2, v=True, subset=None, ax=None, color=None, s=None, marker=None, color_name=None, s_name=None, marker_name=None): """ Make a scatter plot of two principal components. You can create differently colored, sized, or m...
[ "def", "plot_pc_scatter", "(", "self", ",", "pc1", ",", "pc2", ",", "v", "=", "True", ",", "subset", "=", "None", ",", "ax", "=", "None", ",", "color", "=", "None", ",", "s", "=", "None", ",", "marker", "=", "None", ",", "color_name", "=", "None"...
Make a scatter plot of two principal components. You can create differently colored, sized, or marked scatter points. Parameters ---------- pc1 : str String of form PCX where X is the number of the principal component you want to plot on the x-axis. ...
[ "Make", "a", "scatter", "plot", "of", "two", "principal", "components", ".", "You", "can", "create", "differently", "colored", "sized", "or", "marked", "scatter", "points", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L755-L909
cdeboever3/cdpybio
cdpybio/analysis.py
SVD.pc_correlation
def pc_correlation(self, covariates, num_pc=5): """ Calculate the correlation between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFr...
python
def pc_correlation(self, covariates, num_pc=5): """ Calculate the correlation between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFr...
[ "def", "pc_correlation", "(", "self", ",", "covariates", ",", "num_pc", "=", "5", ")", ":", "from", "scipy", ".", "stats", "import", "spearmanr", "if", "(", "covariates", ".", "shape", "[", "0", "]", "==", "self", ".", "u", ".", "shape", "[", "0", ...
Calculate the correlation between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFrame Dataframe of covariates whose index corresponds to t...
[ "Calculate", "the", "correlation", "between", "the", "first", "num_pc", "prinicipal", "components", "and", "known", "covariates", ".", "The", "size", "and", "index", "of", "covariates", "determines", "whether", "u", "or", "v", "is", "used", "." ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L911-L951
cdeboever3/cdpybio
cdpybio/analysis.py
SVD.pc_anova
def pc_anova(self, covariates, num_pc=5): """ Calculate one-way ANOVA between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFrame...
python
def pc_anova(self, covariates, num_pc=5): """ Calculate one-way ANOVA between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFrame...
[ "def", "pc_anova", "(", "self", ",", "covariates", ",", "num_pc", "=", "5", ")", ":", "from", "scipy", ".", "stats", "import", "f_oneway", "if", "(", "covariates", ".", "shape", "[", "0", "]", "==", "self", ".", "u", ".", "shape", "[", "0", "]", ...
Calculate one-way ANOVA between the first num_pc prinicipal components and known covariates. The size and index of covariates determines whether u or v is used. Parameters ---------- covariates : pandas.DataFrame Dataframe of covariates whose index corresponds to...
[ "Calculate", "one", "-", "way", "ANOVA", "between", "the", "first", "num_pc", "prinicipal", "components", "and", "known", "covariates", ".", "The", "size", "and", "index", "of", "covariates", "determines", "whether", "u", "or", "v", "is", "used", ".", "Param...
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L953-L990
siku2/Loglette
loglette/parser/__init__.py
Parser.can_handle
def can_handle(self, text: str) -> bool: """Check whether this parser can parse the text""" try: changelogs = self.split_changelogs(text) if not changelogs: return False for changelog in changelogs: _header, _changes = self.split_change...
python
def can_handle(self, text: str) -> bool: """Check whether this parser can parse the text""" try: changelogs = self.split_changelogs(text) if not changelogs: return False for changelog in changelogs: _header, _changes = self.split_change...
[ "def", "can_handle", "(", "self", ",", "text", ":", "str", ")", "->", "bool", ":", "try", ":", "changelogs", "=", "self", ".", "split_changelogs", "(", "text", ")", "if", "not", "changelogs", ":", "return", "False", "for", "changelog", "in", "changelogs"...
Check whether this parser can parse the text
[ "Check", "whether", "this", "parser", "can", "parse", "the", "text" ]
train
https://github.com/siku2/Loglette/blob/d69f99c3ead2bb24f2aa491a61a7f82cb9ca8095/loglette/parser/__init__.py#L23-L41
lvh/maxims
maxims/named.py
remember
def remember(empowered, powerupClass, interface): """ Adds a powerup to ``empowered`` that will instantiate ``powerupClass`` with the empowered's store when adapted to the given interface. :param empowered: The Empowered (Store or Item) to be powered up. :type empowered: ``axiom.item.Empowered`` ...
python
def remember(empowered, powerupClass, interface): """ Adds a powerup to ``empowered`` that will instantiate ``powerupClass`` with the empowered's store when adapted to the given interface. :param empowered: The Empowered (Store or Item) to be powered up. :type empowered: ``axiom.item.Empowered`` ...
[ "def", "remember", "(", "empowered", ",", "powerupClass", ",", "interface", ")", ":", "className", "=", "fullyQualifiedName", "(", "powerupClass", ")", "powerup", "=", "_StoredByName", "(", "store", "=", "empowered", ".", "store", ",", "className", "=", "class...
Adds a powerup to ``empowered`` that will instantiate ``powerupClass`` with the empowered's store when adapted to the given interface. :param empowered: The Empowered (Store or Item) to be powered up. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class that will be powered up to. ...
[ "Adds", "a", "powerup", "to", "empowered", "that", "will", "instantiate", "powerupClass", "with", "the", "empowered", "s", "store", "when", "adapted", "to", "the", "given", "interface", "." ]
train
https://github.com/lvh/maxims/blob/5c53b25d2cc4ccecbfe90193ade9ce0dbfbe4623/maxims/named.py#L26-L41
lvh/maxims
maxims/named.py
forget
def forget(empowered, powerupClass, interface): """ Forgets powerups previously stored with ``remember``. :param empowered: The Empowered (Store or Item) to be powered down. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class for which powerups will be forgotten. :type powe...
python
def forget(empowered, powerupClass, interface): """ Forgets powerups previously stored with ``remember``. :param empowered: The Empowered (Store or Item) to be powered down. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class for which powerups will be forgotten. :type powe...
[ "def", "forget", "(", "empowered", ",", "powerupClass", ",", "interface", ")", ":", "className", "=", "fullyQualifiedName", "(", "powerupClass", ")", "withThisName", "=", "_StoredByName", ".", "className", "==", "className", "items", "=", "empowered", ".", "stor...
Forgets powerups previously stored with ``remember``. :param empowered: The Empowered (Store or Item) to be powered down. :type empowered: ``axiom.item.Empowered`` :param powerupClass: The class for which powerups will be forgotten. :type powerupClass: class :param interface: The interface the powe...
[ "Forgets", "powerups", "previously", "stored", "with", "remember", "." ]
train
https://github.com/lvh/maxims/blob/5c53b25d2cc4ccecbfe90193ade9ce0dbfbe4623/maxims/named.py#L44-L67
mayfield/cellulario
cellulario/iocell.py
IOCell.init_event_loop
def init_event_loop(self): """ Every cell should have its own event loop for proper containment. The type of event loop is not so important however. """ self.loop = asyncio.new_event_loop() self.loop.set_debug(self.debug) if hasattr(self.loop, '_set_coroutine_wrapper'): ...
python
def init_event_loop(self): """ Every cell should have its own event loop for proper containment. The type of event loop is not so important however. """ self.loop = asyncio.new_event_loop() self.loop.set_debug(self.debug) if hasattr(self.loop, '_set_coroutine_wrapper'): ...
[ "def", "init_event_loop", "(", "self", ")", ":", "self", ".", "loop", "=", "asyncio", ".", "new_event_loop", "(", ")", "self", ".", "loop", ".", "set_debug", "(", "self", ".", "debug", ")", "if", "hasattr", "(", "self", ".", "loop", ",", "'_set_corouti...
Every cell should have its own event loop for proper containment. The type of event loop is not so important however.
[ "Every", "cell", "should", "have", "its", "own", "event", "loop", "for", "proper", "containment", ".", "The", "type", "of", "event", "loop", "is", "not", "so", "important", "however", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L82-L97
mayfield/cellulario
cellulario/iocell.py
IOCell.cleanup_event_loop
def cleanup_event_loop(self): """ Cleanup an event loop and close it down forever. """ for task in asyncio.Task.all_tasks(loop=self.loop): if self.debug: warnings.warn('Cancelling task: %s' % task) task._log_destroy_pending = False task.cancel() ...
python
def cleanup_event_loop(self): """ Cleanup an event loop and close it down forever. """ for task in asyncio.Task.all_tasks(loop=self.loop): if self.debug: warnings.warn('Cancelling task: %s' % task) task._log_destroy_pending = False task.cancel() ...
[ "def", "cleanup_event_loop", "(", "self", ")", ":", "for", "task", "in", "asyncio", ".", "Task", ".", "all_tasks", "(", "loop", "=", "self", ".", "loop", ")", ":", "if", "self", ".", "debug", ":", "warnings", ".", "warn", "(", "'Cancelling task: %s'", ...
Cleanup an event loop and close it down forever.
[ "Cleanup", "an", "event", "loop", "and", "close", "it", "down", "forever", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L99-L110
mayfield/cellulario
cellulario/iocell.py
IOCell.add_tier
def add_tier(self, coro, **kwargs): """ Add a coroutine to the cell as a task tier. The source can be a single value or a list of either `Tier` types or coroutine functions already added to a `Tier` via `add_tier`. """ self.assertNotFinalized() assert asyncio.iscoroutinefunction...
python
def add_tier(self, coro, **kwargs): """ Add a coroutine to the cell as a task tier. The source can be a single value or a list of either `Tier` types or coroutine functions already added to a `Tier` via `add_tier`. """ self.assertNotFinalized() assert asyncio.iscoroutinefunction...
[ "def", "add_tier", "(", "self", ",", "coro", ",", "*", "*", "kwargs", ")", ":", "self", ".", "assertNotFinalized", "(", ")", "assert", "asyncio", ".", "iscoroutinefunction", "(", "coro", ")", "tier", "=", "self", ".", "Tier", "(", "self", ",", "coro", ...
Add a coroutine to the cell as a task tier. The source can be a single value or a list of either `Tier` types or coroutine functions already added to a `Tier` via `add_tier`.
[ "Add", "a", "coroutine", "to", "the", "cell", "as", "a", "task", "tier", ".", "The", "source", "can", "be", "a", "single", "value", "or", "a", "list", "of", "either", "Tier", "types", "or", "coroutine", "functions", "already", "added", "to", "a", "Tier...
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L123-L132
mayfield/cellulario
cellulario/iocell.py
IOCell.append_tier
def append_tier(self, coro, **kwargs): """ Implicitly source from the tail tier like a pipe. """ source = self.tiers[-1] if self.tiers else None return self.add_tier(coro, source=source, **kwargs)
python
def append_tier(self, coro, **kwargs): """ Implicitly source from the tail tier like a pipe. """ source = self.tiers[-1] if self.tiers else None return self.add_tier(coro, source=source, **kwargs)
[ "def", "append_tier", "(", "self", ",", "coro", ",", "*", "*", "kwargs", ")", ":", "source", "=", "self", ".", "tiers", "[", "-", "1", "]", "if", "self", ".", "tiers", "else", "None", "return", "self", ".", "add_tier", "(", "coro", ",", "source", ...
Implicitly source from the tail tier like a pipe.
[ "Implicitly", "source", "from", "the", "tail", "tier", "like", "a", "pipe", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L134-L137
mayfield/cellulario
cellulario/iocell.py
IOCell.tier
def tier(self, *args, append=True, source=None, **kwargs): """ Function decorator for a tier coroutine. If the function being decorated is not already a coroutine function it will be wrapped. """ if len(args) == 1 and not kwargs and callable(args[0]): raise TypeError('Uncalled decor...
python
def tier(self, *args, append=True, source=None, **kwargs): """ Function decorator for a tier coroutine. If the function being decorated is not already a coroutine function it will be wrapped. """ if len(args) == 1 and not kwargs and callable(args[0]): raise TypeError('Uncalled decor...
[ "def", "tier", "(", "self", ",", "*", "args", ",", "append", "=", "True", ",", "source", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", "and", "not", "kwargs", "and", "callable", "(", "args", "[", "0",...
Function decorator for a tier coroutine. If the function being decorated is not already a coroutine function it will be wrapped.
[ "Function", "decorator", "for", "a", "tier", "coroutine", ".", "If", "the", "function", "being", "decorated", "is", "not", "already", "a", "coroutine", "function", "it", "will", "be", "wrapped", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L145-L159
mayfield/cellulario
cellulario/iocell.py
IOCell.cleaner
def cleaner(self, coro): """ Function decorator for a cleanup coroutine. """ if not asyncio.iscoroutinefunction(coro): coro = asyncio.coroutine(coro) self.add_cleaner(coro) return coro
python
def cleaner(self, coro): """ Function decorator for a cleanup coroutine. """ if not asyncio.iscoroutinefunction(coro): coro = asyncio.coroutine(coro) self.add_cleaner(coro) return coro
[ "def", "cleaner", "(", "self", ",", "coro", ")", ":", "if", "not", "asyncio", ".", "iscoroutinefunction", "(", "coro", ")", ":", "coro", "=", "asyncio", ".", "coroutine", "(", "coro", ")", "self", ".", "add_cleaner", "(", "coro", ")", "return", "coro" ...
Function decorator for a cleanup coroutine.
[ "Function", "decorator", "for", "a", "cleanup", "coroutine", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L161-L166
mayfield/cellulario
cellulario/iocell.py
IOCell.finalize
def finalize(self): """ Look at our tiers and setup the final data flow. Once this is run a cell can not be modified again. """ self.assertNotFinalized() starters = [] finishers = [] for x in self.tiers: if not x.sources: starters.append(x) ...
python
def finalize(self): """ Look at our tiers and setup the final data flow. Once this is run a cell can not be modified again. """ self.assertNotFinalized() starters = [] finishers = [] for x in self.tiers: if not x.sources: starters.append(x) ...
[ "def", "finalize", "(", "self", ")", ":", "self", ".", "assertNotFinalized", "(", ")", "starters", "=", "[", "]", "finishers", "=", "[", "]", "for", "x", "in", "self", ".", "tiers", ":", "if", "not", "x", ".", "sources", ":", "starters", ".", "appe...
Look at our tiers and setup the final data flow. Once this is run a cell can not be modified again.
[ "Look", "at", "our", "tiers", "and", "setup", "the", "final", "data", "flow", ".", "Once", "this", "is", "run", "a", "cell", "can", "not", "be", "modified", "again", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L168-L182
mayfield/cellulario
cellulario/iocell.py
IOCell.output
def output(self): """ Produce a classic generator for this cell's final results. """ starters = self.finalize() try: yield from self._output(starters) finally: self.close()
python
def output(self): """ Produce a classic generator for this cell's final results. """ starters = self.finalize() try: yield from self._output(starters) finally: self.close()
[ "def", "output", "(", "self", ")", ":", "starters", "=", "self", ".", "finalize", "(", ")", "try", ":", "yield", "from", "self", ".", "_output", "(", "starters", ")", "finally", ":", "self", ".", "close", "(", ")" ]
Produce a classic generator for this cell's final results.
[ "Produce", "a", "classic", "generator", "for", "this", "cell", "s", "final", "results", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L200-L206
mayfield/cellulario
cellulario/iocell.py
IOCell.event_loop
def event_loop(self): """ Run the event loop once. """ if hasattr(self.loop, '._run_once'): self.loop._thread_id = threading.get_ident() try: self.loop._run_once() finally: self.loop._thread_id = None else: self.loop...
python
def event_loop(self): """ Run the event loop once. """ if hasattr(self.loop, '._run_once'): self.loop._thread_id = threading.get_ident() try: self.loop._run_once() finally: self.loop._thread_id = None else: self.loop...
[ "def", "event_loop", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "loop", ",", "'._run_once'", ")", ":", "self", ".", "loop", ".", "_thread_id", "=", "threading", ".", "get_ident", "(", ")", "try", ":", "self", ".", "loop", ".", "_run_on...
Run the event loop once.
[ "Run", "the", "event", "loop", "once", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L208-L218
mayfield/cellulario
cellulario/iocell.py
IOCell.clean
def clean(self): """ Run all of the cleaners added by the user. """ if self.cleaners: yield from asyncio.wait([x() for x in self.cleaners], loop=self.loop)
python
def clean(self): """ Run all of the cleaners added by the user. """ if self.cleaners: yield from asyncio.wait([x() for x in self.cleaners], loop=self.loop)
[ "def", "clean", "(", "self", ")", ":", "if", "self", ".", "cleaners", ":", "yield", "from", "asyncio", ".", "wait", "(", "[", "x", "(", ")", "for", "x", "in", "self", ".", "cleaners", "]", ",", "loop", "=", "self", ".", "loop", ")" ]
Run all of the cleaners added by the user.
[ "Run", "all", "of", "the", "cleaners", "added", "by", "the", "user", "." ]
train
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L248-L252
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.convert_keys
def convert_keys(self, pydict): """Convert field_name to field_key. {"field_name": value} => {"field_key": value} """ new_dict = dict() for key, value in pydict.items(): new_dict[self.get_field_key(key)] = value return new_dict
python
def convert_keys(self, pydict): """Convert field_name to field_key. {"field_name": value} => {"field_key": value} """ new_dict = dict() for key, value in pydict.items(): new_dict[self.get_field_key(key)] = value return new_dict
[ "def", "convert_keys", "(", "self", ",", "pydict", ")", ":", "new_dict", "=", "dict", "(", ")", "for", "key", ",", "value", "in", "pydict", ".", "items", "(", ")", ":", "new_dict", "[", "self", ".", "get_field_key", "(", "key", ")", "]", "=", "valu...
Convert field_name to field_key. {"field_name": value} => {"field_key": value}
[ "Convert", "field_name", "to", "field_key", ".", "{", "field_name", ":", "value", "}", "=", ">", "{", "field_key", ":", "value", "}" ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L40-L48
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.get_html_values
def get_html_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using html data format. """ new_dict = {"id": pydict["id"]} for field in self: if field.key in pydict: if recovery_n...
python
def get_html_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using html data format. """ new_dict = {"id": pydict["id"]} for field in self: if field.key in pydict: if recovery_n...
[ "def", "get_html_values", "(", "self", ",", "pydict", ",", "recovery_name", "=", "True", ")", ":", "new_dict", "=", "{", "\"id\"", ":", "pydict", "[", "\"id\"", "]", "}", "for", "field", "in", "self", ":", "if", "field", ".", "key", "in", "pydict", "...
Convert naive get response data to human readable field name format. using html data format.
[ "Convert", "naive", "get", "response", "data", "to", "human", "readable", "field", "name", "format", ".", "using", "html", "data", "format", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L50-L62
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.get_raw_values
def get_raw_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using raw data format. """ new_dict = {"id": pydict["id"]} for field in self: raw_key = "%s_raw" % field.key if raw_key i...
python
def get_raw_values(self, pydict, recovery_name=True): """Convert naive get response data to human readable field name format. using raw data format. """ new_dict = {"id": pydict["id"]} for field in self: raw_key = "%s_raw" % field.key if raw_key i...
[ "def", "get_raw_values", "(", "self", ",", "pydict", ",", "recovery_name", "=", "True", ")", ":", "new_dict", "=", "{", "\"id\"", ":", "pydict", "[", "\"id\"", "]", "}", "for", "field", "in", "self", ":", "raw_key", "=", "\"%s_raw\"", "%", "field", "."...
Convert naive get response data to human readable field name format. using raw data format.
[ "Convert", "naive", "get", "response", "data", "to", "human", "readable", "field", "name", "format", ".", "using", "raw", "data", "format", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L64-L77
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.convert_values
def convert_values(self, pydict): """Convert knackhq data type instance to json friendly data. """ new_dict = dict() for key, value in pydict.items(): try: # is it's BaseDataType Instance new_dict[key] = value._data except AttributeError: ...
python
def convert_values(self, pydict): """Convert knackhq data type instance to json friendly data. """ new_dict = dict() for key, value in pydict.items(): try: # is it's BaseDataType Instance new_dict[key] = value._data except AttributeError: ...
[ "def", "convert_values", "(", "self", ",", "pydict", ")", ":", "new_dict", "=", "dict", "(", ")", "for", "key", ",", "value", "in", "pydict", ".", "items", "(", ")", ":", "try", ":", "# is it's BaseDataType Instance", "new_dict", "[", "key", "]", "=", ...
Convert knackhq data type instance to json friendly data.
[ "Convert", "knackhq", "data", "type", "instance", "to", "json", "friendly", "data", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L79-L88
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.insert_one
def insert_one(self, data, using_name=True): """Insert one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#create For more information of the raw structure of all data type, read this: http://helpdesk.knackhq.com/...
python
def insert_one(self, data, using_name=True): """Insert one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#create For more information of the raw structure of all data type, read this: http://helpdesk.knackhq.com/...
[ "def", "insert_one", "(", "self", ",", "data", ",", "using_name", "=", "True", ")", ":", "data", "=", "self", ".", "convert_values", "(", "data", ")", "if", "using_name", ":", "data", "=", "self", ".", "convert_keys", "(", "data", ")", "res", "=", "s...
Insert one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#create For more information of the raw structure of all data type, read this: http://helpdesk.knackhq.com/support/solutions/articles/5000446405-field-types ...
[ "Insert", "one", "record", ".", "Ref", ":", "http", ":", "//", "helpdesk", ".", "knackhq", ".", "com", "/", "support", "/", "solutions", "/", "articles", "/", "5000446111", "-", "api", "-", "reference", "-", "root", "-", "access#create", "For", "more", ...
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L93-L113
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.insert
def insert(self, data, using_name=True): """Insert one or many records. :param data: dict type data or list of dict :param using_name: if you are using field name in data, please set using_name = True (it's the default), otherwise, False **中文文档** 插入...
python
def insert(self, data, using_name=True): """Insert one or many records. :param data: dict type data or list of dict :param using_name: if you are using field name in data, please set using_name = True (it's the default), otherwise, False **中文文档** 插入...
[ "def", "insert", "(", "self", ",", "data", ",", "using_name", "=", "True", ")", ":", "if", "isinstance", "(", "data", ",", "list", ")", ":", "# if iterable, insert one by one", "for", "d", "in", "data", ":", "self", ".", "insert_one", "(", "d", ",", "u...
Insert one or many records. :param data: dict type data or list of dict :param using_name: if you are using field name in data, please set using_name = True (it's the default), otherwise, False **中文文档** 插入多条记录
[ "Insert", "one", "or", "many", "records", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L115-L130
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.find_one
def find_one(self, id_, raw=True, recovery_name=True): """Find one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#retrieve :param id_: record id_ :param using_name: if you are using field name in filter and sort_...
python
def find_one(self, id_, raw=True, recovery_name=True): """Find one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#retrieve :param id_: record id_ :param using_name: if you are using field name in filter and sort_...
[ "def", "find_one", "(", "self", ",", "id_", ",", "raw", "=", "True", ",", "recovery_name", "=", "True", ")", ":", "url", "=", "\"https://api.knackhq.com/v1/objects/%s/records/%s\"", "%", "(", "self", ".", "key", ",", "id_", ")", "res", "=", "self", ".", ...
Find one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#retrieve :param id_: record id_ :param using_name: if you are using field name in filter and sort_field, please set using_name = True (it's the default),...
[ "Find", "one", "record", ".", "Ref", ":", "http", ":", "//", "helpdesk", ".", "knackhq", ".", "com", "/", "support", "/", "solutions", "/", "articles", "/", "5000446111", "-", "api", "-", "reference", "-", "root", "-", "access#retrieve", ":", "param", ...
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L132-L164
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.find
def find(self, filter=list(), sort_field=None, sort_order=None, page=None, rows_per_page=None, using_name=True, data_only=True, raw=True, recovery_name=True): """Execute a find query. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111...
python
def find(self, filter=list(), sort_field=None, sort_order=None, page=None, rows_per_page=None, using_name=True, data_only=True, raw=True, recovery_name=True): """Execute a find query. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111...
[ "def", "find", "(", "self", ",", "filter", "=", "list", "(", ")", ",", "sort_field", "=", "None", ",", "sort_order", "=", "None", ",", "page", "=", "None", ",", "rows_per_page", "=", "None", ",", "using_name", "=", "True", ",", "data_only", "=", "Tru...
Execute a find query. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#retrieve :param filter: list of criterions. For more information: http://helpdesk.knackhq.com/support/solutions/articles/5000447623-api-reference-filters-se...
[ "Execute", "a", "find", "query", ".", "Ref", ":", "http", ":", "//", "helpdesk", ".", "knackhq", ".", "com", "/", "support", "/", "solutions", "/", "articles", "/", "5000446111", "-", "api", "-", "reference", "-", "root", "-", "access#retrieve", ":", "...
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L166-L253
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.update_one
def update_one(self, id_, data, using_name=True): """Update one record. Any fields you don't specify will remain unchanged. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#update :param id_: record id_ :param data: the ne...
python
def update_one(self, id_, data, using_name=True): """Update one record. Any fields you don't specify will remain unchanged. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#update :param id_: record id_ :param data: the ne...
[ "def", "update_one", "(", "self", ",", "id_", ",", "data", ",", "using_name", "=", "True", ")", ":", "data", "=", "self", ".", "convert_values", "(", "data", ")", "if", "using_name", ":", "data", "=", "self", ".", "convert_keys", "(", "data", ")", "u...
Update one record. Any fields you don't specify will remain unchanged. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#update :param id_: record id_ :param data: the new data fields and values :param using_name: if you ar...
[ "Update", "one", "record", ".", "Any", "fields", "you", "don", "t", "specify", "will", "remain", "unchanged", ".", "Ref", ":", "http", ":", "//", "helpdesk", ".", "knackhq", ".", "com", "/", "support", "/", "solutions", "/", "articles", "/", "5000446111"...
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L255-L276
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.delete_one
def delete_one(self, id_): """Delete one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#delete :param id_: record id_ **中文文档** 删除一条记录 """ url = "https://api.kna...
python
def delete_one(self, id_): """Delete one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#delete :param id_: record id_ **中文文档** 删除一条记录 """ url = "https://api.kna...
[ "def", "delete_one", "(", "self", ",", "id_", ")", ":", "url", "=", "\"https://api.knackhq.com/v1/objects/%s/records/%s\"", "%", "(", "self", ".", "key", ",", "id_", ")", "res", "=", "self", ".", "delete", "(", "url", ")", "return", "res" ]
Delete one record. Ref: http://helpdesk.knackhq.com/support/solutions/articles/5000446111-api-reference-root-access#delete :param id_: record id_ **中文文档** 删除一条记录
[ "Delete", "one", "record", ".", "Ref", ":", "http", ":", "//", "helpdesk", ".", "knackhq", ".", "com", "/", "support", "/", "solutions", "/", "articles", "/", "5000446111", "-", "api", "-", "reference", "-", "root", "-", "access#delete", ":", "param", ...
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L278-L292
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
Collection.delete_all
def delete_all(self): """Delete all record in the table/collection of this object. **中文文档** 删除表中的所有记录 """ for record in self.find(using_name=False, data_only=True): res = self.delete_one(record["id"])
python
def delete_all(self): """Delete all record in the table/collection of this object. **中文文档** 删除表中的所有记录 """ for record in self.find(using_name=False, data_only=True): res = self.delete_one(record["id"])
[ "def", "delete_all", "(", "self", ")", ":", "for", "record", "in", "self", ".", "find", "(", "using_name", "=", "False", ",", "data_only", "=", "True", ")", ":", "res", "=", "self", ".", "delete_one", "(", "record", "[", "\"id\"", "]", ")" ]
Delete all record in the table/collection of this object. **中文文档** 删除表中的所有记录
[ "Delete", "all", "record", "in", "the", "table", "/", "collection", "of", "this", "object", ".", "**", "中文文档", "**", "删除表中的所有记录" ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L294-L302
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqAuth.get
def get(self, url, params=dict()): """Http get method wrapper, to support search. """ try: res = requests.get(url, headers=self.headers, params=params) return json.loads(res.text) except Exception as e: print(e) return "error"
python
def get(self, url, params=dict()): """Http get method wrapper, to support search. """ try: res = requests.get(url, headers=self.headers, params=params) return json.loads(res.text) except Exception as e: print(e) return "error"
[ "def", "get", "(", "self", ",", "url", ",", "params", "=", "dict", "(", ")", ")", ":", "try", ":", "res", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "self", ".", "headers", ",", "params", "=", "params", ")", "return", "json", ...
Http get method wrapper, to support search.
[ "Http", "get", "method", "wrapper", "to", "support", "search", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L330-L338
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqAuth.post
def post(self, url, data): """Http post method wrapper, to support insert. """ try: res = requests.post( url, headers=self.headers, data=json.dumps(data)) return json.loads(res.text) except Exception as e: print(e) return "e...
python
def post(self, url, data): """Http post method wrapper, to support insert. """ try: res = requests.post( url, headers=self.headers, data=json.dumps(data)) return json.loads(res.text) except Exception as e: print(e) return "e...
[ "def", "post", "(", "self", ",", "url", ",", "data", ")", ":", "try", ":", "res", "=", "requests", ".", "post", "(", "url", ",", "headers", "=", "self", ".", "headers", ",", "data", "=", "json", ".", "dumps", "(", "data", ")", ")", "return", "j...
Http post method wrapper, to support insert.
[ "Http", "post", "method", "wrapper", "to", "support", "insert", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L340-L349
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqAuth.delete
def delete(self, url): """Http delete method wrapper, to support delete. """ try: res = requests.delete(url, headers=self.headers) return json.loads(res.text) except Exception as e: print(e) return "error"
python
def delete(self, url): """Http delete method wrapper, to support delete. """ try: res = requests.delete(url, headers=self.headers) return json.loads(res.text) except Exception as e: print(e) return "error"
[ "def", "delete", "(", "self", ",", "url", ")", ":", "try", ":", "res", "=", "requests", ".", "delete", "(", "url", ",", "headers", "=", "self", ".", "headers", ")", "return", "json", ".", "loads", "(", "res", ".", "text", ")", "except", "Exception"...
Http delete method wrapper, to support delete.
[ "Http", "delete", "method", "wrapper", "to", "support", "delete", "." ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L362-L370
MacHu-GWU/pyknackhq-project
pyknackhq/client.py
KnackhqClient.get_collection
def get_collection(self, key, using_name=True): """Get :class:`Collection` instance. :param key: object_key or object_name :param using_name: True if getting object by object name """ object_ = self.application.get_object(key, using_name=using_name) collection = ...
python
def get_collection(self, key, using_name=True): """Get :class:`Collection` instance. :param key: object_key or object_name :param using_name: True if getting object by object name """ object_ = self.application.get_object(key, using_name=using_name) collection = ...
[ "def", "get_collection", "(", "self", ",", "key", ",", "using_name", "=", "True", ")", ":", "object_", "=", "self", ".", "application", ".", "get_object", "(", "key", ",", "using_name", "=", "using_name", ")", "collection", "=", "Collection", ".", "from_di...
Get :class:`Collection` instance. :param key: object_key or object_name :param using_name: True if getting object by object name
[ "Get", ":", "class", ":", "Collection", "instance", ".", ":", "param", "key", ":", "object_key", "or", "object_name", ":", "param", "using_name", ":", "True", "if", "getting", "object", "by", "object", "name" ]
train
https://github.com/MacHu-GWU/pyknackhq-project/blob/dd937f24d7b0a351ba3818eb746c31b29a8cc341/pyknackhq/client.py#L410-L420
cdeboever3/cdpybio
cdpybio/express.py
combine_express_output
def combine_express_output(fnL, column='eff_counts', names=None, tg=None, define_sample_name=None, debug=False): """ Combine eXpress output files Parameters: ----------...
python
def combine_express_output(fnL, column='eff_counts', names=None, tg=None, define_sample_name=None, debug=False): """ Combine eXpress output files Parameters: ----------...
[ "def", "combine_express_output", "(", "fnL", ",", "column", "=", "'eff_counts'", ",", "names", "=", "None", ",", "tg", "=", "None", ",", "define_sample_name", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "names", "is", "not", "None", ":", "...
Combine eXpress output files Parameters: ----------- fnL : list of strs of filenames List of paths to results.xprs files. column : string Column name of eXpress output to combine. names : list of strings Names to use for columns of output files. Overrides define_sample_na...
[ "Combine", "eXpress", "output", "files" ]
train
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/express.py#L5-L75
MacHu-GWU/angora-project
angora/dataIO/textfile.py
read
def read(path, encoding="utf-8"): """Auto-decoding string reader. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.read("test.txt") """ with open(path, "rb") as f: content = f.read() try: text = c...
python
def read(path, encoding="utf-8"): """Auto-decoding string reader. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.read("test.txt") """ with open(path, "rb") as f: content = f.read() try: text = c...
[ "def", "read", "(", "path", ",", "encoding", "=", "\"utf-8\"", ")", ":", "with", "open", "(", "path", ",", "\"rb\"", ")", "as", "f", ":", "content", "=", "f", ".", "read", "(", ")", "try", ":", "text", "=", "content", ".", "decode", "(", "encodin...
Auto-decoding string reader. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.read("test.txt")
[ "Auto", "-", "decoding", "string", "reader", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/dataIO/textfile.py#L35-L52
MacHu-GWU/angora-project
angora/dataIO/textfile.py
write
def write(text, path): """Writer text to file with utf-8 encoding. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.write("hello world!", "test.txt") """ with open(path, "wb") as f: f.write(text.encode("utf-8"))
python
def write(text, path): """Writer text to file with utf-8 encoding. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.write("hello world!", "test.txt") """ with open(path, "wb") as f: f.write(text.encode("utf-8"))
[ "def", "write", "(", "text", ",", "path", ")", ":", "with", "open", "(", "path", ",", "\"wb\"", ")", "as", "f", ":", "f", ".", "write", "(", "text", ".", "encode", "(", "\"utf-8\"", ")", ")" ]
Writer text to file with utf-8 encoding. Usage:: >>> from angora.dataIO import textfile or >>> from angora.dataIO import * >>> textfile.write("hello world!", "test.txt")
[ "Writer", "text", "to", "file", "with", "utf", "-", "8", "encoding", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/dataIO/textfile.py#L54-L66
MacHu-GWU/angora-project
angora/bot/anjian.py
Script._delay
def _delay(self, ms): """Implement default delay mechanism. """ if ms: self.Delay(ms) else: if self.default_delay: self.Delay(self.default_delay)
python
def _delay(self, ms): """Implement default delay mechanism. """ if ms: self.Delay(ms) else: if self.default_delay: self.Delay(self.default_delay)
[ "def", "_delay", "(", "self", ",", "ms", ")", ":", "if", "ms", ":", "self", ".", "Delay", "(", "ms", ")", "else", ":", "if", "self", ".", "default_delay", ":", "self", ".", "Delay", "(", "self", ".", "default_delay", ")" ]
Implement default delay mechanism.
[ "Implement", "default", "delay", "mechanism", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L91-L98
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.SayString
def SayString(self, text, delay=0): """Enter some text. :param text: the text you want to enter. """ self._delay(delay) cmd = Command("SayString", 'SayString "%s"' % text) self.add(cmd)
python
def SayString(self, text, delay=0): """Enter some text. :param text: the text you want to enter. """ self._delay(delay) cmd = Command("SayString", 'SayString "%s"' % text) self.add(cmd)
[ "def", "SayString", "(", "self", ",", "text", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "cmd", "=", "Command", "(", "\"SayString\"", ",", "'SayString \"%s\"'", "%", "text", ")", "self", ".", "add", "(", "cmd", ")" ]
Enter some text. :param text: the text you want to enter.
[ "Enter", "some", "text", ".", ":", "param", "text", ":", "the", "text", "you", "want", "to", "enter", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L109-L116
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.KeyPress
def KeyPress(self, key, n=1, delay=0): """Press key for n times. :param key: :param n: press key for n times """ self._delay(delay) cmd = Command("KeyPress", 'KeyPress "%s", %s' % (key, n)) self.add(cmd)
python
def KeyPress(self, key, n=1, delay=0): """Press key for n times. :param key: :param n: press key for n times """ self._delay(delay) cmd = Command("KeyPress", 'KeyPress "%s", %s' % (key, n)) self.add(cmd)
[ "def", "KeyPress", "(", "self", ",", "key", ",", "n", "=", "1", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "cmd", "=", "Command", "(", "\"KeyPress\"", ",", "'KeyPress \"%s\", %s'", "%", "(", "key", ",", "n", ")", ...
Press key for n times. :param key: :param n: press key for n times
[ "Press", "key", "for", "n", "times", ".", ":", "param", "key", ":", ":", "param", "n", ":", "press", "key", "for", "n", "times" ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L119-L127
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.AltTab
def AltTab(self, n=1, delay=0): """Press down Alt, then press n times Tab, then release Alt. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Alt, 1))) for i in range(n): self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.Tab...
python
def AltTab(self, n=1, delay=0): """Press down Alt, then press n times Tab, then release Alt. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Alt, 1))) for i in range(n): self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.Tab...
[ "def", "AltTab", "(", "self", ",", "n", "=", "1", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Alt", ","...
Press down Alt, then press n times Tab, then release Alt.
[ "Press", "down", "Alt", "then", "press", "n", "times", "Tab", "then", "release", "Alt", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L185-L192
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.Ctrl_C
def Ctrl_C(self, delay=0): """Ctrl + C shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.C, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
python
def Ctrl_C(self, delay=0): """Ctrl + C shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.C, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
[ "def", "Ctrl_C", "(", "self", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Ctrl", ",", "1", ")", ")", ")...
Ctrl + C shortcut.
[ "Ctrl", "+", "C", "shortcut", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L194-L200
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.Ctrl_V
def Ctrl_V(self, delay=0): """Ctrl + V shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.V, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
python
def Ctrl_V(self, delay=0): """Ctrl + V shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.V, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
[ "def", "Ctrl_V", "(", "self", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Ctrl", ",", "1", ")", ")", ")...
Ctrl + V shortcut.
[ "Ctrl", "+", "V", "shortcut", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L202-L208
MacHu-GWU/angora-project
angora/bot/anjian.py
Script.Ctrl_W
def Ctrl_W(self, delay=0): """Ctrl + W shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.W, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
python
def Ctrl_W(self, delay=0): """Ctrl + W shortcut. """ self._delay(delay) self.add(Command("KeyDown", 'KeyDown "%s", %s' % (BoardKey.Ctrl, 1))) self.add(Command("KeyPress", 'KeyPress "%s", %s' % (BoardKey.W, 1))) self.add(Command("KeyUp", 'KeyUp "%s", %s' % (BoardKey.Ctrl, ...
[ "def", "Ctrl_W", "(", "self", ",", "delay", "=", "0", ")", ":", "self", ".", "_delay", "(", "delay", ")", "self", ".", "add", "(", "Command", "(", "\"KeyDown\"", ",", "'KeyDown \"%s\", %s'", "%", "(", "BoardKey", ".", "Ctrl", ",", "1", ")", ")", ")...
Ctrl + W shortcut.
[ "Ctrl", "+", "W", "shortcut", "." ]
train
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/bot/anjian.py#L210-L216
jeffrimko/Auxly
lib/auxly/stringy.py
subat
def subat(orig, index, replace): """Substitutes the replacement string/character at the given index in the given string, returns the modified string. **Examples**: :: auxly.stringy.subat("bit", 2, "n") """ return "".join([(orig[x] if x != index else replace) for x in range(len(orig))])
python
def subat(orig, index, replace): """Substitutes the replacement string/character at the given index in the given string, returns the modified string. **Examples**: :: auxly.stringy.subat("bit", 2, "n") """ return "".join([(orig[x] if x != index else replace) for x in range(len(orig))])
[ "def", "subat", "(", "orig", ",", "index", ",", "replace", ")", ":", "return", "\"\"", ".", "join", "(", "[", "(", "orig", "[", "x", "]", "if", "x", "!=", "index", "else", "replace", ")", "for", "x", "in", "range", "(", "len", "(", "orig", ")",...
Substitutes the replacement string/character at the given index in the given string, returns the modified string. **Examples**: :: auxly.stringy.subat("bit", 2, "n")
[ "Substitutes", "the", "replacement", "string", "/", "character", "at", "the", "given", "index", "in", "the", "given", "string", "returns", "the", "modified", "string", "." ]
train
https://github.com/jeffrimko/Auxly/blob/5aae876bcb6ca117c81d904f9455764cdc78cd48/lib/auxly/stringy.py#L12-L20
jeffrimko/Auxly
lib/auxly/stringy.py
randomize
def randomize(length=6, choices=None): """Returns a random string of the given length.""" if type(choices) == str: choices = list(choices) choices = choices or ascii_lowercase return "".join(choice(choices) for _ in range(length))
python
def randomize(length=6, choices=None): """Returns a random string of the given length.""" if type(choices) == str: choices = list(choices) choices = choices or ascii_lowercase return "".join(choice(choices) for _ in range(length))
[ "def", "randomize", "(", "length", "=", "6", ",", "choices", "=", "None", ")", ":", "if", "type", "(", "choices", ")", "==", "str", ":", "choices", "=", "list", "(", "choices", ")", "choices", "=", "choices", "or", "ascii_lowercase", "return", "\"\"", ...
Returns a random string of the given length.
[ "Returns", "a", "random", "string", "of", "the", "given", "length", "." ]
train
https://github.com/jeffrimko/Auxly/blob/5aae876bcb6ca117c81d904f9455764cdc78cd48/lib/auxly/stringy.py#L22-L27
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
calc_scores_for_node
def calc_scores_for_node(G, node, depth_limit=22, number_of_recommendations=None, impact_mode=10): """Calculate the score of multiple records.""" n, w, dep, _ = dfs_edges(G, node, depth_limit, "Record") count_total_ways = len(n) # print "Number of paths {}".format(len(n)) if...
python
def calc_scores_for_node(G, node, depth_limit=22, number_of_recommendations=None, impact_mode=10): """Calculate the score of multiple records.""" n, w, dep, _ = dfs_edges(G, node, depth_limit, "Record") count_total_ways = len(n) # print "Number of paths {}".format(len(n)) if...
[ "def", "calc_scores_for_node", "(", "G", ",", "node", ",", "depth_limit", "=", "22", ",", "number_of_recommendations", "=", "None", ",", "impact_mode", "=", "10", ")", ":", "n", ",", "w", ",", "dep", ",", "_", "=", "dfs_edges", "(", "G", ",", "node", ...
Calculate the score of multiple records.
[ "Calculate", "the", "score", "of", "multiple", "records", "." ]
train
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L88-L137
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
dfs_edges
def dfs_edges(G, start, depth_limit=1, get_only=True, get_path=False): """Deepest first search.""" depth_limit = depth_limit - 1 # creates unsigned int array (2 Byte) output_nodes = array('L') output_depth = array('I') # creates float array (4 Byte) output_weights = array('f') apath = [...
python
def dfs_edges(G, start, depth_limit=1, get_only=True, get_path=False): """Deepest first search.""" depth_limit = depth_limit - 1 # creates unsigned int array (2 Byte) output_nodes = array('L') output_depth = array('I') # creates float array (4 Byte) output_weights = array('f') apath = [...
[ "def", "dfs_edges", "(", "G", ",", "start", ",", "depth_limit", "=", "1", ",", "get_only", "=", "True", ",", "get_path", "=", "False", ")", ":", "depth_limit", "=", "depth_limit", "-", "1", "# creates unsigned int array (2 Byte)", "output_nodes", "=", "array",...
Deepest first search.
[ "Deepest", "first", "search", "." ]
train
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L140-L203
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
calc_weight_of_multiple_paths
def calc_weight_of_multiple_paths(path_scores, impact_div=12): """Caluculate the weight of multipe paths.""" number_of_paths = len(path_scores) if number_of_paths > 1: score_total = 0.0 highest_score = 0.0 for score in path_scores.Scores: score_total += score ...
python
def calc_weight_of_multiple_paths(path_scores, impact_div=12): """Caluculate the weight of multipe paths.""" number_of_paths = len(path_scores) if number_of_paths > 1: score_total = 0.0 highest_score = 0.0 for score in path_scores.Scores: score_total += score ...
[ "def", "calc_weight_of_multiple_paths", "(", "path_scores", ",", "impact_div", "=", "12", ")", ":", "number_of_paths", "=", "len", "(", "path_scores", ")", "if", "number_of_paths", ">", "1", ":", "score_total", "=", "0.0", "highest_score", "=", "0.0", "for", "...
Caluculate the weight of multipe paths.
[ "Caluculate", "the", "weight", "of", "multipe", "paths", "." ]
train
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L206-L234
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
GraphRecommender.recommend_for_record
def recommend_for_record(self, record_id, depth=4, num_reco=10): """Calculate recommendations for record.""" data = calc_scores_for_node(self._graph, record_id, depth, num_reco) return data.Node.tolist(), data.Score.tolist()
python
def recommend_for_record(self, record_id, depth=4, num_reco=10): """Calculate recommendations for record.""" data = calc_scores_for_node(self._graph, record_id, depth, num_reco) return data.Node.tolist(), data.Score.tolist()
[ "def", "recommend_for_record", "(", "self", ",", "record_id", ",", "depth", "=", "4", ",", "num_reco", "=", "10", ")", ":", "data", "=", "calc_scores_for_node", "(", "self", ".", "_graph", ",", "record_id", ",", "depth", ",", "num_reco", ")", "return", "...
Calculate recommendations for record.
[ "Calculate", "recommendations", "for", "record", "." ]
train
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L47-L50
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
GraphRecommender.load_profile
def load_profile(self, profile_name): """Load user profiles from file.""" data = self.storage.get_user_profiles(profile_name) for x in data.get_user_views(): self._graph.add_edge(int(x[0]), int(x[1]), {'weight': float(x[2])}) self.all_records[int(x[1])] += 1 ret...
python
def load_profile(self, profile_name): """Load user profiles from file.""" data = self.storage.get_user_profiles(profile_name) for x in data.get_user_views(): self._graph.add_edge(int(x[0]), int(x[1]), {'weight': float(x[2])}) self.all_records[int(x[1])] += 1 ret...
[ "def", "load_profile", "(", "self", ",", "profile_name", ")", ":", "data", "=", "self", ".", "storage", ".", "get_user_profiles", "(", "profile_name", ")", "for", "x", "in", "data", ".", "get_user_views", "(", ")", ":", "self", ".", "_graph", ".", "add_e...
Load user profiles from file.
[ "Load", "user", "profiles", "from", "file", "." ]
train
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L52-L60
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
GraphRecommender.del_big_nodes
def del_big_nodes(self, grater_than=215): """Delete big nodes with many connections from the graph.""" G = self._graph it = G.nodes_iter() node_paths = [] node_names = [] del_nodes = [] summe = 1 count = 1 for node in it: l = len(G[node...
python
def del_big_nodes(self, grater_than=215): """Delete big nodes with many connections from the graph.""" G = self._graph it = G.nodes_iter() node_paths = [] node_names = [] del_nodes = [] summe = 1 count = 1 for node in it: l = len(G[node...
[ "def", "del_big_nodes", "(", "self", ",", "grater_than", "=", "215", ")", ":", "G", "=", "self", ".", "_graph", "it", "=", "G", ".", "nodes_iter", "(", ")", "node_paths", "=", "[", "]", "node_names", "=", "[", "]", "del_nodes", "=", "[", "]", "summ...
Delete big nodes with many connections from the graph.
[ "Delete", "big", "nodes", "with", "many", "connections", "from", "the", "graph", "." ]
train
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L62-L85
Arvedui/picuplib
picuplib/upload.py
punify_filename
def punify_filename(filename): """ small hackisch workaround for unicode problems with the picflash api """ path, extension = splitext(filename) return path.encode('punycode').decode('utf8') + extension
python
def punify_filename(filename): """ small hackisch workaround for unicode problems with the picflash api """ path, extension = splitext(filename) return path.encode('punycode').decode('utf8') + extension
[ "def", "punify_filename", "(", "filename", ")", ":", "path", ",", "extension", "=", "splitext", "(", "filename", ")", "return", "path", ".", "encode", "(", "'punycode'", ")", ".", "decode", "(", "'utf8'", ")", "+", "extension" ]
small hackisch workaround for unicode problems with the picflash api
[ "small", "hackisch", "workaround", "for", "unicode", "problems", "with", "the", "picflash", "api" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L173-L178
Arvedui/picuplib
picuplib/upload.py
upload
def upload(apikey, picture, resize=None, rotation='00', noexif=False, callback=None): """ prepares post for regular upload :param str apikey: Apikey needed for Autentication on picflash. :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list ...
python
def upload(apikey, picture, resize=None, rotation='00', noexif=False, callback=None): """ prepares post for regular upload :param str apikey: Apikey needed for Autentication on picflash. :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list ...
[ "def", "upload", "(", "apikey", ",", "picture", ",", "resize", "=", "None", ",", "rotation", "=", "'00'", ",", "noexif", "=", "False", ",", "callback", "=", "None", ")", ":", "if", "isinstance", "(", "picture", ",", "str", ")", ":", "with", "open", ...
prepares post for regular upload :param str apikey: Apikey needed for Autentication on picflash. :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte object in that order. :param str resize: Aresolution...
[ "prepares", "post", "for", "regular", "upload" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L183-L223
Arvedui/picuplib
picuplib/upload.py
remote_upload
def remote_upload(apikey, picture_url, resize=None, rotation='00', noexif=False): """ prepares post for remote upload :param str apikey: Apikey needed for Autentication on picflash. :param str picture_url: URL to picture allowd Protocols are: ftp, http, https :param str re...
python
def remote_upload(apikey, picture_url, resize=None, rotation='00', noexif=False): """ prepares post for remote upload :param str apikey: Apikey needed for Autentication on picflash. :param str picture_url: URL to picture allowd Protocols are: ftp, http, https :param str re...
[ "def", "remote_upload", "(", "apikey", ",", "picture_url", ",", "resize", "=", "None", ",", "rotation", "=", "'00'", ",", "noexif", "=", "False", ")", ":", "check_rotation", "(", "rotation", ")", "check_resize", "(", "resize", ")", "url", "=", "check_if_re...
prepares post for remote upload :param str apikey: Apikey needed for Autentication on picflash. :param str picture_url: URL to picture allowd Protocols are: ftp, http, https :param str resize: Aresolution in the folowing format: \ '80x80'(optional) :param str|degree rotation: The pictur...
[ "prepares", "post", "for", "remote", "upload" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L227-L252
Arvedui/picuplib
picuplib/upload.py
compose_post
def compose_post(apikey, resize, rotation, noexif): """ composes basic post requests """ check_rotation(rotation) check_resize(resize) post_data = { 'formatliste': ('', 'og'), 'userdrehung': ('', rotation), 'apikey': ('', apikey) } if resize ...
python
def compose_post(apikey, resize, rotation, noexif): """ composes basic post requests """ check_rotation(rotation) check_resize(resize) post_data = { 'formatliste': ('', 'og'), 'userdrehung': ('', rotation), 'apikey': ('', apikey) } if resize ...
[ "def", "compose_post", "(", "apikey", ",", "resize", ",", "rotation", ",", "noexif", ")", ":", "check_rotation", "(", "rotation", ")", "check_resize", "(", "resize", ")", "post_data", "=", "{", "'formatliste'", ":", "(", "''", ",", "'og'", ")", ",", "'us...
composes basic post requests
[ "composes", "basic", "post", "requests" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L265-L289
Arvedui/picuplib
picuplib/upload.py
do_upload
def do_upload(post_data, callback=None): """ does the actual upload also sets and generates the user agent string """ encoder = MultipartEncoder(post_data) monitor = MultipartEncoderMonitor(encoder, callback) headers = {'User-Agent': USER_AGENT, 'Content-Type': monitor.content_type} respon...
python
def do_upload(post_data, callback=None): """ does the actual upload also sets and generates the user agent string """ encoder = MultipartEncoder(post_data) monitor = MultipartEncoderMonitor(encoder, callback) headers = {'User-Agent': USER_AGENT, 'Content-Type': monitor.content_type} respon...
[ "def", "do_upload", "(", "post_data", ",", "callback", "=", "None", ")", ":", "encoder", "=", "MultipartEncoder", "(", "post_data", ")", "monitor", "=", "MultipartEncoderMonitor", "(", "encoder", ",", "callback", ")", "headers", "=", "{", "'User-Agent'", ":", ...
does the actual upload also sets and generates the user agent string
[ "does", "the", "actual", "upload", "also", "sets", "and", "generates", "the", "user", "agent", "string" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L292-L304
Arvedui/picuplib
picuplib/upload.py
Upload.upload
def upload(self, picture, resize=None, rotation=None, noexif=None, callback=None): """ wraps upload function :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte objec...
python
def upload(self, picture, resize=None, rotation=None, noexif=None, callback=None): """ wraps upload function :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte objec...
[ "def", "upload", "(", "self", ",", "picture", ",", "resize", "=", "None", ",", "rotation", "=", "None", ",", "noexif", "=", "None", ",", "callback", "=", "None", ")", ":", "if", "not", "resize", ":", "resize", "=", "self", ".", "_resize", "if", "no...
wraps upload function :param str/tuple/list picture: Path to picture as str or picture data. \ If data a tuple or list with the file name as str \ and data as byte object in that order. :param str resize: Aresolution in the folowing format: \ '80x80'(optional) ...
[ "wraps", "upload", "function" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L115-L144
Arvedui/picuplib
picuplib/upload.py
Upload.remote_upload
def remote_upload(self, picture_url, resize=None, rotation=None, noexif=None): """ wraps remote_upload funktion :param str picture_url: URL to picture allowd Protocols are: ftp,\ http, https :param str resize: Aresolution in the folowing format: \ ...
python
def remote_upload(self, picture_url, resize=None, rotation=None, noexif=None): """ wraps remote_upload funktion :param str picture_url: URL to picture allowd Protocols are: ftp,\ http, https :param str resize: Aresolution in the folowing format: \ ...
[ "def", "remote_upload", "(", "self", ",", "picture_url", ",", "resize", "=", "None", ",", "rotation", "=", "None", ",", "noexif", "=", "None", ")", ":", "if", "not", "resize", ":", "resize", "=", "self", ".", "_resize", "if", "not", "rotation", ":", ...
wraps remote_upload funktion :param str picture_url: URL to picture allowd Protocols are: ftp,\ http, https :param str resize: Aresolution in the folowing format: \ '80x80'(optional) :param str|degree rotation: The picture will be rotated by this Value. \ All...
[ "wraps", "remote_upload", "funktion" ]
train
https://github.com/Arvedui/picuplib/blob/c8a5d1542dbd421e84afd5ee81fe76efec89fb95/picuplib/upload.py#L147-L170
rjw57/throw
throw/identity.py
load_identity
def load_identity(config = Config()): """Load the default identity from the configuration. If there is no default identity, a KeyError is raised. """ return Identity(name = config.get('user', 'name'), email_ = config.get('user', 'email'), **config.get_section...
python
def load_identity(config = Config()): """Load the default identity from the configuration. If there is no default identity, a KeyError is raised. """ return Identity(name = config.get('user', 'name'), email_ = config.get('user', 'email'), **config.get_section...
[ "def", "load_identity", "(", "config", "=", "Config", "(", ")", ")", ":", "return", "Identity", "(", "name", "=", "config", ".", "get", "(", "'user'", ",", "'name'", ")", ",", "email_", "=", "config", ".", "get", "(", "'user'", ",", "'email'", ")", ...
Load the default identity from the configuration. If there is no default identity, a KeyError is raised.
[ "Load", "the", "default", "identity", "from", "the", "configuration", ".", "If", "there", "is", "no", "default", "identity", "a", "KeyError", "is", "raised", "." ]
train
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/identity.py#L29-L36
rjw57/throw
throw/identity.py
input_identity
def input_identity(interface = TerminalInterface()): """Get the full name, email address and SMTP information from the user.""" while True: identity = interface.input_fields(""" In order to send your files via email, I need to get your name and email address you will be using to s...
python
def input_identity(interface = TerminalInterface()): """Get the full name, email address and SMTP information from the user.""" while True: identity = interface.input_fields(""" In order to send your files via email, I need to get your name and email address you will be using to s...
[ "def", "input_identity", "(", "interface", "=", "TerminalInterface", "(", ")", ")", ":", "while", "True", ":", "identity", "=", "interface", ".", "input_fields", "(", "\"\"\"\n In order to send your files via email, I need to get your name and\n email addres...
Get the full name, email address and SMTP information from the user.
[ "Get", "the", "full", "name", "email", "address", "and", "SMTP", "information", "from", "the", "user", "." ]
train
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/identity.py#L38-L101
rjw57/throw
throw/identity.py
Identity.sendmail
def sendmail(self, to, message): """Send mail to one or more recipients. The required arguments are a list of RFC 822 to-address strings (a bare string will be treated as a list with 1 address), and a message string. """ # If we were passed a bare string as the To: address, con...
python
def sendmail(self, to, message): """Send mail to one or more recipients. The required arguments are a list of RFC 822 to-address strings (a bare string will be treated as a list with 1 address), and a message string. """ # If we were passed a bare string as the To: address, con...
[ "def", "sendmail", "(", "self", ",", "to", ",", "message", ")", ":", "# If we were passed a bare string as the To: address, convert it to", "# a single element list.", "if", "isinstance", "(", "to", ",", "str", ")", ":", "to", "=", "[", "to", ",", "]", "# Send one...
Send mail to one or more recipients. The required arguments are a list of RFC 822 to-address strings (a bare string will be treated as a list with 1 address), and a message string.
[ "Send", "mail", "to", "one", "or", "more", "recipients", ".", "The", "required", "arguments", "are", "a", "list", "of", "RFC", "822", "to", "-", "address", "strings", "(", "a", "bare", "string", "will", "be", "treated", "as", "a", "list", "with", "1", ...
train
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/identity.py#L172-L187
rjw57/throw
throw/identity.py
Identity._smtp_server
def _smtp_server(self): """Return a smtplib SMTP object correctly initialised and connected to a SMTP server suitable for sending email on behalf of the user.""" if self._use_ssl: server = smtplib.SMTP_SSL(**self._smtp_vars) else: server = smtplib.SMTP(**self._sm...
python
def _smtp_server(self): """Return a smtplib SMTP object correctly initialised and connected to a SMTP server suitable for sending email on behalf of the user.""" if self._use_ssl: server = smtplib.SMTP_SSL(**self._smtp_vars) else: server = smtplib.SMTP(**self._sm...
[ "def", "_smtp_server", "(", "self", ")", ":", "if", "self", ".", "_use_ssl", ":", "server", "=", "smtplib", ".", "SMTP_SSL", "(", "*", "*", "self", ".", "_smtp_vars", ")", "else", ":", "server", "=", "smtplib", ".", "SMTP", "(", "*", "*", "self", "...
Return a smtplib SMTP object correctly initialised and connected to a SMTP server suitable for sending email on behalf of the user.
[ "Return", "a", "smtplib", "SMTP", "object", "correctly", "initialised", "and", "connected", "to", "a", "SMTP", "server", "suitable", "for", "sending", "email", "on", "behalf", "of", "the", "user", "." ]
train
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/identity.py#L234-L256
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_clients
def add_clients(session, verbose): """Add clients to the ATVS Keystroke database.""" for ctype in ['Genuine', 'Impostor']: for cdid in userid_clients: cid = ctype + '_%d' % cdid if verbose>1: print(" Adding user '%s' of type '%s'..." % (cid, ctype)) session.add(Client(cid, ctype, cdid))
python
def add_clients(session, verbose): """Add clients to the ATVS Keystroke database.""" for ctype in ['Genuine', 'Impostor']: for cdid in userid_clients: cid = ctype + '_%d' % cdid if verbose>1: print(" Adding user '%s' of type '%s'..." % (cid, ctype)) session.add(Client(cid, ctype, cdid))
[ "def", "add_clients", "(", "session", ",", "verbose", ")", ":", "for", "ctype", "in", "[", "'Genuine'", ",", "'Impostor'", "]", ":", "for", "cdid", "in", "userid_clients", ":", "cid", "=", "ctype", "+", "'_%d'", "%", "cdid", "if", "verbose", ">", "1", ...
Add clients to the ATVS Keystroke database.
[ "Add", "clients", "to", "the", "ATVS", "Keystroke", "database", "." ]
train
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L30-L36
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_files
def add_files(session, imagedir, verbose): """Add files to the ATVS Keystroke database.""" def add_file(session, basename, userid, shotid, sessionid): """Parse a single filename and add it to the list.""" session.add(File(userid, basename, sessionid, shotid)) filenames = os.listdir(imagedir) for filen...
python
def add_files(session, imagedir, verbose): """Add files to the ATVS Keystroke database.""" def add_file(session, basename, userid, shotid, sessionid): """Parse a single filename and add it to the list.""" session.add(File(userid, basename, sessionid, shotid)) filenames = os.listdir(imagedir) for filen...
[ "def", "add_files", "(", "session", ",", "imagedir", ",", "verbose", ")", ":", "def", "add_file", "(", "session", ",", "basename", ",", "userid", ",", "shotid", ",", "sessionid", ")", ":", "\"\"\"Parse a single filename and add it to the list.\"\"\"", "session", "...
Add files to the ATVS Keystroke database.
[ "Add", "files", "to", "the", "ATVS", "Keystroke", "database", "." ]
train
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L39-L62
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_protocols
def add_protocols(session, verbose): """Adds protocols""" # 1. DEFINITIONS enroll_session = [1] client_probe_session = [2] impostor_probe_session = [3] protocols = ['A'] # 2. ADDITIONS TO THE SQL DATABASE protocolPurpose_list = [('eval', 'enrol'), ('eval', 'probe')] for proto in protocols: p = P...
python
def add_protocols(session, verbose): """Adds protocols""" # 1. DEFINITIONS enroll_session = [1] client_probe_session = [2] impostor_probe_session = [3] protocols = ['A'] # 2. ADDITIONS TO THE SQL DATABASE protocolPurpose_list = [('eval', 'enrol'), ('eval', 'probe')] for proto in protocols: p = P...
[ "def", "add_protocols", "(", "session", ",", "verbose", ")", ":", "# 1. DEFINITIONS", "enroll_session", "=", "[", "1", "]", "client_probe_session", "=", "[", "2", "]", "impostor_probe_session", "=", "[", "3", "]", "protocols", "=", "[", "'A'", "]", "# 2. ADD...
Adds protocols
[ "Adds", "protocols" ]
train
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L65-L109
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
create_tables
def create_tables(args): """Creates all necessary tables (only to be used at the first time)""" from bob.db.utils import create_engine_try_nolock engine = create_engine_try_nolock(args.type, args.files[0], echo=(args.verbose > 2)) Base.metadata.create_all(engine)
python
def create_tables(args): """Creates all necessary tables (only to be used at the first time)""" from bob.db.utils import create_engine_try_nolock engine = create_engine_try_nolock(args.type, args.files[0], echo=(args.verbose > 2)) Base.metadata.create_all(engine)
[ "def", "create_tables", "(", "args", ")", ":", "from", "bob", ".", "db", ".", "utils", "import", "create_engine_try_nolock", "engine", "=", "create_engine_try_nolock", "(", "args", ".", "type", ",", "args", ".", "files", "[", "0", "]", ",", "echo", "=", ...
Creates all necessary tables (only to be used at the first time)
[ "Creates", "all", "necessary", "tables", "(", "only", "to", "be", "used", "at", "the", "first", "time", ")" ]
train
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L112-L117
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
create
def create(args): """Creates or re-creates this database""" from bob.db.utils import session_try_nolock dbfile = args.files[0] if args.recreate: if args.verbose and os.path.exists(dbfile): print('unlinking %s...' % dbfile) if os.path.exists(dbfile): os.unlink(dbfile) if not os.path.exists(os...
python
def create(args): """Creates or re-creates this database""" from bob.db.utils import session_try_nolock dbfile = args.files[0] if args.recreate: if args.verbose and os.path.exists(dbfile): print('unlinking %s...' % dbfile) if os.path.exists(dbfile): os.unlink(dbfile) if not os.path.exists(os...
[ "def", "create", "(", "args", ")", ":", "from", "bob", ".", "db", ".", "utils", "import", "session_try_nolock", "dbfile", "=", "args", ".", "files", "[", "0", "]", "if", "args", ".", "recreate", ":", "if", "args", ".", "verbose", "and", "os", ".", ...
Creates or re-creates this database
[ "Creates", "or", "re", "-", "creates", "this", "database" ]
train
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L122-L144
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/create.py
add_command
def add_command(subparsers): """Add specific subcommands that the action "create" can use""" parser = subparsers.add_parser('create', help=create.__doc__) parser.add_argument('-R', '--recreate', action='store_true', help="If set, I'll first erase the current database") parser.add_argument('-v', '--verbose', a...
python
def add_command(subparsers): """Add specific subcommands that the action "create" can use""" parser = subparsers.add_parser('create', help=create.__doc__) parser.add_argument('-R', '--recreate', action='store_true', help="If set, I'll first erase the current database") parser.add_argument('-v', '--verbose', a...
[ "def", "add_command", "(", "subparsers", ")", ":", "parser", "=", "subparsers", ".", "add_parser", "(", "'create'", ",", "help", "=", "create", ".", "__doc__", ")", "parser", ".", "add_argument", "(", "'-R'", ",", "'--recreate'", ",", "action", "=", "'stor...
Add specific subcommands that the action "create" can use
[ "Add", "specific", "subcommands", "that", "the", "action", "create", "can", "use" ]
train
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/create.py#L146-L155
litters/shrew
shrew/cli.py
entrypoint
def entrypoint(method, depth=1, cls=None): """ Run a method as your __main__ via decorator. Example:: @shrew.cli.entrypoint def main(cli): ... Shorthand for:: def main(): cli = shrew.cli.CLI() ... if __name__ == '__main__': ...
python
def entrypoint(method, depth=1, cls=None): """ Run a method as your __main__ via decorator. Example:: @shrew.cli.entrypoint def main(cli): ... Shorthand for:: def main(): cli = shrew.cli.CLI() ... if __name__ == '__main__': ...
[ "def", "entrypoint", "(", "method", ",", "depth", "=", "1", ",", "cls", "=", "None", ")", ":", "current_frame", "=", "inspect", ".", "currentframe", "(", "depth", ")", ".", "f_locals", "if", "'__name__'", "in", "current_frame", "and", "current_frame", "[",...
Run a method as your __main__ via decorator. Example:: @shrew.cli.entrypoint def main(cli): ... Shorthand for:: def main(): cli = shrew.cli.CLI() ... if __name__ == '__main__': method()
[ "Run", "a", "method", "as", "your", "__main__", "via", "decorator", "." ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L30-L61
litters/shrew
shrew/cli.py
CLI.add_config_option
def add_config_option(self, default=None): """ Add a --config option to the argument parser. """ self.argparser.add_argument('--config', default=default, help='Config file to read. Defaults to: %(default)s') self.should_parse_config = True
python
def add_config_option(self, default=None): """ Add a --config option to the argument parser. """ self.argparser.add_argument('--config', default=default, help='Config file to read. Defaults to: %(default)s') self.should_parse_config = True
[ "def", "add_config_option", "(", "self", ",", "default", "=", "None", ")", ":", "self", ".", "argparser", ".", "add_argument", "(", "'--config'", ",", "default", "=", "default", ",", "help", "=", "'Config file to read. Defaults to: %(default)s'", ")", "self", "....
Add a --config option to the argument parser.
[ "Add", "a", "--", "config", "option", "to", "the", "argument", "parser", "." ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L216-L220
litters/shrew
shrew/cli.py
CLI.add_username_password
def add_username_password(self, use_store=False): """ Add --username and --password options :param bool use_store: Name of the section (concept, command line options, API reference) """ self.argparser.add_argument('--username', default=None, help='Username') self.argparser.add_...
python
def add_username_password(self, use_store=False): """ Add --username and --password options :param bool use_store: Name of the section (concept, command line options, API reference) """ self.argparser.add_argument('--username', default=None, help='Username') self.argparser.add_...
[ "def", "add_username_password", "(", "self", ",", "use_store", "=", "False", ")", ":", "self", ".", "argparser", ".", "add_argument", "(", "'--username'", ",", "default", "=", "None", ",", "help", "=", "'Username'", ")", "self", ".", "argparser", ".", "add...
Add --username and --password options :param bool use_store: Name of the section (concept, command line options, API reference)
[ "Add", "--", "username", "and", "--", "password", "options", ":", "param", "bool", "use_store", ":", "Name", "of", "the", "section", "(", "concept", "command", "line", "options", "API", "reference", ")" ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L222-L230
litters/shrew
shrew/cli.py
CLI._add_documentation_link
def _add_documentation_link(self, links, section, variable_name, default=None): """ :param list links: List of links to append link of the form "Section: <link>", if link available :param str section: Name of the section (concept, command line options, API reference) :param str var...
python
def _add_documentation_link(self, links, section, variable_name, default=None): """ :param list links: List of links to append link of the form "Section: <link>", if link available :param str section: Name of the section (concept, command line options, API reference) :param str var...
[ "def", "_add_documentation_link", "(", "self", ",", "links", ",", "section", ",", "variable_name", ",", "default", "=", "None", ")", ":", "url", "=", "getattr", "(", "sys", ".", "modules", "[", "'__main__'", "]", ",", "variable_name", ",", "default", ")", ...
:param list links: List of links to append link of the form "Section: <link>", if link available :param str section: Name of the section (concept, command line options, API reference) :param str variable_name: Variable name in main module that should hold URL to documentation :param str de...
[ ":", "param", "list", "links", ":", "List", "of", "links", "to", "append", "link", "of", "the", "form", "Section", ":", "<link", ">", "if", "link", "available", ":", "param", "str", "section", ":", "Name", "of", "the", "section", "(", "concept", "comma...
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L232-L243
litters/shrew
shrew/cli.py
CLI.__parse_args
def __parse_args(self, accept_unrecognized_args=False): """ Invoke the argument parser. """ # If the user provided a description, use it. Otherwise grab the doc string. if self.description: self.argparser.description = self.description elif getattr(sys.modules['__main__'], '...
python
def __parse_args(self, accept_unrecognized_args=False): """ Invoke the argument parser. """ # If the user provided a description, use it. Otherwise grab the doc string. if self.description: self.argparser.description = self.description elif getattr(sys.modules['__main__'], '...
[ "def", "__parse_args", "(", "self", ",", "accept_unrecognized_args", "=", "False", ")", ":", "# If the user provided a description, use it. Otherwise grab the doc string.", "if", "self", ".", "description", ":", "self", ".", "argparser", ".", "description", "=", "self", ...
Invoke the argument parser.
[ "Invoke", "the", "argument", "parser", "." ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L245-L265
litters/shrew
shrew/cli.py
CLI.__parse_config
def __parse_config(self): """ Invoke the config file parser. """ if self.should_parse_config and (self.args.config or self.config_file): self.config = ConfigParser.SafeConfigParser() self.config.read(self.args.config or self.config_file)
python
def __parse_config(self): """ Invoke the config file parser. """ if self.should_parse_config and (self.args.config or self.config_file): self.config = ConfigParser.SafeConfigParser() self.config.read(self.args.config or self.config_file)
[ "def", "__parse_config", "(", "self", ")", ":", "if", "self", ".", "should_parse_config", "and", "(", "self", ".", "args", ".", "config", "or", "self", ".", "config_file", ")", ":", "self", ".", "config", "=", "ConfigParser", ".", "SafeConfigParser", "(", ...
Invoke the config file parser.
[ "Invoke", "the", "config", "file", "parser", "." ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L267-L272
litters/shrew
shrew/cli.py
CLI.__process_username_password
def __process_username_password(self): """ If indicated, process the username and password """ if self.use_username_password_store is not None: if self.args.clear_store: with load_config(sections=AUTH_SECTIONS) as config: config.remove_option(AUTH_SECTION...
python
def __process_username_password(self): """ If indicated, process the username and password """ if self.use_username_password_store is not None: if self.args.clear_store: with load_config(sections=AUTH_SECTIONS) as config: config.remove_option(AUTH_SECTION...
[ "def", "__process_username_password", "(", "self", ")", ":", "if", "self", ".", "use_username_password_store", "is", "not", "None", ":", "if", "self", ".", "args", ".", "clear_store", ":", "with", "load_config", "(", "sections", "=", "AUTH_SECTIONS", ")", "as"...
If indicated, process the username and password
[ "If", "indicated", "process", "the", "username", "and", "password" ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L274-L289
litters/shrew
shrew/cli.py
CLI.__finish_initializing
def __finish_initializing(self): """ Handle any initialization after arguments & config has been parsed. """ if self.args.debug or self.args.trace: # Set the console (StreamHandler) to allow debug statements. if self.args.debug: self.console.setLevel(logging.DEB...
python
def __finish_initializing(self): """ Handle any initialization after arguments & config has been parsed. """ if self.args.debug or self.args.trace: # Set the console (StreamHandler) to allow debug statements. if self.args.debug: self.console.setLevel(logging.DEB...
[ "def", "__finish_initializing", "(", "self", ")", ":", "if", "self", ".", "args", ".", "debug", "or", "self", ".", "args", ".", "trace", ":", "# Set the console (StreamHandler) to allow debug statements.", "if", "self", ".", "args", ".", "debug", ":", "self", ...
Handle any initialization after arguments & config has been parsed.
[ "Handle", "any", "initialization", "after", "arguments", "&", "config", "has", "been", "parsed", "." ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L291-L327
litters/shrew
shrew/cli.py
CLI.run
def run(self, accept_unrecognized_args=False): """ Called via the `with` statement to invoke the :func:`contextlib.contextmanager`. Control is then yielded back to the caller. All exceptions are caught & a stack trace emitted, except in the case of `shrew.cli.ExitedCleanly`. ...
python
def run(self, accept_unrecognized_args=False): """ Called via the `with` statement to invoke the :func:`contextlib.contextmanager`. Control is then yielded back to the caller. All exceptions are caught & a stack trace emitted, except in the case of `shrew.cli.ExitedCleanly`. ...
[ "def", "run", "(", "self", ",", "accept_unrecognized_args", "=", "False", ")", ":", "self", ".", "__parse_args", "(", "accept_unrecognized_args", ")", "self", ".", "__parse_config", "(", ")", "self", ".", "__process_username_password", "(", ")", "self", ".", "...
Called via the `with` statement to invoke the :func:`contextlib.contextmanager`. Control is then yielded back to the caller. All exceptions are caught & a stack trace emitted, except in the case of `shrew.cli.ExitedCleanly`.
[ "Called", "via", "the", "with", "statement", "to", "invoke", "the", ":", "func", ":", "contextlib", ".", "contextmanager", "." ]
train
https://github.com/litters/shrew/blob/ed4b1879321d858d6bc884d14fea7557372a4d41/shrew/cli.py#L339-L372
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI._make_request
def _make_request(self, suburl): """ Helper function for making requests :param suburl: The suburl to query :return: Decoded json object """ url = "{}/{}".format(self.API_BASE_URL, suburl) response = self.session.get(url) response.raise_for_status() ...
python
def _make_request(self, suburl): """ Helper function for making requests :param suburl: The suburl to query :return: Decoded json object """ url = "{}/{}".format(self.API_BASE_URL, suburl) response = self.session.get(url) response.raise_for_status() ...
[ "def", "_make_request", "(", "self", ",", "suburl", ")", ":", "url", "=", "\"{}/{}\"", ".", "format", "(", "self", ".", "API_BASE_URL", ",", "suburl", ")", "response", "=", "self", ".", "session", ".", "get", "(", "url", ")", "response", ".", "raise_fo...
Helper function for making requests :param suburl: The suburl to query :return: Decoded json object
[ "Helper", "function", "for", "making", "requests", ":", "param", "suburl", ":", "The", "suburl", "to", "query", ":", "return", ":", "Decoded", "json", "object" ]
train
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L28-L37
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_item
def get_item(self, item_number, raw=False): """ Get a dictionary or object with info about the given item number from the Hacker News API. Item can be a poll, story, comment or possibly other entry. Will raise an requests.HTTPError if we got a non-200 response back. Will raise a ValueErr...
python
def get_item(self, item_number, raw=False): """ Get a dictionary or object with info about the given item number from the Hacker News API. Item can be a poll, story, comment or possibly other entry. Will raise an requests.HTTPError if we got a non-200 response back. Will raise a ValueErr...
[ "def", "get_item", "(", "self", ",", "item_number", ",", "raw", "=", "False", ")", ":", "if", "not", "isinstance", "(", "item_number", ",", "int", ")", ":", "item_number", "=", "int", "(", "item_number", ")", "suburl", "=", "\"v0/item/{}.json\"", ".", "f...
Get a dictionary or object with info about the given item number from the Hacker News API. Item can be a poll, story, comment or possibly other entry. Will raise an requests.HTTPError if we got a non-200 response back. Will raise a ValueError if a item_number that can not be converted to int was...
[ "Get", "a", "dictionary", "or", "object", "with", "info", "about", "the", "given", "item", "number", "from", "the", "Hacker", "News", "API", ".", "Item", "can", "be", "a", "poll", "story", "comment", "or", "possibly", "other", "entry", ".", "Will", "rais...
train
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L39-L78
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_user
def get_user(self, user_name, raw=False): """ Get a dictionary or object with info about the given user from the Hacker News API. Will raise an requests.HTTPError if we got a non-200 response back. Response parameters: "id' -> The user's unique username. Case-sensiti...
python
def get_user(self, user_name, raw=False): """ Get a dictionary or object with info about the given user from the Hacker News API. Will raise an requests.HTTPError if we got a non-200 response back. Response parameters: "id' -> The user's unique username. Case-sensiti...
[ "def", "get_user", "(", "self", ",", "user_name", ",", "raw", "=", "False", ")", ":", "suburl", "=", "\"v0/user/{}.json\"", ".", "format", "(", "user_name", ")", "try", ":", "user_data", "=", "self", ".", "_make_request", "(", "suburl", ")", "except", "r...
Get a dictionary or object with info about the given user from the Hacker News API. Will raise an requests.HTTPError if we got a non-200 response back. Response parameters: "id' -> The user's unique username. Case-sensitive. Required. "delay" -> Delay in minutes betw...
[ "Get", "a", "dictionary", "or", "object", "with", "info", "about", "the", "given", "user", "from", "the", "Hacker", "News", "API", ".", "Will", "raise", "an", "requests", ".", "HTTPError", "if", "we", "got", "a", "non", "-", "200", "response", "back", ...
train
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L80-L106
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_top_stories
def get_top_stories(self): """ Get the item numbers for the current top stories. Will raise an requests.HTTPError if we got a non-200 response back. :return: A list with the top story item numbers. """ suburl = "v0/topstories.json" try: top_stories = s...
python
def get_top_stories(self): """ Get the item numbers for the current top stories. Will raise an requests.HTTPError if we got a non-200 response back. :return: A list with the top story item numbers. """ suburl = "v0/topstories.json" try: top_stories = s...
[ "def", "get_top_stories", "(", "self", ")", ":", "suburl", "=", "\"v0/topstories.json\"", "try", ":", "top_stories", "=", "self", ".", "_make_request", "(", "suburl", ")", "except", "requests", ".", "HTTPError", "as", "e", ":", "hn_logger", ".", "exception", ...
Get the item numbers for the current top stories. Will raise an requests.HTTPError if we got a non-200 response back. :return: A list with the top story item numbers.
[ "Get", "the", "item", "numbers", "for", "the", "current", "top", "stories", ".", "Will", "raise", "an", "requests", ".", "HTTPError", "if", "we", "got", "a", "non", "-", "200", "response", "back", ".", ":", "return", ":", "A", "list", "with", "the", ...
train
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L108-L120
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_max_item
def get_max_item(self): """ Get the current maximum item number :return: The current maximum item number. """ suburl = "v0/maxitem.json" try: max_item = self._make_request(suburl) except requests.HTTPError as e: hn_logger.exception('Faulted...
python
def get_max_item(self): """ Get the current maximum item number :return: The current maximum item number. """ suburl = "v0/maxitem.json" try: max_item = self._make_request(suburl) except requests.HTTPError as e: hn_logger.exception('Faulted...
[ "def", "get_max_item", "(", "self", ")", ":", "suburl", "=", "\"v0/maxitem.json\"", "try", ":", "max_item", "=", "self", ".", "_make_request", "(", "suburl", ")", "except", "requests", ".", "HTTPError", "as", "e", ":", "hn_logger", ".", "exception", "(", "...
Get the current maximum item number :return: The current maximum item number.
[ "Get", "the", "current", "maximum", "item", "number", ":", "return", ":", "The", "current", "maximum", "item", "number", "." ]
train
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L122-L133
rpcope1/HackerNewsAPI-Py
HackerNewsAPI/API.py
HackerNewsAPI.get_recent_updates
def get_recent_updates(self, raw=True): """ Get the most recent updates on Hacker News Response dictionary parameters: "items" -> A list of the most recently update items by item number. "profiles" -> A list of most recently updated user profiles by user name. ...
python
def get_recent_updates(self, raw=True): """ Get the most recent updates on Hacker News Response dictionary parameters: "items" -> A list of the most recently update items by item number. "profiles" -> A list of most recently updated user profiles by user name. ...
[ "def", "get_recent_updates", "(", "self", ",", "raw", "=", "True", ")", ":", "suburl", "=", "\"v0/updates.json\"", "try", ":", "updates_data", "=", "self", ".", "_make_request", "(", "suburl", ")", "except", "requests", ".", "HTTPError", "as", "e", ":", "h...
Get the most recent updates on Hacker News Response dictionary parameters: "items" -> A list of the most recently update items by item number. "profiles" -> A list of most recently updated user profiles by user name. :param raw: (optional): If true, return the raw dictio...
[ "Get", "the", "most", "recent", "updates", "on", "Hacker", "News" ]
train
https://github.com/rpcope1/HackerNewsAPI-Py/blob/b231aed24ec59fc32af320bbef27d48cc4b69914/HackerNewsAPI/API.py#L135-L153