repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
openvax/varcode
varcode/effects/mutate.py
insert_after
def insert_after(sequence, offset, new_residues): """Mutate the given sequence by inserting the string `new_residues` after `offset`. Parameters ---------- sequence : sequence String of amino acids or DNA bases offset : int Base 0 offset from start of sequence, after which we s...
python
def insert_after(sequence, offset, new_residues): """Mutate the given sequence by inserting the string `new_residues` after `offset`. Parameters ---------- sequence : sequence String of amino acids or DNA bases offset : int Base 0 offset from start of sequence, after which we s...
[ "def", "insert_after", "(", "sequence", ",", "offset", ",", "new_residues", ")", ":", "assert", "0", "<=", "offset", "<", "len", "(", "sequence", ")", ",", "\"Invalid position %d for sequence of length %d\"", "%", "(", "offset", ",", "len", "(", "sequence", ")...
Mutate the given sequence by inserting the string `new_residues` after `offset`. Parameters ---------- sequence : sequence String of amino acids or DNA bases offset : int Base 0 offset from start of sequence, after which we should insert `new_residues`. new_residues : ...
[ "Mutate", "the", "given", "sequence", "by", "inserting", "the", "string", "new_residues", "after", "offset", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/mutate.py#L40-L60
openvax/varcode
varcode/effects/mutate.py
substitute
def substitute(sequence, offset, ref, alt): """Mutate a sequence by substituting given `alt` at instead of `ref` at the given `position`. Parameters ---------- sequence : sequence String of amino acids or DNA bases offset : int Base 0 offset from start of `sequence` ref : ...
python
def substitute(sequence, offset, ref, alt): """Mutate a sequence by substituting given `alt` at instead of `ref` at the given `position`. Parameters ---------- sequence : sequence String of amino acids or DNA bases offset : int Base 0 offset from start of `sequence` ref : ...
[ "def", "substitute", "(", "sequence", ",", "offset", ",", "ref", ",", "alt", ")", ":", "n_ref", "=", "len", "(", "ref", ")", "sequence_ref", "=", "sequence", "[", "offset", ":", "offset", "+", "n_ref", "]", "assert", "str", "(", "sequence_ref", ")", ...
Mutate a sequence by substituting given `alt` at instead of `ref` at the given `position`. Parameters ---------- sequence : sequence String of amino acids or DNA bases offset : int Base 0 offset from start of `sequence` ref : sequence or str What do we expect to find a...
[ "Mutate", "a", "sequence", "by", "substituting", "given", "alt", "at", "instead", "of", "ref", "at", "the", "given", "position", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/mutate.py#L62-L87
openvax/varcode
varcode/reference.py
_most_recent_assembly
def _most_recent_assembly(assembly_names): """ Given list of (in this case, matched) assemblies, identify the most recent ("recency" here is determined by sorting based on the numeric element of the assembly name) """ match_recency = [ int(re.search('\d+', assembly_name).group()) ...
python
def _most_recent_assembly(assembly_names): """ Given list of (in this case, matched) assemblies, identify the most recent ("recency" here is determined by sorting based on the numeric element of the assembly name) """ match_recency = [ int(re.search('\d+', assembly_name).group()) ...
[ "def", "_most_recent_assembly", "(", "assembly_names", ")", ":", "match_recency", "=", "[", "int", "(", "re", ".", "search", "(", "'\\d+'", ",", "assembly_name", ")", ".", "group", "(", ")", ")", "for", "assembly_name", "in", "assembly_names", "]", "most_rec...
Given list of (in this case, matched) assemblies, identify the most recent ("recency" here is determined by sorting based on the numeric element of the assembly name)
[ "Given", "list", "of", "(", "in", "this", "case", "matched", ")", "assemblies", "identify", "the", "most", "recent", "(", "recency", "here", "is", "determined", "by", "sorting", "based", "on", "the", "numeric", "element", "of", "the", "assembly", "name", "...
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/reference.py#L45-L56
openvax/varcode
varcode/reference.py
infer_reference_name
def infer_reference_name(reference_name_or_path): """ Given a string containing a reference name (such as a path to that reference's FASTA file), return its canonical name as used by Ensembl. """ # identify all cases where reference name or path matches candidate aliases reference_file_name ...
python
def infer_reference_name(reference_name_or_path): """ Given a string containing a reference name (such as a path to that reference's FASTA file), return its canonical name as used by Ensembl. """ # identify all cases where reference name or path matches candidate aliases reference_file_name ...
[ "def", "infer_reference_name", "(", "reference_name_or_path", ")", ":", "# identify all cases where reference name or path matches candidate aliases", "reference_file_name", "=", "os", ".", "path", ".", "basename", "(", "reference_name_or_path", ")", "matches", "=", "{", "'fi...
Given a string containing a reference name (such as a path to that reference's FASTA file), return its canonical name as used by Ensembl.
[ "Given", "a", "string", "containing", "a", "reference", "name", "(", "such", "as", "a", "path", "to", "that", "reference", "s", "FASTA", "file", ")", "return", "its", "canonical", "name", "as", "used", "by", "Ensembl", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/reference.py#L59-L99
openvax/varcode
varcode/reference.py
infer_genome
def infer_genome(genome_object_string_or_int): """ If given an integer, return associated human EnsemblRelease for that Ensembl version. If given a string, return latest EnsemblRelease which has a reference of the same name. If given a PyEnsembl Genome, simply return it. """ if isinsta...
python
def infer_genome(genome_object_string_or_int): """ If given an integer, return associated human EnsemblRelease for that Ensembl version. If given a string, return latest EnsemblRelease which has a reference of the same name. If given a PyEnsembl Genome, simply return it. """ if isinsta...
[ "def", "infer_genome", "(", "genome_object_string_or_int", ")", ":", "if", "isinstance", "(", "genome_object_string_or_int", ",", "Genome", ")", ":", "return", "genome_object_string_or_int", "if", "is_integer", "(", "genome_object_string_or_int", ")", ":", "return", "ca...
If given an integer, return associated human EnsemblRelease for that Ensembl version. If given a string, return latest EnsemblRelease which has a reference of the same name. If given a PyEnsembl Genome, simply return it.
[ "If", "given", "an", "integer", "return", "associated", "human", "EnsemblRelease", "for", "that", "Ensembl", "version", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/reference.py#L102-L126
openvax/varcode
varcode/variant.py
Variant.to_dict
def to_dict(self): """ We want the original values (un-normalized) field values while serializing since normalization will happen in __init__. """ return dict( contig=self.original_contig, start=self.original_start, ref=self.original_ref, ...
python
def to_dict(self): """ We want the original values (un-normalized) field values while serializing since normalization will happen in __init__. """ return dict( contig=self.original_contig, start=self.original_start, ref=self.original_ref, ...
[ "def", "to_dict", "(", "self", ")", ":", "return", "dict", "(", "contig", "=", "self", ".", "original_contig", ",", "start", "=", "self", ".", "original_start", ",", "ref", "=", "self", ".", "original_ref", ",", "alt", "=", "self", ".", "original_alt", ...
We want the original values (un-normalized) field values while serializing since normalization will happen in __init__.
[ "We", "want", "the", "original", "values", "(", "un", "-", "normalized", ")", "field", "values", "while", "serializing", "since", "normalization", "will", "happen", "in", "__init__", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L213-L225
openvax/varcode
varcode/variant.py
Variant.short_description
def short_description(self): """ HGVS nomenclature for genomic variants More info: http://www.hgvs.org/mutnomen/ """ if self.is_insertion: return "chr%s g.%d_%dins%s" % ( self.contig, self.start, self.start + 1, ...
python
def short_description(self): """ HGVS nomenclature for genomic variants More info: http://www.hgvs.org/mutnomen/ """ if self.is_insertion: return "chr%s g.%d_%dins%s" % ( self.contig, self.start, self.start + 1, ...
[ "def", "short_description", "(", "self", ")", ":", "if", "self", ".", "is_insertion", ":", "return", "\"chr%s g.%d_%dins%s\"", "%", "(", "self", ".", "contig", ",", "self", ".", "start", ",", "self", ".", "start", "+", "1", ",", "self", ".", "alt", ")"...
HGVS nomenclature for genomic variants More info: http://www.hgvs.org/mutnomen/
[ "HGVS", "nomenclature", "for", "genomic", "variants", "More", "info", ":", "http", ":", "//", "www", ".", "hgvs", ".", "org", "/", "mutnomen", "/" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L268-L293
openvax/varcode
varcode/variant.py
Variant.genes
def genes(self): """ Return Gene object for all genes which overlap this variant. """ if self._genes is None: self._genes = self.ensembl.genes_at_locus( self.contig, self.start, self.end) return self._genes
python
def genes(self): """ Return Gene object for all genes which overlap this variant. """ if self._genes is None: self._genes = self.ensembl.genes_at_locus( self.contig, self.start, self.end) return self._genes
[ "def", "genes", "(", "self", ")", ":", "if", "self", ".", "_genes", "is", "None", ":", "self", ".", "_genes", "=", "self", ".", "ensembl", ".", "genes_at_locus", "(", "self", ".", "contig", ",", "self", ".", "start", ",", "self", ".", "end", ")", ...
Return Gene object for all genes which overlap this variant.
[ "Return", "Gene", "object", "for", "all", "genes", "which", "overlap", "this", "variant", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L322-L329
openvax/varcode
varcode/variant.py
Variant.gene_ids
def gene_ids(self): """ Return IDs of all genes which overlap this variant. Calling this method is significantly cheaper than calling `Variant.genes()`, which has to issue many more queries to construct each Gene object. """ return self.ensembl.gene_ids_at_locus( ...
python
def gene_ids(self): """ Return IDs of all genes which overlap this variant. Calling this method is significantly cheaper than calling `Variant.genes()`, which has to issue many more queries to construct each Gene object. """ return self.ensembl.gene_ids_at_locus( ...
[ "def", "gene_ids", "(", "self", ")", ":", "return", "self", ".", "ensembl", ".", "gene_ids_at_locus", "(", "self", ".", "contig", ",", "self", ".", "start", ",", "self", ".", "end", ")" ]
Return IDs of all genes which overlap this variant. Calling this method is significantly cheaper than calling `Variant.genes()`, which has to issue many more queries to construct each Gene object.
[ "Return", "IDs", "of", "all", "genes", "which", "overlap", "this", "variant", ".", "Calling", "this", "method", "is", "significantly", "cheaper", "than", "calling", "Variant", ".", "genes", "()", "which", "has", "to", "issue", "many", "more", "queries", "to"...
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L332-L339
openvax/varcode
varcode/variant.py
Variant.gene_names
def gene_names(self): """ Return names of all genes which overlap this variant. Calling this method is significantly cheaper than calling `Variant.genes()`, which has to issue many more queries to construct each Gene object. """ return self.ensembl.gene_names_at_locus( ...
python
def gene_names(self): """ Return names of all genes which overlap this variant. Calling this method is significantly cheaper than calling `Variant.genes()`, which has to issue many more queries to construct each Gene object. """ return self.ensembl.gene_names_at_locus( ...
[ "def", "gene_names", "(", "self", ")", ":", "return", "self", ".", "ensembl", ".", "gene_names_at_locus", "(", "self", ".", "contig", ",", "self", ".", "start", ",", "self", ".", "end", ")" ]
Return names of all genes which overlap this variant. Calling this method is significantly cheaper than calling `Variant.genes()`, which has to issue many more queries to construct each Gene object.
[ "Return", "names", "of", "all", "genes", "which", "overlap", "this", "variant", ".", "Calling", "this", "method", "is", "significantly", "cheaper", "than", "calling", "Variant", ".", "genes", "()", "which", "has", "to", "issue", "many", "more", "queries", "t...
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L342-L349
openvax/varcode
varcode/variant.py
Variant.is_insertion
def is_insertion(self): """ Does this variant represent the insertion of nucleotides into the reference genome? """ # An insertion would appear in a VCF like C>CT, so that the # alternate allele starts with the reference nucleotides. # Since the nucleotide strings...
python
def is_insertion(self): """ Does this variant represent the insertion of nucleotides into the reference genome? """ # An insertion would appear in a VCF like C>CT, so that the # alternate allele starts with the reference nucleotides. # Since the nucleotide strings...
[ "def", "is_insertion", "(", "self", ")", ":", "# An insertion would appear in a VCF like C>CT, so that the", "# alternate allele starts with the reference nucleotides.", "# Since the nucleotide strings may be normalized in the constructor,", "# it's worth noting that the normalized form of this va...
Does this variant represent the insertion of nucleotides into the reference genome?
[ "Does", "this", "variant", "represent", "the", "insertion", "of", "nucleotides", "into", "the", "reference", "genome?" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L369-L379
openvax/varcode
varcode/variant.py
Variant.is_deletion
def is_deletion(self): """ Does this variant represent the deletion of nucleotides from the reference genome? """ # A deletion would appear in a VCF like CT>C, so that the # reference allele starts with the alternate nucleotides. # This is true even in the normali...
python
def is_deletion(self): """ Does this variant represent the deletion of nucleotides from the reference genome? """ # A deletion would appear in a VCF like CT>C, so that the # reference allele starts with the alternate nucleotides. # This is true even in the normali...
[ "def", "is_deletion", "(", "self", ")", ":", "# A deletion would appear in a VCF like CT>C, so that the", "# reference allele starts with the alternate nucleotides.", "# This is true even in the normalized case, where the alternate", "# nucleotides are an empty string.", "return", "(", "len"...
Does this variant represent the deletion of nucleotides from the reference genome?
[ "Does", "this", "variant", "represent", "the", "deletion", "of", "nucleotides", "from", "the", "reference", "genome?" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L382-L391
openvax/varcode
varcode/variant.py
Variant.is_snv
def is_snv(self): """Is the variant a single nucleotide variant""" return (len(self.ref) == len(self.alt) == 1) and (self.ref != self.alt)
python
def is_snv(self): """Is the variant a single nucleotide variant""" return (len(self.ref) == len(self.alt) == 1) and (self.ref != self.alt)
[ "def", "is_snv", "(", "self", ")", ":", "return", "(", "len", "(", "self", ".", "ref", ")", "==", "len", "(", "self", ".", "alt", ")", "==", "1", ")", "and", "(", "self", ".", "ref", "!=", "self", ".", "alt", ")" ]
Is the variant a single nucleotide variant
[ "Is", "the", "variant", "a", "single", "nucleotide", "variant" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L399-L401
openvax/varcode
varcode/variant.py
Variant.is_transition
def is_transition(self): """Is this variant and pyrimidine to pyrimidine change or purine to purine change""" return self.is_snv and is_purine(self.ref) == is_purine(self.alt)
python
def is_transition(self): """Is this variant and pyrimidine to pyrimidine change or purine to purine change""" return self.is_snv and is_purine(self.ref) == is_purine(self.alt)
[ "def", "is_transition", "(", "self", ")", ":", "return", "self", ".", "is_snv", "and", "is_purine", "(", "self", ".", "ref", ")", "==", "is_purine", "(", "self", ".", "alt", ")" ]
Is this variant and pyrimidine to pyrimidine change or purine to purine change
[ "Is", "this", "variant", "and", "pyrimidine", "to", "pyrimidine", "change", "or", "purine", "to", "purine", "change" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L404-L406
openvax/varcode
varcode/variant.py
Variant.is_transversion
def is_transversion(self): """Is this variant a pyrimidine to purine change or vice versa""" return self.is_snv and is_purine(self.ref) != is_purine(self.alt)
python
def is_transversion(self): """Is this variant a pyrimidine to purine change or vice versa""" return self.is_snv and is_purine(self.ref) != is_purine(self.alt)
[ "def", "is_transversion", "(", "self", ")", ":", "return", "self", ".", "is_snv", "and", "is_purine", "(", "self", ".", "ref", ")", "!=", "is_purine", "(", "self", ".", "alt", ")" ]
Is this variant a pyrimidine to purine change or vice versa
[ "Is", "this", "variant", "a", "pyrimidine", "to", "purine", "change", "or", "vice", "versa" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/variant.py#L409-L411
openvax/varcode
varcode/effects/effect_helpers.py
variant_overlaps_interval
def variant_overlaps_interval( variant_start, n_ref_bases, interval_start, interval_end): """ Does a variant overlap a given interval on the same chromosome? Parameters ---------- variant_start : int Inclusive base-1 position of variant's starting location ...
python
def variant_overlaps_interval( variant_start, n_ref_bases, interval_start, interval_end): """ Does a variant overlap a given interval on the same chromosome? Parameters ---------- variant_start : int Inclusive base-1 position of variant's starting location ...
[ "def", "variant_overlaps_interval", "(", "variant_start", ",", "n_ref_bases", ",", "interval_start", ",", "interval_end", ")", ":", "if", "n_ref_bases", "==", "0", ":", "# insertions only overlap intervals which start before and", "# end after the insertion point, they must be fu...
Does a variant overlap a given interval on the same chromosome? Parameters ---------- variant_start : int Inclusive base-1 position of variant's starting location (or location before an insertion) n_ref_bases : int Number of reference bases affect by variant (used to compute ...
[ "Does", "a", "variant", "overlap", "a", "given", "interval", "on", "the", "same", "chromosome?" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_helpers.py#L23-L61
openvax/varcode
varcode/effects/effect_helpers.py
changes_exonic_splice_site
def changes_exonic_splice_site( transcript_offset, transcript, transcript_ref, transcript_alt, exon_start_offset, exon_end_offset, exon_number): """Does the given exonic mutation of a particular transcript change a splice site? Parameters --------...
python
def changes_exonic_splice_site( transcript_offset, transcript, transcript_ref, transcript_alt, exon_start_offset, exon_end_offset, exon_number): """Does the given exonic mutation of a particular transcript change a splice site? Parameters --------...
[ "def", "changes_exonic_splice_site", "(", "transcript_offset", ",", "transcript", ",", "transcript_ref", ",", "transcript_alt", ",", "exon_start_offset", ",", "exon_end_offset", ",", "exon_number", ")", ":", "# first we're going to make sure the variant doesn't disrupt the", "#...
Does the given exonic mutation of a particular transcript change a splice site? Parameters ---------- transcript_offset : int Offset from start of transcript of first reference nucleotide (or the last nucleotide before an insertion) transcript : pyensembl.Transcript transcript...
[ "Does", "the", "given", "exonic", "mutation", "of", "a", "particular", "transcript", "change", "a", "splice", "site?" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_helpers.py#L72-L163
openvax/varcode
varcode/nucleotides.py
is_purine
def is_purine(nucleotide, allow_extended_nucleotides=False): """Is the nucleotide a purine""" if not allow_extended_nucleotides and nucleotide not in STANDARD_NUCLEOTIDES: raise ValueError( "{} is a non-standard nucleotide, neither purine or pyrimidine".format(nucleotide)) return nucleot...
python
def is_purine(nucleotide, allow_extended_nucleotides=False): """Is the nucleotide a purine""" if not allow_extended_nucleotides and nucleotide not in STANDARD_NUCLEOTIDES: raise ValueError( "{} is a non-standard nucleotide, neither purine or pyrimidine".format(nucleotide)) return nucleot...
[ "def", "is_purine", "(", "nucleotide", ",", "allow_extended_nucleotides", "=", "False", ")", ":", "if", "not", "allow_extended_nucleotides", "and", "nucleotide", "not", "in", "STANDARD_NUCLEOTIDES", ":", "raise", "ValueError", "(", "\"{} is a non-standard nucleotide, neit...
Is the nucleotide a purine
[ "Is", "the", "nucleotide", "a", "purine" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/nucleotides.py#L55-L60
openvax/varcode
varcode/nucleotides.py
normalize_nucleotide_string
def normalize_nucleotide_string( nucleotides, allow_extended_nucleotides=False, empty_chars=".-", treat_nan_as_empty=True): """ Normalizes a nucleotide string by converting various ways of encoding empty strings into "", making all letters upper case, and checking to make sur...
python
def normalize_nucleotide_string( nucleotides, allow_extended_nucleotides=False, empty_chars=".-", treat_nan_as_empty=True): """ Normalizes a nucleotide string by converting various ways of encoding empty strings into "", making all letters upper case, and checking to make sur...
[ "def", "normalize_nucleotide_string", "(", "nucleotides", ",", "allow_extended_nucleotides", "=", "False", ",", "empty_chars", "=", "\".-\"", ",", "treat_nan_as_empty", "=", "True", ")", ":", "if", "nucleotides", "in", "empty_chars", ":", "return", "\"\"", "elif", ...
Normalizes a nucleotide string by converting various ways of encoding empty strings into "", making all letters upper case, and checking to make sure all letters in the string are actually nucleotides. Parameters ---------- nucleotides : str Sequence of nucleotides, e.g. "ACCTG" extend...
[ "Normalizes", "a", "nucleotide", "string", "by", "converting", "various", "ways", "of", "encoding", "empty", "strings", "into", "making", "all", "letters", "upper", "case", "and", "checking", "to", "make", "sure", "all", "letters", "in", "the", "string", "are"...
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/nucleotides.py#L67-L111
openvax/varcode
varcode/vcf.py
load_vcf
def load_vcf( path, genome=None, reference_vcf_key="reference", only_passing=True, allow_extended_nucleotides=False, include_info=True, chunk_size=10 ** 5, max_variants=None, sort_key=variant_ascending_position_sort_key, distinct=True): ...
python
def load_vcf( path, genome=None, reference_vcf_key="reference", only_passing=True, allow_extended_nucleotides=False, include_info=True, chunk_size=10 ** 5, max_variants=None, sort_key=variant_ascending_position_sort_key, distinct=True): ...
[ "def", "load_vcf", "(", "path", ",", "genome", "=", "None", ",", "reference_vcf_key", "=", "\"reference\"", ",", "only_passing", "=", "True", ",", "allow_extended_nucleotides", "=", "False", ",", "include_info", "=", "True", ",", "chunk_size", "=", "10", "**",...
Load reference name and Variant objects from the given VCF filename. Currently only local files are supported by this function (no http). If you call this on an HTTP URL, it will fall back to `load_vcf`. Parameters ---------- path : str Path to VCF (*.vcf) or compressed VCF (*.vcf.gz). ...
[ "Load", "reference", "name", "and", "Variant", "objects", "from", "the", "given", "VCF", "filename", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf.py#L37-L176
openvax/varcode
varcode/vcf.py
pyvcf_calls_to_sample_info_list
def pyvcf_calls_to_sample_info_list(calls): """ Given pyvcf.model._Call instances, return a dict mapping each sample name to its per-sample info: sample name -> field -> value """ return OrderedDict( (call.sample, call.data._asdict()) for call in calls)
python
def pyvcf_calls_to_sample_info_list(calls): """ Given pyvcf.model._Call instances, return a dict mapping each sample name to its per-sample info: sample name -> field -> value """ return OrderedDict( (call.sample, call.data._asdict()) for call in calls)
[ "def", "pyvcf_calls_to_sample_info_list", "(", "calls", ")", ":", "return", "OrderedDict", "(", "(", "call", ".", "sample", ",", "call", ".", "data", ".", "_asdict", "(", ")", ")", "for", "call", "in", "calls", ")" ]
Given pyvcf.model._Call instances, return a dict mapping each sample name to its per-sample info: sample name -> field -> value
[ "Given", "pyvcf", ".", "model", ".", "_Call", "instances", "return", "a", "dict", "mapping", "each", "sample", "name", "to", "its", "per", "-", "sample", "info", ":", "sample", "name", "-", ">", "field", "-", ">", "value" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf.py#L189-L196
openvax/varcode
varcode/vcf.py
dataframes_to_variant_collection
def dataframes_to_variant_collection( dataframes, source_path, info_parser=None, only_passing=True, max_variants=None, sample_names=None, sample_info_parser=None, variant_kwargs={}, variant_collection_kwargs={}): """ Load a VariantCollectio...
python
def dataframes_to_variant_collection( dataframes, source_path, info_parser=None, only_passing=True, max_variants=None, sample_names=None, sample_info_parser=None, variant_kwargs={}, variant_collection_kwargs={}): """ Load a VariantCollectio...
[ "def", "dataframes_to_variant_collection", "(", "dataframes", ",", "source_path", ",", "info_parser", "=", "None", ",", "only_passing", "=", "True", ",", "max_variants", "=", "None", ",", "sample_names", "=", "None", ",", "sample_info_parser", "=", "None", ",", ...
Load a VariantCollection from an iterable of pandas dataframes. This takes an iterable of dataframes instead of a single dataframe to avoid having to load huge dataframes at once into memory. If you have a single dataframe, just pass it in a single-element list. Parameters ---------- dataframe...
[ "Load", "a", "VariantCollection", "from", "an", "iterable", "of", "pandas", "dataframes", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf.py#L199-L321
openvax/varcode
varcode/vcf.py
read_vcf_into_dataframe
def read_vcf_into_dataframe( path, include_info=False, sample_names=None, chunk_size=None): """ Load the data of a VCF into a pandas dataframe. All headers are ignored. Parameters ---------- path : str Path to local file. HTTP and other protocols are not impl...
python
def read_vcf_into_dataframe( path, include_info=False, sample_names=None, chunk_size=None): """ Load the data of a VCF into a pandas dataframe. All headers are ignored. Parameters ---------- path : str Path to local file. HTTP and other protocols are not impl...
[ "def", "read_vcf_into_dataframe", "(", "path", ",", "include_info", "=", "False", ",", "sample_names", "=", "None", ",", "chunk_size", "=", "None", ")", ":", "vcf_field_types", "=", "OrderedDict", "(", ")", "vcf_field_types", "[", "'CHROM'", "]", "=", "str", ...
Load the data of a VCF into a pandas dataframe. All headers are ignored. Parameters ---------- path : str Path to local file. HTTP and other protocols are not implemented. include_info : boolean, default False If true, the INFO field is not parsed, but is included as a string in ...
[ "Load", "the", "data", "of", "a", "VCF", "into", "a", "pandas", "dataframe", ".", "All", "headers", "are", "ignored", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf.py#L324-L390
openvax/varcode
varcode/vcf.py
stream_gzip_decompress_lines
def stream_gzip_decompress_lines(stream): """ Uncompress a gzip stream into lines of text. Parameters ---------- Generator of chunks of gzip compressed text. Returns ------- Generator of uncompressed lines. """ dec = zlib.decompressobj(zlib.MAX_WBITS | 16) previous = "" ...
python
def stream_gzip_decompress_lines(stream): """ Uncompress a gzip stream into lines of text. Parameters ---------- Generator of chunks of gzip compressed text. Returns ------- Generator of uncompressed lines. """ dec = zlib.decompressobj(zlib.MAX_WBITS | 16) previous = "" ...
[ "def", "stream_gzip_decompress_lines", "(", "stream", ")", ":", "dec", "=", "zlib", ".", "decompressobj", "(", "zlib", ".", "MAX_WBITS", "|", "16", ")", "previous", "=", "\"\"", "for", "compressed_chunk", "in", "stream", ":", "chunk", "=", "dec", ".", "dec...
Uncompress a gzip stream into lines of text. Parameters ---------- Generator of chunks of gzip compressed text. Returns ------- Generator of uncompressed lines.
[ "Uncompress", "a", "gzip", "stream", "into", "lines", "of", "text", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf.py#L448-L469
openvax/varcode
varcode/vcf.py
infer_genome_from_vcf
def infer_genome_from_vcf(genome, vcf_reader, reference_vcf_key): """ Helper function to make a pyensembl.Genome instance. """ if genome: return infer_genome(genome) elif reference_vcf_key not in vcf_reader.metadata: raise ValueError("Unable to infer reference genome for %s" % ( ...
python
def infer_genome_from_vcf(genome, vcf_reader, reference_vcf_key): """ Helper function to make a pyensembl.Genome instance. """ if genome: return infer_genome(genome) elif reference_vcf_key not in vcf_reader.metadata: raise ValueError("Unable to infer reference genome for %s" % ( ...
[ "def", "infer_genome_from_vcf", "(", "genome", ",", "vcf_reader", ",", "reference_vcf_key", ")", ":", "if", "genome", ":", "return", "infer_genome", "(", "genome", ")", "elif", "reference_vcf_key", "not", "in", "vcf_reader", ".", "metadata", ":", "raise", "Value...
Helper function to make a pyensembl.Genome instance.
[ "Helper", "function", "to", "make", "a", "pyensembl", ".", "Genome", "instance", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf.py#L472-L483
openvax/varcode
varcode/effects/effect_prediction_coding_frameshift.py
create_frameshift_effect
def create_frameshift_effect( mutated_codon_index, sequence_from_mutated_codon, variant, transcript): """ Determine frameshift effect within a coding sequence (possibly affecting either the start or stop codons, or anythign in between) Parameters ---------- mutat...
python
def create_frameshift_effect( mutated_codon_index, sequence_from_mutated_codon, variant, transcript): """ Determine frameshift effect within a coding sequence (possibly affecting either the start or stop codons, or anythign in between) Parameters ---------- mutat...
[ "def", "create_frameshift_effect", "(", "mutated_codon_index", ",", "sequence_from_mutated_codon", ",", "variant", ",", "transcript", ")", ":", "assert", "transcript", ".", "protein_sequence", "is", "not", "None", ",", "\"Expect transcript %s to have protein sequence\"", "%...
Determine frameshift effect within a coding sequence (possibly affecting either the start or stop codons, or anythign in between) Parameters ---------- mutated_codon_index : int Codon offset (starting from 0 = start codon) of first non-reference amino acid in the variant protein se...
[ "Determine", "frameshift", "effect", "within", "a", "coding", "sequence", "(", "possibly", "affecting", "either", "the", "start", "or", "stop", "codons", "or", "anythign", "in", "between", ")" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction_coding_frameshift.py#L35-L123
openvax/varcode
varcode/effects/effect_prediction_coding_frameshift.py
cdna_codon_sequence_after_insertion_frameshift
def cdna_codon_sequence_after_insertion_frameshift( sequence_from_start_codon, cds_offset_before_insertion, inserted_nucleotides): """ Returns index of mutated codon and nucleotide sequence starting at the first mutated codon. """ # special logic for insertions coding_seq...
python
def cdna_codon_sequence_after_insertion_frameshift( sequence_from_start_codon, cds_offset_before_insertion, inserted_nucleotides): """ Returns index of mutated codon and nucleotide sequence starting at the first mutated codon. """ # special logic for insertions coding_seq...
[ "def", "cdna_codon_sequence_after_insertion_frameshift", "(", "sequence_from_start_codon", ",", "cds_offset_before_insertion", ",", "inserted_nucleotides", ")", ":", "# special logic for insertions", "coding_sequence_after_insertion", "=", "sequence_from_start_codon", "[", "cds_offset_...
Returns index of mutated codon and nucleotide sequence starting at the first mutated codon.
[ "Returns", "index", "of", "mutated", "codon", "and", "nucleotide", "sequence", "starting", "at", "the", "first", "mutated", "codon", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction_coding_frameshift.py#L125-L169
openvax/varcode
varcode/effects/effect_prediction_coding_frameshift.py
cdna_codon_sequence_after_deletion_or_substitution_frameshift
def cdna_codon_sequence_after_deletion_or_substitution_frameshift( sequence_from_start_codon, cds_offset, trimmed_cdna_ref, trimmed_cdna_alt): """ Logic for any frameshift which isn't an insertion. We have insertions as a special case since our base-inclusive indexing me...
python
def cdna_codon_sequence_after_deletion_or_substitution_frameshift( sequence_from_start_codon, cds_offset, trimmed_cdna_ref, trimmed_cdna_alt): """ Logic for any frameshift which isn't an insertion. We have insertions as a special case since our base-inclusive indexing me...
[ "def", "cdna_codon_sequence_after_deletion_or_substitution_frameshift", "(", "sequence_from_start_codon", ",", "cds_offset", ",", "trimmed_cdna_ref", ",", "trimmed_cdna_alt", ")", ":", "mutated_codon_index", "=", "cds_offset", "//", "3", "# get the sequence starting from the first ...
Logic for any frameshift which isn't an insertion. We have insertions as a special case since our base-inclusive indexing means something different for insertions: cds_offset = base before insertion Whereas in this case: cds_offset = first reference base affected by a variant Returns inde...
[ "Logic", "for", "any", "frameshift", "which", "isn", "t", "an", "insertion", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction_coding_frameshift.py#L172-L204
openvax/varcode
varcode/effects/effect_prediction_coding_frameshift.py
predict_frameshift_coding_effect
def predict_frameshift_coding_effect( variant, transcript, trimmed_cdna_ref, trimmed_cdna_alt, cds_offset, sequence_from_start_codon): """ Coding effect of a frameshift mutation. Parameters ---------- variant : Variant transcript : Transcript ...
python
def predict_frameshift_coding_effect( variant, transcript, trimmed_cdna_ref, trimmed_cdna_alt, cds_offset, sequence_from_start_codon): """ Coding effect of a frameshift mutation. Parameters ---------- variant : Variant transcript : Transcript ...
[ "def", "predict_frameshift_coding_effect", "(", "variant", ",", "transcript", ",", "trimmed_cdna_ref", ",", "trimmed_cdna_alt", ",", "cds_offset", ",", "sequence_from_start_codon", ")", ":", "if", "len", "(", "trimmed_cdna_ref", ")", "!=", "0", ":", "mutated_codon_ind...
Coding effect of a frameshift mutation. Parameters ---------- variant : Variant transcript : Transcript trimmed_cdna_ref : nucleotide sequence Reference nucleotides in the coding sequence of the given transcript. trimmed_cdna_alt : nucleotide sequence Alternate nucleotides in...
[ "Coding", "effect", "of", "a", "frameshift", "mutation", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction_coding_frameshift.py#L207-L254
openvax/varcode
varcode/effects/effect_prediction_coding.py
predict_variant_coding_effect_on_transcript
def predict_variant_coding_effect_on_transcript( variant, transcript, trimmed_cdna_ref, trimmed_cdna_alt, transcript_offset): """ Given a minimal cDNA ref/alt nucleotide string pair and an offset into a given transcript, determine the coding effect of this nucleotide ...
python
def predict_variant_coding_effect_on_transcript( variant, transcript, trimmed_cdna_ref, trimmed_cdna_alt, transcript_offset): """ Given a minimal cDNA ref/alt nucleotide string pair and an offset into a given transcript, determine the coding effect of this nucleotide ...
[ "def", "predict_variant_coding_effect_on_transcript", "(", "variant", ",", "transcript", ",", "trimmed_cdna_ref", ",", "trimmed_cdna_alt", ",", "transcript_offset", ")", ":", "if", "not", "transcript", ".", "complete", ":", "raise", "ValueError", "(", "(", "\"Can't an...
Given a minimal cDNA ref/alt nucleotide string pair and an offset into a given transcript, determine the coding effect of this nucleotide substitution onto the translated protein. Parameters ---------- variant : Variant transcript : Transcript trimmed_cdna_ref : str Reference nucl...
[ "Given", "a", "minimal", "cDNA", "ref", "/", "alt", "nucleotide", "string", "pair", "and", "an", "offset", "into", "a", "given", "transcript", "determine", "the", "coding", "effect", "of", "this", "nucleotide", "substitution", "onto", "the", "translated", "pro...
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction_coding.py#L21-L130
openvax/varcode
varcode/effects/effect_prediction.py
predict_variant_effects
def predict_variant_effects(variant, raise_on_error=False): """Determine the effects of a variant on any transcripts it overlaps. Returns an EffectCollection object. Parameters ---------- variant : Variant raise_on_error : bool Raise an exception if we encounter an error while trying t...
python
def predict_variant_effects(variant, raise_on_error=False): """Determine the effects of a variant on any transcripts it overlaps. Returns an EffectCollection object. Parameters ---------- variant : Variant raise_on_error : bool Raise an exception if we encounter an error while trying t...
[ "def", "predict_variant_effects", "(", "variant", ",", "raise_on_error", "=", "False", ")", ":", "# if this variant isn't overlapping any genes, return a", "# Intergenic effect", "# TODO: look for nearby genes and mark those as Upstream and Downstream", "# effects", "if", "len", "(",...
Determine the effects of a variant on any transcripts it overlaps. Returns an EffectCollection object. Parameters ---------- variant : Variant raise_on_error : bool Raise an exception if we encounter an error while trying to determine the effect of this variant on a transcript, or ...
[ "Determine", "the", "effects", "of", "a", "variant", "on", "any", "transcripts", "it", "overlaps", ".", "Returns", "an", "EffectCollection", "object", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction.py#L48-L92
openvax/varcode
varcode/effects/effect_prediction.py
predict_variant_effect_on_transcript_or_failure
def predict_variant_effect_on_transcript_or_failure(variant, transcript): """ Try predicting the effect of a variant on a particular transcript but suppress raised exceptions by converting them into `Failure` effect values. """ try: return predict_variant_effect_on_transcript( ...
python
def predict_variant_effect_on_transcript_or_failure(variant, transcript): """ Try predicting the effect of a variant on a particular transcript but suppress raised exceptions by converting them into `Failure` effect values. """ try: return predict_variant_effect_on_transcript( ...
[ "def", "predict_variant_effect_on_transcript_or_failure", "(", "variant", ",", "transcript", ")", ":", "try", ":", "return", "predict_variant_effect_on_transcript", "(", "variant", "=", "variant", ",", "transcript", "=", "transcript", ")", "except", "(", "AssertionError...
Try predicting the effect of a variant on a particular transcript but suppress raised exceptions by converting them into `Failure` effect values.
[ "Try", "predicting", "the", "effect", "of", "a", "variant", "on", "a", "particular", "transcript", "but", "suppress", "raised", "exceptions", "by", "converting", "them", "into", "Failure", "effect", "values", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction.py#L95-L111
openvax/varcode
varcode/effects/effect_prediction.py
predict_variant_effect_on_transcript
def predict_variant_effect_on_transcript(variant, transcript): """Return the transcript effect (such as FrameShift) that results from applying this genomic variant to a particular transcript. Parameters ---------- transcript : Transcript Transcript we're going to ap...
python
def predict_variant_effect_on_transcript(variant, transcript): """Return the transcript effect (such as FrameShift) that results from applying this genomic variant to a particular transcript. Parameters ---------- transcript : Transcript Transcript we're going to ap...
[ "def", "predict_variant_effect_on_transcript", "(", "variant", ",", "transcript", ")", ":", "if", "transcript", ".", "__class__", "is", "not", "Transcript", ":", "raise", "TypeError", "(", "\"Expected %s : %s to have type Transcript\"", "%", "(", "transcript", ",", "t...
Return the transcript effect (such as FrameShift) that results from applying this genomic variant to a particular transcript. Parameters ---------- transcript : Transcript Transcript we're going to apply mutation to.
[ "Return", "the", "transcript", "effect", "(", "such", "as", "FrameShift", ")", "that", "results", "from", "applying", "this", "genomic", "variant", "to", "a", "particular", "transcript", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction.py#L114-L220
openvax/varcode
varcode/effects/effect_prediction.py
choose_intronic_effect_class
def choose_intronic_effect_class( variant, nearest_exon, distance_to_exon): """ Infer effect of variant which does not overlap any exon of the given transcript. """ assert distance_to_exon > 0, \ "Expected intronic effect to have distance_to_exon > 0, got %d" % ( ...
python
def choose_intronic_effect_class( variant, nearest_exon, distance_to_exon): """ Infer effect of variant which does not overlap any exon of the given transcript. """ assert distance_to_exon > 0, \ "Expected intronic effect to have distance_to_exon > 0, got %d" % ( ...
[ "def", "choose_intronic_effect_class", "(", "variant", ",", "nearest_exon", ",", "distance_to_exon", ")", ":", "assert", "distance_to_exon", ">", "0", ",", "\"Expected intronic effect to have distance_to_exon > 0, got %d\"", "%", "(", "distance_to_exon", ",", ")", "if", "...
Infer effect of variant which does not overlap any exon of the given transcript.
[ "Infer", "effect", "of", "variant", "which", "does", "not", "overlap", "any", "exon", "of", "the", "given", "transcript", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction.py#L223-L271
openvax/varcode
varcode/effects/effect_prediction.py
exonic_transcript_effect
def exonic_transcript_effect(variant, exon, exon_number, transcript): """Effect of this variant on a Transcript, assuming we already know that this variant overlaps some exon of the transcript. Parameters ---------- variant : Variant exon : pyensembl.Exon Exon which this variant overla...
python
def exonic_transcript_effect(variant, exon, exon_number, transcript): """Effect of this variant on a Transcript, assuming we already know that this variant overlaps some exon of the transcript. Parameters ---------- variant : Variant exon : pyensembl.Exon Exon which this variant overla...
[ "def", "exonic_transcript_effect", "(", "variant", ",", "exon", ",", "exon_number", ",", "transcript", ")", ":", "genome_ref", "=", "variant", ".", "trimmed_ref", "genome_alt", "=", "variant", ".", "trimmed_alt", "variant_start", "=", "variant", ".", "trimmed_base...
Effect of this variant on a Transcript, assuming we already know that this variant overlaps some exon of the transcript. Parameters ---------- variant : Variant exon : pyensembl.Exon Exon which this variant overlaps exon_number : int Index (starting from 1) of the given exon i...
[ "Effect", "of", "this", "variant", "on", "a", "Transcript", "assuming", "we", "already", "know", "that", "this", "variant", "overlaps", "some", "exon", "of", "the", "transcript", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_prediction.py#L274-L397
openvax/varcode
varcode/common.py
apply_groupby
def apply_groupby(records, fn, skip_none=False): """ Given a list of objects, group them into a dictionary by applying fn to each one and using returned values as a dictionary key. Parameters ---------- records : list fn : function skip_none : bool If False, then None can ...
python
def apply_groupby(records, fn, skip_none=False): """ Given a list of objects, group them into a dictionary by applying fn to each one and using returned values as a dictionary key. Parameters ---------- records : list fn : function skip_none : bool If False, then None can ...
[ "def", "apply_groupby", "(", "records", ",", "fn", ",", "skip_none", "=", "False", ")", ":", "# create an empty list for every new key", "groups", "=", "defaultdict", "(", "list", ")", "for", "record", "in", "records", ":", "value", "=", "fn", "(", "record", ...
Given a list of objects, group them into a dictionary by applying fn to each one and using returned values as a dictionary key. Parameters ---------- records : list fn : function skip_none : bool If False, then None can be a key in the returned dictionary, otherwise record...
[ "Given", "a", "list", "of", "objects", "group", "them", "into", "a", "dictionary", "by", "applying", "fn", "to", "each", "one", "and", "using", "returned", "values", "as", "a", "dictionary", "key", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/common.py#L21-L46
openvax/varcode
varcode/common.py
groupby_field
def groupby_field(records, field_name, skip_none=True): """ Given a list of objects, group them into a dictionary by the unique values of a given field name. """ return apply_groupby( records, lambda obj: getattr(obj, field_name), skip_none=skip_none)
python
def groupby_field(records, field_name, skip_none=True): """ Given a list of objects, group them into a dictionary by the unique values of a given field name. """ return apply_groupby( records, lambda obj: getattr(obj, field_name), skip_none=skip_none)
[ "def", "groupby_field", "(", "records", ",", "field_name", ",", "skip_none", "=", "True", ")", ":", "return", "apply_groupby", "(", "records", ",", "lambda", "obj", ":", "getattr", "(", "obj", ",", "field_name", ")", ",", "skip_none", "=", "skip_none", ")"...
Given a list of objects, group them into a dictionary by the unique values of a given field name.
[ "Given", "a", "list", "of", "objects", "group", "them", "into", "a", "dictionary", "by", "the", "unique", "values", "of", "a", "given", "field", "name", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/common.py#L49-L57
openvax/varcode
varcode/common.py
memoize
def memoize(fn): """ Simple memoization decorator for functions and methods, assumes that all arguments to the function can be hashed and compared. """ memoized_values = {} @wraps(fn) def wrapped_fn(*args, **kwargs): key = (args, tuple(sorted(kwargs.items()))) try: ...
python
def memoize(fn): """ Simple memoization decorator for functions and methods, assumes that all arguments to the function can be hashed and compared. """ memoized_values = {} @wraps(fn) def wrapped_fn(*args, **kwargs): key = (args, tuple(sorted(kwargs.items()))) try: ...
[ "def", "memoize", "(", "fn", ")", ":", "memoized_values", "=", "{", "}", "@", "wraps", "(", "fn", ")", "def", "wrapped_fn", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "key", "=", "(", "args", ",", "tuple", "(", "sorted", "(", "kwargs", ...
Simple memoization decorator for functions and methods, assumes that all arguments to the function can be hashed and compared.
[ "Simple", "memoization", "decorator", "for", "functions", "and", "methods", "assumes", "that", "all", "arguments", "to", "the", "function", "can", "be", "hashed", "and", "compared", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/common.py#L60-L77
openvax/varcode
varcode/effects/transcript_helpers.py
interval_offset_on_transcript
def interval_offset_on_transcript(start, end, transcript): """ Given an interval [start:end] and a particular transcript, return the start offset of the interval relative to the chromosomal positions of the transcript. """ # ensure that start_pos:end_pos overlap with transcript positions if ...
python
def interval_offset_on_transcript(start, end, transcript): """ Given an interval [start:end] and a particular transcript, return the start offset of the interval relative to the chromosomal positions of the transcript. """ # ensure that start_pos:end_pos overlap with transcript positions if ...
[ "def", "interval_offset_on_transcript", "(", "start", ",", "end", ",", "transcript", ")", ":", "# ensure that start_pos:end_pos overlap with transcript positions", "if", "start", ">", "end", ":", "raise", "ValueError", "(", "\"start_pos %d shouldn't be greater than end_pos %d\"...
Given an interval [start:end] and a particular transcript, return the start offset of the interval relative to the chromosomal positions of the transcript.
[ "Given", "an", "interval", "[", "start", ":", "end", "]", "and", "a", "particular", "transcript", "return", "the", "start", "offset", "of", "the", "interval", "relative", "to", "the", "chromosomal", "positions", "of", "the", "transcript", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/transcript_helpers.py#L18-L54
openvax/varcode
varcode/vcf_output.py
variants_to_vcf
def variants_to_vcf(variants, variant_to_metadata, out=sys.stdout): """Output a VCF file from a list of Variant records. Parameters ---------- variants : iterable Variant objects variant_to_metadata : dict Dictionary mapping each variant in `variants` to a dictionary of met...
python
def variants_to_vcf(variants, variant_to_metadata, out=sys.stdout): """Output a VCF file from a list of Variant records. Parameters ---------- variants : iterable Variant objects variant_to_metadata : dict Dictionary mapping each variant in `variants` to a dictionary of met...
[ "def", "variants_to_vcf", "(", "variants", ",", "variant_to_metadata", ",", "out", "=", "sys", ".", "stdout", ")", ":", "# TODO: The variant metadata dictionary (in the `VariantCollection`)", "# contains different data depending on the original input file format (VCF,", "# MAF, CSV)....
Output a VCF file from a list of Variant records. Parameters ---------- variants : iterable Variant objects variant_to_metadata : dict Dictionary mapping each variant in `variants` to a dictionary of metadata.
[ "Output", "a", "VCF", "file", "from", "a", "list", "of", "Variant", "records", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/vcf_output.py#L21-L268
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.filter_by_transcript_expression
def filter_by_transcript_expression( self, transcript_expression_dict, min_expression_value=0.0): """ Filters effects to those which have an associated transcript whose expression value in the transcript_expression_dict argument is greater than min_exp...
python
def filter_by_transcript_expression( self, transcript_expression_dict, min_expression_value=0.0): """ Filters effects to those which have an associated transcript whose expression value in the transcript_expression_dict argument is greater than min_exp...
[ "def", "filter_by_transcript_expression", "(", "self", ",", "transcript_expression_dict", ",", "min_expression_value", "=", "0.0", ")", ":", "return", "self", ".", "filter_above_threshold", "(", "key_fn", "=", "lambda", "effect", ":", "effect", ".", "transcript_id", ...
Filters effects to those which have an associated transcript whose expression value in the transcript_expression_dict argument is greater than min_expression_value. Parameters ---------- transcript_expression_dict : dict Dictionary mapping Ensembl transcript IDs to e...
[ "Filters", "effects", "to", "those", "which", "have", "an", "associated", "transcript", "whose", "expression", "value", "in", "the", "transcript_expression_dict", "argument", "is", "greater", "than", "min_expression_value", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L105-L126
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.filter_by_gene_expression
def filter_by_gene_expression( self, gene_expression_dict, min_expression_value=0.0): """ Filters effects to those which have an associated gene whose expression value in the gene_expression_dict argument is greater than min_expression_value. ...
python
def filter_by_gene_expression( self, gene_expression_dict, min_expression_value=0.0): """ Filters effects to those which have an associated gene whose expression value in the gene_expression_dict argument is greater than min_expression_value. ...
[ "def", "filter_by_gene_expression", "(", "self", ",", "gene_expression_dict", ",", "min_expression_value", "=", "0.0", ")", ":", "return", "self", ".", "filter_above_threshold", "(", "key_fn", "=", "lambda", "effect", ":", "effect", ".", "gene_id", ",", "value_dic...
Filters effects to those which have an associated gene whose expression value in the gene_expression_dict argument is greater than min_expression_value. Parameters ---------- gene_expression_dict : dict Dictionary mapping Ensembl gene IDs to expression estimates ...
[ "Filters", "effects", "to", "those", "which", "have", "an", "associated", "gene", "whose", "expression", "value", "in", "the", "gene_expression_dict", "argument", "is", "greater", "than", "min_expression_value", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L128-L149
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.filter_by_effect_priority
def filter_by_effect_priority(self, min_priority_class): """ Create a new EffectCollection containing only effects whose priority falls below the given class. """ min_priority = transcript_effect_priority_dict[min_priority_class] return self.filter( lambda eff...
python
def filter_by_effect_priority(self, min_priority_class): """ Create a new EffectCollection containing only effects whose priority falls below the given class. """ min_priority = transcript_effect_priority_dict[min_priority_class] return self.filter( lambda eff...
[ "def", "filter_by_effect_priority", "(", "self", ",", "min_priority_class", ")", ":", "min_priority", "=", "transcript_effect_priority_dict", "[", "min_priority_class", "]", "return", "self", ".", "filter", "(", "lambda", "effect", ":", "effect_priority", "(", "effect...
Create a new EffectCollection containing only effects whose priority falls below the given class.
[ "Create", "a", "new", "EffectCollection", "containing", "only", "effects", "whose", "priority", "falls", "below", "the", "given", "class", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L151-L158
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.detailed_string
def detailed_string(self): """ Create a long string with all transcript effects for each mutation, grouped by gene (if a mutation affects multiple genes). """ lines = [] # TODO: annoying to always write `groupby_result.items()`, # consider makings a GroupBy class ...
python
def detailed_string(self): """ Create a long string with all transcript effects for each mutation, grouped by gene (if a mutation affects multiple genes). """ lines = [] # TODO: annoying to always write `groupby_result.items()`, # consider makings a GroupBy class ...
[ "def", "detailed_string", "(", "self", ")", ":", "lines", "=", "[", "]", "# TODO: annoying to always write `groupby_result.items()`,", "# consider makings a GroupBy class which iterates over pairs", "# and also common helper methods like `map_values`.", "for", "variant", ",", "varian...
Create a long string with all transcript effects for each mutation, grouped by gene (if a mutation affects multiple genes).
[ "Create", "a", "long", "string", "with", "all", "transcript", "effects", "for", "each", "mutation", "grouped", "by", "gene", "(", "if", "a", "mutation", "affects", "multiple", "genes", ")", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L166-L196
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.top_priority_effect_per_variant
def top_priority_effect_per_variant(self): """Highest priority effect for each unique variant""" return OrderedDict( (variant, top_priority_effect(variant_effects)) for (variant, variant_effects) in self.groupby_variant().items())
python
def top_priority_effect_per_variant(self): """Highest priority effect for each unique variant""" return OrderedDict( (variant, top_priority_effect(variant_effects)) for (variant, variant_effects) in self.groupby_variant().items())
[ "def", "top_priority_effect_per_variant", "(", "self", ")", ":", "return", "OrderedDict", "(", "(", "variant", ",", "top_priority_effect", "(", "variant_effects", ")", ")", "for", "(", "variant", ",", "variant_effects", ")", "in", "self", ".", "groupby_variant", ...
Highest priority effect for each unique variant
[ "Highest", "priority", "effect", "for", "each", "unique", "variant" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L211-L216
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.top_priority_effect_per_transcript_id
def top_priority_effect_per_transcript_id(self): """Highest priority effect for each unique transcript ID""" return OrderedDict( (transcript_id, top_priority_effect(variant_effects)) for (transcript_id, variant_effects) in self.groupby_transcript_id().items())
python
def top_priority_effect_per_transcript_id(self): """Highest priority effect for each unique transcript ID""" return OrderedDict( (transcript_id, top_priority_effect(variant_effects)) for (transcript_id, variant_effects) in self.groupby_transcript_id().items())
[ "def", "top_priority_effect_per_transcript_id", "(", "self", ")", ":", "return", "OrderedDict", "(", "(", "transcript_id", ",", "top_priority_effect", "(", "variant_effects", ")", ")", "for", "(", "transcript_id", ",", "variant_effects", ")", "in", "self", ".", "g...
Highest priority effect for each unique transcript ID
[ "Highest", "priority", "effect", "for", "each", "unique", "transcript", "ID" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L218-L223
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.top_priority_effect_per_gene_id
def top_priority_effect_per_gene_id(self): """Highest priority effect for each unique gene ID""" return OrderedDict( (gene_id, top_priority_effect(variant_effects)) for (gene_id, variant_effects) in self.groupby_gene_id().items())
python
def top_priority_effect_per_gene_id(self): """Highest priority effect for each unique gene ID""" return OrderedDict( (gene_id, top_priority_effect(variant_effects)) for (gene_id, variant_effects) in self.groupby_gene_id().items())
[ "def", "top_priority_effect_per_gene_id", "(", "self", ")", ":", "return", "OrderedDict", "(", "(", "gene_id", ",", "top_priority_effect", "(", "variant_effects", ")", ")", "for", "(", "gene_id", ",", "variant_effects", ")", "in", "self", ".", "groupby_gene_id", ...
Highest priority effect for each unique gene ID
[ "Highest", "priority", "effect", "for", "each", "unique", "gene", "ID" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L225-L230
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.effect_expression
def effect_expression(self, expression_levels): """ Parameters ---------- expression_levels : dict Dictionary mapping transcript IDs to length-normalized expression levels (either FPKM or TPM) Returns dictionary mapping each transcript effect to an expres...
python
def effect_expression(self, expression_levels): """ Parameters ---------- expression_levels : dict Dictionary mapping transcript IDs to length-normalized expression levels (either FPKM or TPM) Returns dictionary mapping each transcript effect to an expres...
[ "def", "effect_expression", "(", "self", ",", "expression_levels", ")", ":", "return", "OrderedDict", "(", "(", "effect", ",", "expression_levels", ".", "get", "(", "effect", ".", "transcript", ".", "id", ",", "0.0", ")", ")", "for", "effect", "in", "self"...
Parameters ---------- expression_levels : dict Dictionary mapping transcript IDs to length-normalized expression levels (either FPKM or TPM) Returns dictionary mapping each transcript effect to an expression quantity. Effects that don't have an associated transcr...
[ "Parameters", "----------", "expression_levels", ":", "dict", "Dictionary", "mapping", "transcript", "IDs", "to", "length", "-", "normalized", "expression", "levels", "(", "either", "FPKM", "or", "TPM", ")" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L232-L247
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.top_expression_effect
def top_expression_effect(self, expression_levels): """ Return effect whose transcript has the highest expression level. If none of the effects are expressed or have associated transcripts, then return None. In case of ties, add lexicographical sorting by effect priority and tran...
python
def top_expression_effect(self, expression_levels): """ Return effect whose transcript has the highest expression level. If none of the effects are expressed or have associated transcripts, then return None. In case of ties, add lexicographical sorting by effect priority and tran...
[ "def", "top_expression_effect", "(", "self", ",", "expression_levels", ")", ":", "effect_expression_dict", "=", "self", ".", "effect_expression", "(", "expression_levels", ")", "if", "len", "(", "effect_expression_dict", ")", "==", "0", ":", "return", "None", "def...
Return effect whose transcript has the highest expression level. If none of the effects are expressed or have associated transcripts, then return None. In case of ties, add lexicographical sorting by effect priority and transcript length.
[ "Return", "effect", "whose", "transcript", "has", "the", "highest", "expression", "level", ".", "If", "none", "of", "the", "effects", "are", "expressed", "or", "have", "associated", "transcripts", "then", "return", "None", ".", "In", "case", "of", "ties", "a...
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L249-L270
openvax/varcode
varcode/effects/effect_collection.py
EffectCollection.to_dataframe
def to_dataframe(self): """Build a dataframe from the effect collection""" # list of properties to extract from Variant objects if they're # not None variant_properties = [ "contig", "start", "ref", "alt", "is_snv", ...
python
def to_dataframe(self): """Build a dataframe from the effect collection""" # list of properties to extract from Variant objects if they're # not None variant_properties = [ "contig", "start", "ref", "alt", "is_snv", ...
[ "def", "to_dataframe", "(", "self", ")", ":", "# list of properties to extract from Variant objects if they're", "# not None", "variant_properties", "=", "[", "\"contig\"", ",", "\"start\"", ",", "\"ref\"", ",", "\"alt\"", ",", "\"is_snv\"", ",", "\"is_transversion\"", ",...
Build a dataframe from the effect collection
[ "Build", "a", "dataframe", "from", "the", "effect", "collection" ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_collection.py#L272-L301
openvax/varcode
varcode/util.py
random_variants
def random_variants( count, genome_name="GRCh38", deletions=True, insertions=True, random_seed=None): """ Generate a VariantCollection with random variants that overlap at least one complete coding transcript. """ rng = random.Random(random_seed) ensembl =...
python
def random_variants( count, genome_name="GRCh38", deletions=True, insertions=True, random_seed=None): """ Generate a VariantCollection with random variants that overlap at least one complete coding transcript. """ rng = random.Random(random_seed) ensembl =...
[ "def", "random_variants", "(", "count", ",", "genome_name", "=", "\"GRCh38\"", ",", "deletions", "=", "True", ",", "insertions", "=", "True", ",", "random_seed", "=", "None", ")", ":", "rng", "=", "random", ".", "Random", "(", "random_seed", ")", "ensembl"...
Generate a VariantCollection with random variants that overlap at least one complete coding transcript.
[ "Generate", "a", "VariantCollection", "with", "random", "variants", "that", "overlap", "at", "least", "one", "complete", "coding", "transcript", "." ]
train
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/util.py#L29-L92
skelsec/msldap
msldap/core/msldap.py
MSLDAP.get_server_info
def get_server_info(self, anonymous = True): """ Performs bind on the server and grabs the DSA info object. If anonymous is set to true, then it will perform anonymous bind, not using user credentials Otherwise it will use the credentials set in the object constructor. """ if anonymous == True: logger.de...
python
def get_server_info(self, anonymous = True): """ Performs bind on the server and grabs the DSA info object. If anonymous is set to true, then it will perform anonymous bind, not using user credentials Otherwise it will use the credentials set in the object constructor. """ if anonymous == True: logger.de...
[ "def", "get_server_info", "(", "self", ",", "anonymous", "=", "True", ")", ":", "if", "anonymous", "==", "True", ":", "logger", ".", "debug", "(", "'Getting server info via Anonymous BIND on server %s'", "%", "self", ".", "target_server", ".", "get_host", "(", "...
Performs bind on the server and grabs the DSA info object. If anonymous is set to true, then it will perform anonymous bind, not using user credentials Otherwise it will use the credentials set in the object constructor.
[ "Performs", "bind", "on", "the", "server", "and", "grabs", "the", "DSA", "info", "object", ".", "If", "anonymous", "is", "set", "to", "true", "then", "it", "will", "perform", "anonymous", "bind", "not", "using", "user", "credentials", "Otherwise", "it", "w...
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L94-L118
skelsec/msldap
msldap/core/msldap.py
MSLDAP.pagedsearch
def pagedsearch(self, ldap_filter, attributes): """ Performs a paged search on the AD, using the filter and attributes as a normal query does. Needs to connect to the server first! ldap_filter: str : LDAP query filter attributes: list : Attributes list to recieve in the result """ logger.debug('Paged sear...
python
def pagedsearch(self, ldap_filter, attributes): """ Performs a paged search on the AD, using the filter and attributes as a normal query does. Needs to connect to the server first! ldap_filter: str : LDAP query filter attributes: list : Attributes list to recieve in the result """ logger.debug('Paged sear...
[ "def", "pagedsearch", "(", "self", ",", "ldap_filter", ",", "attributes", ")", ":", "logger", ".", "debug", "(", "'Paged search, filter: %s attributes: %s'", "%", "(", "ldap_filter", ",", "','", ".", "join", "(", "attributes", ")", ")", ")", "ctr", "=", "0",...
Performs a paged search on the AD, using the filter and attributes as a normal query does. Needs to connect to the server first! ldap_filter: str : LDAP query filter attributes: list : Attributes list to recieve in the result
[ "Performs", "a", "paged", "search", "on", "the", "AD", "using", "the", "filter", "and", "attributes", "as", "a", "normal", "query", "does", ".", "Needs", "to", "connect", "to", "the", "server", "first!", "ldap_filter", ":", "str", ":", "LDAP", "query", "...
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L151-L167
skelsec/msldap
msldap/core/msldap.py
MSLDAP.get_all_user_objects
def get_all_user_objects(self): """ Fetches all user objects from the AD, and returns MSADUser object """ logger.debug('Polling AD for all user objects') ldap_filter = r'(objectClass=user)' attributes = MSADUser.ATTRS for entry in self.pagedsearch(ldap_filter, attributes): # TODO: return ldapuser obje...
python
def get_all_user_objects(self): """ Fetches all user objects from the AD, and returns MSADUser object """ logger.debug('Polling AD for all user objects') ldap_filter = r'(objectClass=user)' attributes = MSADUser.ATTRS for entry in self.pagedsearch(ldap_filter, attributes): # TODO: return ldapuser obje...
[ "def", "get_all_user_objects", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Polling AD for all user objects'", ")", "ldap_filter", "=", "r'(objectClass=user)'", "attributes", "=", "MSADUser", ".", "ATTRS", "for", "entry", "in", "self", ".", "pagedsearch", ...
Fetches all user objects from the AD, and returns MSADUser object
[ "Fetches", "all", "user", "objects", "from", "the", "AD", "and", "returns", "MSADUser", "object" ]
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L171-L182
skelsec/msldap
msldap/core/msldap.py
MSLDAP.get_user
def get_user(self, sAMAccountName): """ Fetches one user object from the AD, based on the sAMAccountName attribute (read: username) """ logger.debug('Polling AD for user %s'% sAMAccountName) ldap_filter = r'(&(objectClass=user)(sAMAccountName=%s)' % sAMAccountName attributes = MSADUser.ATTRS for entry in...
python
def get_user(self, sAMAccountName): """ Fetches one user object from the AD, based on the sAMAccountName attribute (read: username) """ logger.debug('Polling AD for user %s'% sAMAccountName) ldap_filter = r'(&(objectClass=user)(sAMAccountName=%s)' % sAMAccountName attributes = MSADUser.ATTRS for entry in...
[ "def", "get_user", "(", "self", ",", "sAMAccountName", ")", ":", "logger", ".", "debug", "(", "'Polling AD for user %s'", "%", "sAMAccountName", ")", "ldap_filter", "=", "r'(&(objectClass=user)(sAMAccountName=%s)'", "%", "sAMAccountName", "attributes", "=", "MSADUser", ...
Fetches one user object from the AD, based on the sAMAccountName attribute (read: username)
[ "Fetches", "one", "user", "object", "from", "the", "AD", "based", "on", "the", "sAMAccountName", "attribute", "(", "read", ":", "username", ")" ]
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L184-L194
skelsec/msldap
msldap/core/msldap.py
MSLDAP.get_ad_info
def get_ad_info(self): """ Polls for basic AD information (needed for determine password usage characteristics!) """ logger.debug('Polling AD for basic info') ldap_filter = r'(distinguishedName=%s)' % self._tree attributes = MSADInfo.ATTRS for entry in self.pagedsearch(ldap_filter, attributes): self._l...
python
def get_ad_info(self): """ Polls for basic AD information (needed for determine password usage characteristics!) """ logger.debug('Polling AD for basic info') ldap_filter = r'(distinguishedName=%s)' % self._tree attributes = MSADInfo.ATTRS for entry in self.pagedsearch(ldap_filter, attributes): self._l...
[ "def", "get_ad_info", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Polling AD for basic info'", ")", "ldap_filter", "=", "r'(distinguishedName=%s)'", "%", "self", ".", "_tree", "attributes", "=", "MSADInfo", ".", "ATTRS", "for", "entry", "in", "self", ...
Polls for basic AD information (needed for determine password usage characteristics!)
[ "Polls", "for", "basic", "AD", "information", "(", "needed", "for", "determine", "password", "usage", "characteristics!", ")" ]
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L196-L207
skelsec/msldap
msldap/core/msldap.py
MSLDAP.get_all_service_user_objects
def get_all_service_user_objects(self, include_machine = False): """ Fetches all service user objects from the AD, and returns MSADUser object. Service user refers to an user whith SPN (servicePrincipalName) attribute set """ logger.debug('Polling AD for all user objects, machine accounts included: %s'% inclu...
python
def get_all_service_user_objects(self, include_machine = False): """ Fetches all service user objects from the AD, and returns MSADUser object. Service user refers to an user whith SPN (servicePrincipalName) attribute set """ logger.debug('Polling AD for all user objects, machine accounts included: %s'% inclu...
[ "def", "get_all_service_user_objects", "(", "self", ",", "include_machine", "=", "False", ")", ":", "logger", ".", "debug", "(", "'Polling AD for all user objects, machine accounts included: %s'", "%", "include_machine", ")", "if", "include_machine", "==", "True", ":", ...
Fetches all service user objects from the AD, and returns MSADUser object. Service user refers to an user whith SPN (servicePrincipalName) attribute set
[ "Fetches", "all", "service", "user", "objects", "from", "the", "AD", "and", "returns", "MSADUser", "object", ".", "Service", "user", "refers", "to", "an", "user", "whith", "SPN", "(", "servicePrincipalName", ")", "attribute", "set" ]
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L209-L224
skelsec/msldap
msldap/core/msldap.py
MSLDAP.get_all_knoreq_user_objects
def get_all_knoreq_user_objects(self, include_machine = False): """ Fetches all user objects with useraccountcontrol DONT_REQ_PREAUTH flag set from the AD, and returns MSADUser object. """ logger.debug('Polling AD for all user objects, machine accounts included: %s'% include_machine) if include_machine == ...
python
def get_all_knoreq_user_objects(self, include_machine = False): """ Fetches all user objects with useraccountcontrol DONT_REQ_PREAUTH flag set from the AD, and returns MSADUser object. """ logger.debug('Polling AD for all user objects, machine accounts included: %s'% include_machine) if include_machine == ...
[ "def", "get_all_knoreq_user_objects", "(", "self", ",", "include_machine", "=", "False", ")", ":", "logger", ".", "debug", "(", "'Polling AD for all user objects, machine accounts included: %s'", "%", "include_machine", ")", "if", "include_machine", "==", "True", ":", "...
Fetches all user objects with useraccountcontrol DONT_REQ_PREAUTH flag set from the AD, and returns MSADUser object.
[ "Fetches", "all", "user", "objects", "with", "useraccountcontrol", "DONT_REQ_PREAUTH", "flag", "set", "from", "the", "AD", "and", "returns", "MSADUser", "object", "." ]
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/core/msldap.py#L226-L241
skelsec/msldap
msldap/ldap_objects/common.py
vn
def vn(x): """ value or none, returns none if x is an empty list """ if x == []: return None if isinstance(x, list): return '|'.join(x) if isinstance(x, datetime): return x.isoformat() return x
python
def vn(x): """ value or none, returns none if x is an empty list """ if x == []: return None if isinstance(x, list): return '|'.join(x) if isinstance(x, datetime): return x.isoformat() return x
[ "def", "vn", "(", "x", ")", ":", "if", "x", "==", "[", "]", ":", "return", "None", "if", "isinstance", "(", "x", ",", "list", ")", ":", "return", "'|'", ".", "join", "(", "x", ")", "if", "isinstance", "(", "x", ",", "datetime", ")", ":", "ret...
value or none, returns none if x is an empty list
[ "value", "or", "none", "returns", "none", "if", "x", "is", "an", "empty", "list" ]
train
https://github.com/skelsec/msldap/blob/bb873728afda9ca105d57d2740a28e319a78aa71/msldap/ldap_objects/common.py#L10-L20
lebinh/aq
aq/engines.py
convert_tags_to_dict
def convert_tags_to_dict(item): """ Convert AWS inconvenient tags model of a list of {"Key": <key>, "Value": <value>} pairs to a dict of {<key>: <value>} for easier querying. This returns a proxied object over given item to return a different tags format as the tags attribute is read-only and we ca...
python
def convert_tags_to_dict(item): """ Convert AWS inconvenient tags model of a list of {"Key": <key>, "Value": <value>} pairs to a dict of {<key>: <value>} for easier querying. This returns a proxied object over given item to return a different tags format as the tags attribute is read-only and we ca...
[ "def", "convert_tags_to_dict", "(", "item", ")", ":", "if", "hasattr", "(", "item", ",", "'tags'", ")", ":", "tags", "=", "item", ".", "tags", "if", "isinstance", "(", "tags", ",", "list", ")", ":", "tags_dict", "=", "{", "}", "for", "kv_dict", "in",...
Convert AWS inconvenient tags model of a list of {"Key": <key>, "Value": <value>} pairs to a dict of {<key>: <value>} for easier querying. This returns a proxied object over given item to return a different tags format as the tags attribute is read-only and we cannot modify it directly.
[ "Convert", "AWS", "inconvenient", "tags", "model", "of", "a", "list", "of", "{", "Key", ":", "<key", ">", "Value", ":", "<value", ">", "}", "pairs", "to", "a", "dict", "of", "{", "<key", ">", ":", "<value", ">", "}", "for", "easier", "querying", "....
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/engines.py#L151-L167
lebinh/aq
aq/engines.py
BotoSqliteEngine.load_tables
def load_tables(self, query, meta): """ Load necessary resources tables into db to execute given query. """ try: for table in meta.tables: self.load_table(table) except NoCredentialsError: help_link = 'http://boto3.readthedocs.io/en/latest/...
python
def load_tables(self, query, meta): """ Load necessary resources tables into db to execute given query. """ try: for table in meta.tables: self.load_table(table) except NoCredentialsError: help_link = 'http://boto3.readthedocs.io/en/latest/...
[ "def", "load_tables", "(", "self", ",", "query", ",", "meta", ")", ":", "try", ":", "for", "table", "in", "meta", ".", "tables", ":", "self", ".", "load_table", "(", "table", ")", "except", "NoCredentialsError", ":", "help_link", "=", "'http://boto3.readth...
Load necessary resources tables into db to execute given query.
[ "Load", "necessary", "resources", "tables", "into", "db", "to", "execute", "given", "query", "." ]
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/engines.py#L63-L73
lebinh/aq
aq/engines.py
BotoSqliteEngine.load_table
def load_table(self, table): """ Load resources as specified by given table into our db. """ region = table.database if table.database else self.default_region resource_name, collection_name = table.table.split('_', 1) # we use underscore "_" instead of dash "-" for regio...
python
def load_table(self, table): """ Load resources as specified by given table into our db. """ region = table.database if table.database else self.default_region resource_name, collection_name = table.table.split('_', 1) # we use underscore "_" instead of dash "-" for regio...
[ "def", "load_table", "(", "self", ",", "table", ")", ":", "region", "=", "table", ".", "database", "if", "table", ".", "database", "else", "self", ".", "default_region", "resource_name", ",", "collection_name", "=", "table", ".", "table", ".", "split", "("...
Load resources as specified by given table into our db.
[ "Load", "resources", "as", "specified", "by", "given", "table", "into", "our", "db", "." ]
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/engines.py#L75-L89
lebinh/aq
aq/sqlite_util.py
json_serialize
def json_serialize(obj): """ Simple generic JSON serializer for common objects. """ if isinstance(obj, datetime): return obj.isoformat() if hasattr(obj, 'id'): return jsonify(obj.id) if hasattr(obj, 'name'): return jsonify(obj.name) raise TypeError('{0} is not JSON...
python
def json_serialize(obj): """ Simple generic JSON serializer for common objects. """ if isinstance(obj, datetime): return obj.isoformat() if hasattr(obj, 'id'): return jsonify(obj.id) if hasattr(obj, 'name'): return jsonify(obj.name) raise TypeError('{0} is not JSON...
[ "def", "json_serialize", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "datetime", ")", ":", "return", "obj", ".", "isoformat", "(", ")", "if", "hasattr", "(", "obj", ",", "'id'", ")", ":", "return", "jsonify", "(", "obj", ".", "id", "...
Simple generic JSON serializer for common objects.
[ "Simple", "generic", "JSON", "serializer", "for", "common", "objects", "." ]
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/sqlite_util.py#L20-L33
lebinh/aq
aq/sqlite_util.py
json_get
def json_get(serialized_object, field): """ This emulates the HSTORE `->` get value operation. It get value from JSON serialized column by given key and return `null` if not present. Key can be either an integer for array index access or a string for object field access. :return: JSON serialized va...
python
def json_get(serialized_object, field): """ This emulates the HSTORE `->` get value operation. It get value from JSON serialized column by given key and return `null` if not present. Key can be either an integer for array index access or a string for object field access. :return: JSON serialized va...
[ "def", "json_get", "(", "serialized_object", ",", "field", ")", ":", "# return null if serialized_object is null or \"serialized null\"", "if", "serialized_object", "is", "None", ":", "return", "None", "obj", "=", "json", ".", "loads", "(", "serialized_object", ")", "...
This emulates the HSTORE `->` get value operation. It get value from JSON serialized column by given key and return `null` if not present. Key can be either an integer for array index access or a string for object field access. :return: JSON serialized value of key in object
[ "This", "emulates", "the", "HSTORE", "-", ">", "get", "value", "operation", ".", "It", "get", "value", "from", "JSON", "serialized", "column", "by", "given", "key", "and", "return", "null", "if", "not", "present", ".", "Key", "can", "be", "either", "an",...
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/sqlite_util.py#L36-L61
lebinh/aq
aq/sqlite_util.py
create_table
def create_table(db, schema_name, table_name, columns): """ Create a table, schema_name.table_name, in given database with given list of column names. """ table = '{0}.{1}'.format(schema_name, table_name) if schema_name else table_name db.execute('DROP TABLE IF EXISTS {0}'.format(table)) columns...
python
def create_table(db, schema_name, table_name, columns): """ Create a table, schema_name.table_name, in given database with given list of column names. """ table = '{0}.{1}'.format(schema_name, table_name) if schema_name else table_name db.execute('DROP TABLE IF EXISTS {0}'.format(table)) columns...
[ "def", "create_table", "(", "db", ",", "schema_name", ",", "table_name", ",", "columns", ")", ":", "table", "=", "'{0}.{1}'", ".", "format", "(", "schema_name", ",", "table_name", ")", "if", "schema_name", "else", "table_name", "db", ".", "execute", "(", "...
Create a table, schema_name.table_name, in given database with given list of column names.
[ "Create", "a", "table", "schema_name", ".", "table_name", "in", "given", "database", "with", "given", "list", "of", "column", "names", "." ]
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/sqlite_util.py#L64-L71
lebinh/aq
aq/sqlite_util.py
insert_all
def insert_all(db, schema_name, table_name, columns, items): """ Insert all item in given items list into the specified table, schema_name.table_name. """ table = '{0}.{1}'.format(schema_name, table_name) if schema_name else table_name columns_list = ', '.join(columns) values_list = ', '.join(['...
python
def insert_all(db, schema_name, table_name, columns, items): """ Insert all item in given items list into the specified table, schema_name.table_name. """ table = '{0}.{1}'.format(schema_name, table_name) if schema_name else table_name columns_list = ', '.join(columns) values_list = ', '.join(['...
[ "def", "insert_all", "(", "db", ",", "schema_name", ",", "table_name", ",", "columns", ",", "items", ")", ":", "table", "=", "'{0}.{1}'", ".", "format", "(", "schema_name", ",", "table_name", ")", "if", "schema_name", "else", "table_name", "columns_list", "=...
Insert all item in given items list into the specified table, schema_name.table_name.
[ "Insert", "all", "item", "in", "given", "items", "list", "into", "the", "specified", "table", "schema_name", ".", "table_name", "." ]
train
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/sqlite_util.py#L74-L85
gpennington/PyMarvel
marvel/creator.py
Creator.get_comics
def get_comics(self, *args, **kwargs): """ Returns a full ComicDataWrapper object for this creator. /creators/{creatorId}/comics :returns: ComicDataWrapper -- A new request to API. Contains full results set. """ from .comic import Comic, ComicDataWrappe...
python
def get_comics(self, *args, **kwargs): """ Returns a full ComicDataWrapper object for this creator. /creators/{creatorId}/comics :returns: ComicDataWrapper -- A new request to API. Contains full results set. """ from .comic import Comic, ComicDataWrappe...
[ "def", "get_comics", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "comic", "import", "Comic", ",", "ComicDataWrapper", "return", "self", ".", "get_related_resource", "(", "Comic", ",", "ComicDataWrapper", ",", "args", ",",...
Returns a full ComicDataWrapper object for this creator. /creators/{creatorId}/comics :returns: ComicDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "ComicDataWrapper", "object", "for", "this", "creator", ".", "/", "creators", "/", "{", "creatorId", "}", "/", "comics", ":", "returns", ":", "ComicDataWrapper", "--", "A", "new", "request", "to", "API", ".", "Contains", "full", "re...
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/creator.py#L140-L149
gpennington/PyMarvel
marvel/creator.py
Creator.get_events
def get_events(self, *args, **kwargs): """ Returns a full EventDataWrapper object for this creator. /creators/{creatorId}/events :returns: EventDataWrapper -- A new request to API. Contains full results set. """ from .event import Event, EventDataWrapper return...
python
def get_events(self, *args, **kwargs): """ Returns a full EventDataWrapper object for this creator. /creators/{creatorId}/events :returns: EventDataWrapper -- A new request to API. Contains full results set. """ from .event import Event, EventDataWrapper return...
[ "def", "get_events", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "event", "import", "Event", ",", "EventDataWrapper", "return", "self", ".", "get_related_resource", "(", "Event", ",", "EventDataWrapper", ",", "args", ",",...
Returns a full EventDataWrapper object for this creator. /creators/{creatorId}/events :returns: EventDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "EventDataWrapper", "object", "for", "this", "creator", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/creator.py#L151-L160
gpennington/PyMarvel
marvel/creator.py
Creator.get_series
def get_series(self, *args, **kwargs): """ Returns a full SeriesDataWrapper object for this creator. /creators/{creatorId}/series :returns: SeriesDataWrapper -- A new request to API. Contains full results set. """ from .series import Series, SeriesDataWrapper r...
python
def get_series(self, *args, **kwargs): """ Returns a full SeriesDataWrapper object for this creator. /creators/{creatorId}/series :returns: SeriesDataWrapper -- A new request to API. Contains full results set. """ from .series import Series, SeriesDataWrapper r...
[ "def", "get_series", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "series", "import", "Series", ",", "SeriesDataWrapper", "return", "self", ".", "get_related_resource", "(", "Series", ",", "SeriesDataWrapper", ",", "args", ...
Returns a full SeriesDataWrapper object for this creator. /creators/{creatorId}/series :returns: SeriesDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "SeriesDataWrapper", "object", "for", "this", "creator", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/creator.py#L162-L171
gpennington/PyMarvel
marvel/creator.py
Creator.get_stories
def get_stories(self, *args, **kwargs): """ Returns a full StoryDataWrapper object for this creator. /creators/{creatorId}/stories :returns: StoriesDataWrapper -- A new request to API. Contains full results set. """ from .story import Story, StoryDataWrapper re...
python
def get_stories(self, *args, **kwargs): """ Returns a full StoryDataWrapper object for this creator. /creators/{creatorId}/stories :returns: StoriesDataWrapper -- A new request to API. Contains full results set. """ from .story import Story, StoryDataWrapper re...
[ "def", "get_stories", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "story", "import", "Story", ",", "StoryDataWrapper", "return", "self", ".", "get_related_resource", "(", "Story", ",", "StoryDataWrapper", ",", "args", ","...
Returns a full StoryDataWrapper object for this creator. /creators/{creatorId}/stories :returns: StoriesDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "StoryDataWrapper", "object", "for", "this", "creator", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/creator.py#L173-L182
gpennington/PyMarvel
marvel/core.py
MarvelObject.list_to_instance_list
def list_to_instance_list(_self, _list, _Class): """ Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param. :param _self: Original resource calling the method :type _self: core.MarvelObject :param _list: List of dicts descri...
python
def list_to_instance_list(_self, _list, _Class): """ Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param. :param _self: Original resource calling the method :type _self: core.MarvelObject :param _list: List of dicts descri...
[ "def", "list_to_instance_list", "(", "_self", ",", "_list", ",", "_Class", ")", ":", "items", "=", "[", "]", "for", "item", "in", "_list", ":", "items", ".", "append", "(", "_Class", "(", "_self", ".", "marvel", ",", "item", ")", ")", "return", "item...
Takes a list of resource dicts and returns a list of resource instances, defined by the _Class param. :param _self: Original resource calling the method :type _self: core.MarvelObject :param _list: List of dicts describing a Resource. :type _list: list :param _Class: The...
[ "Takes", "a", "list", "of", "resource", "dicts", "and", "returns", "a", "list", "of", "resource", "instances", "defined", "by", "the", "_Class", "param", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/core.py#L39-L56
gpennington/PyMarvel
marvel/core.py
MarvelObject.get_related_resource
def get_related_resource(_self, _Class, _ClassDataWrapper, *args, **kwargs): """ Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{charac...
python
def get_related_resource(_self, _Class, _ClassDataWrapper, *args, **kwargs): """ Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{charac...
[ "def", "get_related_resource", "(", "_self", ",", "_Class", ",", "_ClassDataWrapper", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "url", "=", "\"%s/%s/%s\"", "%", "(", "_self", ".", "resource_url", "(", ")", ",", "_self", ".", "id", ",", "_Cla...
Takes a related resource Class and returns the related resource DataWrapper. For Example: Given a Character instance, return a ComicsDataWrapper related to that character. /character/{characterId}/comics :param _Class: The Resource class retrieve :type _Class: core.Marv...
[ "Takes", "a", "related", "resource", "Class", "and", "returns", "the", "related", "resource", "DataWrapper", ".", "For", "Example", ":", "Given", "a", "Character", "instance", "return", "a", "ComicsDataWrapper", "related", "to", "that", "character", ".", "/", ...
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/core.py#L58-L77
gpennington/PyMarvel
marvel/character.py
CharacterDataWrapper.next
def next(self): """ Returns new CharacterDataWrapper TODO: Don't raise offset past count - limit """ self.params['offset'] = str(int(self.params['offset']) + int(self.params['limit'])) return self.marvel.get_characters(self.marvel, (), **self.params)
python
def next(self): """ Returns new CharacterDataWrapper TODO: Don't raise offset past count - limit """ self.params['offset'] = str(int(self.params['offset']) + int(self.params['limit'])) return self.marvel.get_characters(self.marvel, (), **self.params)
[ "def", "next", "(", "self", ")", ":", "self", ".", "params", "[", "'offset'", "]", "=", "str", "(", "int", "(", "self", ".", "params", "[", "'offset'", "]", ")", "+", "int", "(", "self", ".", "params", "[", "'limit'", "]", ")", ")", "return", "...
Returns new CharacterDataWrapper TODO: Don't raise offset past count - limit
[ "Returns", "new", "CharacterDataWrapper", "TODO", ":", "Don", "t", "raise", "offset", "past", "count", "-", "limit" ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/character.py#L15-L21
gpennington/PyMarvel
marvel/character.py
CharacterDataWrapper.previous
def previous(self): """ Returns new CharacterDataWrapper TODO: Don't lower offset below 0 """ self.params['offset'] = str(int(self.params['offset']) - int(self.params['limit'])) return self.marvel.get_characters(self.marvel, (), **self.params)
python
def previous(self): """ Returns new CharacterDataWrapper TODO: Don't lower offset below 0 """ self.params['offset'] = str(int(self.params['offset']) - int(self.params['limit'])) return self.marvel.get_characters(self.marvel, (), **self.params)
[ "def", "previous", "(", "self", ")", ":", "self", ".", "params", "[", "'offset'", "]", "=", "str", "(", "int", "(", "self", ".", "params", "[", "'offset'", "]", ")", "-", "int", "(", "self", ".", "params", "[", "'limit'", "]", ")", ")", "return",...
Returns new CharacterDataWrapper TODO: Don't lower offset below 0
[ "Returns", "new", "CharacterDataWrapper", "TODO", ":", "Don", "t", "lower", "offset", "below", "0" ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/character.py#L23-L29
gpennington/PyMarvel
marvel/marvel.py
Marvel._call
def _call(self, resource_url, params=None): """ Calls the Marvel API endpoint :param resource_url: url slug of the resource :type resource_url: str :param params: query params to add to endpoint :type params: str :returns: response -- Requests response ...
python
def _call(self, resource_url, params=None): """ Calls the Marvel API endpoint :param resource_url: url slug of the resource :type resource_url: str :param params: query params to add to endpoint :type params: str :returns: response -- Requests response ...
[ "def", "_call", "(", "self", ",", "resource_url", ",", "params", "=", "None", ")", ":", "url", "=", "\"%s%s\"", "%", "(", "self", ".", "_endpoint", "(", ")", ",", "resource_url", ")", "if", "params", ":", "url", "+=", "\"?%s&%s\"", "%", "(", "params"...
Calls the Marvel API endpoint :param resource_url: url slug of the resource :type resource_url: str :param params: query params to add to endpoint :type params: str :returns: response -- Requests response
[ "Calls", "the", "Marvel", "API", "endpoint" ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L38-L55
gpennington/PyMarvel
marvel/marvel.py
Marvel._auth
def _auth(self): """ Creates hash from api keys and returns all required parametsrs :returns: str -- URL encoded query parameters containing "ts", "apikey", and "hash" """ ts = datetime.datetime.now().strftime("%Y-%m-%d%H:%M:%S") hash_string = hashlib.md5("%s%s%...
python
def _auth(self): """ Creates hash from api keys and returns all required parametsrs :returns: str -- URL encoded query parameters containing "ts", "apikey", and "hash" """ ts = datetime.datetime.now().strftime("%Y-%m-%d%H:%M:%S") hash_string = hashlib.md5("%s%s%...
[ "def", "_auth", "(", "self", ")", ":", "ts", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d%H:%M:%S\"", ")", "hash_string", "=", "hashlib", ".", "md5", "(", "\"%s%s%s\"", "%", "(", "ts", ",", "self", ".", "p...
Creates hash from api keys and returns all required parametsrs :returns: str -- URL encoded query parameters containing "ts", "apikey", and "hash"
[ "Creates", "hash", "from", "api", "keys", "and", "returns", "all", "required", "parametsrs", ":", "returns", ":", "str", "--", "URL", "encoded", "query", "parameters", "containing", "ts", "apikey", "and", "hash" ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L69-L77
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_character
def get_character(self, id): """Fetches a single character by id. get /v1/public/characters :param id: ID of Character :type params: int :returns: CharacterDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_character(1009718) ...
python
def get_character(self, id): """Fetches a single character by id. get /v1/public/characters :param id: ID of Character :type params: int :returns: CharacterDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_character(1009718) ...
[ "def", "get_character", "(", "self", ",", "id", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "Character", ".", "resource_url", "(", ")", ",", "id", ")", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "url", ")", ".", "text",...
Fetches a single character by id. get /v1/public/characters :param id: ID of Character :type params: int :returns: CharacterDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_character(1009718) >>> print cdw.data.count 1 ...
[ "Fetches", "a", "single", "character", "by", "id", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L84-L104
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_characters
def get_characters(self, *args, **kwargs): """Fetches lists of comic characters with optional filters. get /v1/public/characters/{characterId} :returns: CharacterDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_characters(orderBy="name,-modified", limit="5"...
python
def get_characters(self, *args, **kwargs): """Fetches lists of comic characters with optional filters. get /v1/public/characters/{characterId} :returns: CharacterDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_characters(orderBy="name,-modified", limit="5"...
[ "def", "get_characters", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#pass url string and params string to _call", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Character", ".", "resource_url", "(", ")", ",", ...
Fetches lists of comic characters with optional filters. get /v1/public/characters/{characterId} :returns: CharacterDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_characters(orderBy="name,-modified", limit="5", offset="15") >>> print cdw.data.count ...
[ "Fetches", "lists", "of", "comic", "characters", "with", "optional", "filters", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L106-L128
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_comic
def get_comic(self, id): """Fetches a single comic by id. get /v1/public/comics/{comicId} :param id: ID of Comic :type params: int :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comic(1009718) ...
python
def get_comic(self, id): """Fetches a single comic by id. get /v1/public/comics/{comicId} :param id: ID of Comic :type params: int :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comic(1009718) ...
[ "def", "get_comic", "(", "self", ",", "id", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "Comic", ".", "resource_url", "(", ")", ",", "id", ")", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "url", ")", ".", "text", ")", ...
Fetches a single comic by id. get /v1/public/comics/{comicId} :param id: ID of Comic :type params: int :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comic(1009718) >>> print cdw.data.count 1...
[ "Fetches", "a", "single", "comic", "by", "id", ".", "get", "/", "v1", "/", "public", "/", "comics", "/", "{", "comicId", "}", ":", "param", "id", ":", "ID", "of", "Comic", ":", "type", "params", ":", "int", ":", "returns", ":", "ComicDataWrapper" ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L130-L150
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_comics
def get_comics(self, *args, **kwargs): """ Fetches list of comics. get /v1/public/comics :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15") ...
python
def get_comics(self, *args, **kwargs): """ Fetches list of comics. get /v1/public/comics :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15") ...
[ "def", "get_comics", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Comic", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")", ...
Fetches list of comics. get /v1/public/comics :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15") >>> print cdw.data.count 10 >>> print cdw....
[ "Fetches", "list", "of", "comics", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L152-L170
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_creator
def get_creator(self, id): """Fetches a single creator by id. get /v1/public/creators/{creatorId} :param id: ID of Creator :type params: int :returns: CreatorDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_creator(30) >>> p...
python
def get_creator(self, id): """Fetches a single creator by id. get /v1/public/creators/{creatorId} :param id: ID of Creator :type params: int :returns: CreatorDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_creator(30) >>> p...
[ "def", "get_creator", "(", "self", ",", "id", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "Creator", ".", "resource_url", "(", ")", ",", "id", ")", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "url", ")", ".", "text", "...
Fetches a single creator by id. get /v1/public/creators/{creatorId} :param id: ID of Creator :type params: int :returns: CreatorDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_creator(30) >>> print cdw.data.count 1 ...
[ "Fetches", "a", "single", "creator", "by", "id", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L173-L193
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_creators
def get_creators(self, *args, **kwargs): """Fetches lists of creators. get /v1/public/creators :returns: CreatorDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_creators(lastName="Lee", orderBy="firstName,-modified", limit="5", offset="15") ...
python
def get_creators(self, *args, **kwargs): """Fetches lists of creators. get /v1/public/creators :returns: CreatorDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_creators(lastName="Lee", orderBy="firstName,-modified", limit="5", offset="15") ...
[ "def", "get_creators", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Creator", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")...
Fetches lists of creators. get /v1/public/creators :returns: CreatorDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_creators(lastName="Lee", orderBy="firstName,-modified", limit="5", offset="15") >>> print cdw.data.total 25 ...
[ "Fetches", "lists", "of", "creators", ".", "get", "/", "v1", "/", "public", "/", "creators", ":", "returns", ":", "CreatorDataWrapper" ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L196-L212
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_event
def get_event(self, id): """Fetches a single event by id. get /v1/public/event/{eventId} :param id: ID of Event :type params: int :returns: EventDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_event(253) >>> print resp...
python
def get_event(self, id): """Fetches a single event by id. get /v1/public/event/{eventId} :param id: ID of Event :type params: int :returns: EventDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_event(253) >>> print resp...
[ "def", "get_event", "(", "self", ",", "id", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "Event", ".", "resource_url", "(", ")", ",", "id", ")", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "url", ")", ".", "text", ")", ...
Fetches a single event by id. get /v1/public/event/{eventId} :param id: ID of Event :type params: int :returns: EventDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_event(253) >>> print response.data.result.title Infin...
[ "Fetches", "a", "single", "event", "by", "id", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L215-L233
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_events
def get_events(self, *args, **kwargs): """Fetches lists of events. get /v1/public/events :returns: EventDataWrapper >>> #Find all the events that involved both Hulk and Wolverine >>> #hulk's id: 1009351 >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, p...
python
def get_events(self, *args, **kwargs): """Fetches lists of events. get /v1/public/events :returns: EventDataWrapper >>> #Find all the events that involved both Hulk and Wolverine >>> #hulk's id: 1009351 >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, p...
[ "def", "get_events", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Event", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")", ...
Fetches lists of events. get /v1/public/events :returns: EventDataWrapper >>> #Find all the events that involved both Hulk and Wolverine >>> #hulk's id: 1009351 >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> response = m.get_events(ch...
[ "Fetches", "lists", "of", "events", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L236-L256
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_single_series
def get_single_series(self, id): """Fetches a single comic series by id. get /v1/public/series/{seriesId} :param id: ID of Series :type params: int :returns: SeriesDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_single...
python
def get_single_series(self, id): """Fetches a single comic series by id. get /v1/public/series/{seriesId} :param id: ID of Series :type params: int :returns: SeriesDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_single...
[ "def", "get_single_series", "(", "self", ",", "id", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "Series", ".", "resource_url", "(", ")", ",", "id", ")", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "url", ")", ".", "text"...
Fetches a single comic series by id. get /v1/public/series/{seriesId} :param id: ID of Series :type params: int :returns: SeriesDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_single_series(12429) >>> print response.da...
[ "Fetches", "a", "single", "comic", "series", "by", "id", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L259-L277
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_series
def get_series(self, *args, **kwargs): """Fetches lists of events. get /v1/public/events :returns: SeriesDataWrapper >>> #Find all the series that involved Wolverine >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> respo...
python
def get_series(self, *args, **kwargs): """Fetches lists of events. get /v1/public/events :returns: SeriesDataWrapper >>> #Find all the series that involved Wolverine >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> respo...
[ "def", "get_series", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Series", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")", ...
Fetches lists of events. get /v1/public/events :returns: SeriesDataWrapper >>> #Find all the series that involved Wolverine >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> response = m.get_series(characters="1009718") >...
[ "Fetches", "lists", "of", "events", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L280-L299
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_story
def get_story(self, id): """Fetches a single story by id. get /v1/public/stories/{storyId} :param id: ID of Story :type params: int :returns: StoryDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_story(29) >>> p...
python
def get_story(self, id): """Fetches a single story by id. get /v1/public/stories/{storyId} :param id: ID of Story :type params: int :returns: StoryDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_story(29) >>> p...
[ "def", "get_story", "(", "self", ",", "id", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "Story", ".", "resource_url", "(", ")", ",", "id", ")", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "url", ")", ".", "text", ")", ...
Fetches a single story by id. get /v1/public/stories/{storyId} :param id: ID of Story :type params: int :returns: StoryDataWrapper >>> m = Marvel(public_key, private_key) >>> response = m.get_story(29) >>> print response.data.result.title ...
[ "Fetches", "a", "single", "story", "by", "id", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L301-L319
gpennington/PyMarvel
marvel/marvel.py
Marvel.get_stories
def get_stories(self, *args, **kwargs): """Fetches lists of stories. get /v1/public/stories :returns: StoryDataWrapper >>> #Find all the stories that involved both Hulk and Wolverine >>> #hulk's id: 1009351 >>> #wolverine's id: 1009718 >>> m = ...
python
def get_stories(self, *args, **kwargs): """Fetches lists of stories. get /v1/public/stories :returns: StoryDataWrapper >>> #Find all the stories that involved both Hulk and Wolverine >>> #hulk's id: 1009351 >>> #wolverine's id: 1009718 >>> m = ...
[ "def", "get_stories", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Story", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")", ...
Fetches lists of stories. get /v1/public/stories :returns: StoryDataWrapper >>> #Find all the stories that involved both Hulk and Wolverine >>> #hulk's id: 1009351 >>> #wolverine's id: 1009718 >>> m = Marvel(public_key, private_key) >>> respons...
[ "Fetches", "lists", "of", "stories", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L322-L342
gpennington/PyMarvel
marvel/story.py
Story.get_creators
def get_creators(self, *args, **kwargs): """ Returns a full CreatorDataWrapper object for this story. /stories/{storyId}/creators :returns: CreatorDataWrapper -- A new request to API. Contains full results set. """ from .creator import Creator, CreatorDataWrapper ...
python
def get_creators(self, *args, **kwargs): """ Returns a full CreatorDataWrapper object for this story. /stories/{storyId}/creators :returns: CreatorDataWrapper -- A new request to API. Contains full results set. """ from .creator import Creator, CreatorDataWrapper ...
[ "def", "get_creators", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "creator", "import", "Creator", ",", "CreatorDataWrapper", "return", "self", ".", "get_related_resource", "(", "Creator", ",", "CreatorDataWrapper", ",", "a...
Returns a full CreatorDataWrapper object for this story. /stories/{storyId}/creators :returns: CreatorDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "CreatorDataWrapper", "object", "for", "this", "story", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/story.py#L91-L100
gpennington/PyMarvel
marvel/story.py
Story.get_characters
def get_characters(self, *args, **kwargs): """ Returns a full CharacterDataWrapper object for this story. /stories/{storyId}/characters :returns: CharacterDataWrapper -- A new request to API. Contains full results set. """ from .character import Character, CharacterDat...
python
def get_characters(self, *args, **kwargs): """ Returns a full CharacterDataWrapper object for this story. /stories/{storyId}/characters :returns: CharacterDataWrapper -- A new request to API. Contains full results set. """ from .character import Character, CharacterDat...
[ "def", "get_characters", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "character", "import", "Character", ",", "CharacterDataWrapper", "return", "self", ".", "get_related_resource", "(", "Character", ",", "CharacterDataWrapper",...
Returns a full CharacterDataWrapper object for this story. /stories/{storyId}/characters :returns: CharacterDataWrapper -- A new request to API. Contains full results set.
[ "Returns", "a", "full", "CharacterDataWrapper", "object", "for", "this", "story", "." ]
train
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/story.py#L102-L111
faroit/stempeg
stempeg/__init__.py
ffmpeg_version
def ffmpeg_version(): """Returns the available ffmpeg version Returns ---------- version : str version number as string """ cmd = [ 'ffmpeg', '-version' ] output = sp.check_output(cmd) aac_codecs = [ x for x in output.splitlines() if "ffmpeg...
python
def ffmpeg_version(): """Returns the available ffmpeg version Returns ---------- version : str version number as string """ cmd = [ 'ffmpeg', '-version' ] output = sp.check_output(cmd) aac_codecs = [ x for x in output.splitlines() if "ffmpeg...
[ "def", "ffmpeg_version", "(", ")", ":", "cmd", "=", "[", "'ffmpeg'", ",", "'-version'", "]", "output", "=", "sp", ".", "check_output", "(", "cmd", ")", "aac_codecs", "=", "[", "x", "for", "x", "in", "output", ".", "splitlines", "(", ")", "if", "\"ffm...
Returns the available ffmpeg version Returns ---------- version : str version number as string
[ "Returns", "the", "available", "ffmpeg", "version" ]
train
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/__init__.py#L32-L56
faroit/stempeg
stempeg/__init__.py
cli
def cli(inargs=None): """ Commandline interface for receiving stem files """ parser = argparse.ArgumentParser() parser.add_argument( '--version', '-V', action='version', version='%%(prog)s %s' % __version__ ) parser.add_argument( 'filename', metavar...
python
def cli(inargs=None): """ Commandline interface for receiving stem files """ parser = argparse.ArgumentParser() parser.add_argument( '--version', '-V', action='version', version='%%(prog)s %s' % __version__ ) parser.add_argument( 'filename', metavar...
[ "def", "cli", "(", "inargs", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--version'", ",", "'-V'", ",", "action", "=", "'version'", ",", "version", "=", "'%%(prog)s %s'", "%", "...
Commandline interface for receiving stem files
[ "Commandline", "interface", "for", "receiving", "stem", "files" ]
train
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/__init__.py#L59-L108
faroit/stempeg
stempeg/write.py
check_available_aac_encoders
def check_available_aac_encoders(): """Returns the available AAC encoders Returns ---------- codecs : list(str) List of available encoder codecs """ cmd = [ 'ffmpeg', '-v', 'error', '-codecs' ] output = sp.check_output(cmd) aac_codecs = [ x ...
python
def check_available_aac_encoders(): """Returns the available AAC encoders Returns ---------- codecs : list(str) List of available encoder codecs """ cmd = [ 'ffmpeg', '-v', 'error', '-codecs' ] output = sp.check_output(cmd) aac_codecs = [ x ...
[ "def", "check_available_aac_encoders", "(", ")", ":", "cmd", "=", "[", "'ffmpeg'", ",", "'-v'", ",", "'error'", ",", "'-codecs'", "]", "output", "=", "sp", ".", "check_output", "(", "cmd", ")", "aac_codecs", "=", "[", "x", "for", "x", "in", "output", "...
Returns the available AAC encoders Returns ---------- codecs : list(str) List of available encoder codecs
[ "Returns", "the", "available", "AAC", "encoders" ]
train
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/write.py#L10-L35
faroit/stempeg
stempeg/write.py
write_stems
def write_stems( audio, filename, rate=44100, bitrate=256000, codec=None, ffmpeg_params=None ): """Write stems from numpy Tensor Parameters ---------- audio : array_like The tensor of Matrix of stems. The data shape is formatted as :code:`stems x channels x sampl...
python
def write_stems( audio, filename, rate=44100, bitrate=256000, codec=None, ffmpeg_params=None ): """Write stems from numpy Tensor Parameters ---------- audio : array_like The tensor of Matrix of stems. The data shape is formatted as :code:`stems x channels x sampl...
[ "def", "write_stems", "(", "audio", ",", "filename", ",", "rate", "=", "44100", ",", "bitrate", "=", "256000", ",", "codec", "=", "None", ",", "ffmpeg_params", "=", "None", ")", ":", "if", "int", "(", "stempeg", ".", "ffmpeg_version", "(", ")", "[", ...
Write stems from numpy Tensor Parameters ---------- audio : array_like The tensor of Matrix of stems. The data shape is formatted as :code:`stems x channels x samples`. filename : str Output file_name of the stems file rate : int Output samplerate. Defaults to 44100 ...
[ "Write", "stems", "from", "numpy", "Tensor" ]
train
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/write.py#L38-L128
faroit/stempeg
stempeg/read.py
read_info
def read_info( filename ): """Extracts FFMPEG info and returns info as JSON Returns ------- info : Dict JSON info dict """ cmd = [ 'ffprobe', filename, '-v', 'error', '-print_format', 'json', '-show_format', '-show_streams', ] out = ...
python
def read_info( filename ): """Extracts FFMPEG info and returns info as JSON Returns ------- info : Dict JSON info dict """ cmd = [ 'ffprobe', filename, '-v', 'error', '-print_format', 'json', '-show_format', '-show_streams', ] out = ...
[ "def", "read_info", "(", "filename", ")", ":", "cmd", "=", "[", "'ffprobe'", ",", "filename", ",", "'-v'", ",", "'error'", ",", "'-print_format'", ",", "'json'", ",", "'-show_format'", ",", "'-show_streams'", ",", "]", "out", "=", "sp", ".", "check_output"...
Extracts FFMPEG info and returns info as JSON Returns ------- info : Dict JSON info dict
[ "Extracts", "FFMPEG", "info", "and", "returns", "info", "as", "JSON" ]
train
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/read.py#L56-L77
faroit/stempeg
stempeg/read.py
read_stems
def read_stems( filename, out_type=np.float_, stem_id=None, start=0, duration=None, info=None ): """Read STEMS format into numpy Tensor Parameters ---------- filename : str Filename of STEMS format. Typically `filename.stem.mp4`. out_type : type Output type. ...
python
def read_stems( filename, out_type=np.float_, stem_id=None, start=0, duration=None, info=None ): """Read STEMS format into numpy Tensor Parameters ---------- filename : str Filename of STEMS format. Typically `filename.stem.mp4`. out_type : type Output type. ...
[ "def", "read_stems", "(", "filename", ",", "out_type", "=", "np", ".", "float_", ",", "stem_id", "=", "None", ",", "start", "=", "0", ",", "duration", "=", "None", ",", "info", "=", "None", ")", ":", "if", "info", "is", "None", ":", "FFinfo", "=", ...
Read STEMS format into numpy Tensor Parameters ---------- filename : str Filename of STEMS format. Typically `filename.stem.mp4`. out_type : type Output type. Defaults to 32bit float aka `np.float32`. stem_id : int Stem ID (Stream ID) to read. Defaults to `None`, which reads...
[ "Read", "STEMS", "format", "into", "numpy", "Tensor" ]
train
https://github.com/faroit/stempeg/blob/ebbaec87ea440fcbb06423d708e7847749e63d38/stempeg/read.py#L80-L176
titusjan/argos
argos/repo/rtiplugins/pandasio.py
PandasIndexRti.nDims
def nDims(self): """ The number of dimensions of the index. Will always be 1. """ result = self._index.ndim assert result == 1, "Expected index to be 1D, got: {}D".format(result) return result
python
def nDims(self): """ The number of dimensions of the index. Will always be 1. """ result = self._index.ndim assert result == 1, "Expected index to be 1D, got: {}D".format(result) return result
[ "def", "nDims", "(", "self", ")", ":", "result", "=", "self", ".", "_index", ".", "ndim", "assert", "result", "==", "1", ",", "\"Expected index to be 1D, got: {}D\"", ".", "format", "(", "result", ")", "return", "result" ]
The number of dimensions of the index. Will always be 1.
[ "The", "number", "of", "dimensions", "of", "the", "index", ".", "Will", "always", "be", "1", "." ]
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/rtiplugins/pandasio.py#L80-L85
titusjan/argos
argos/repo/rtiplugins/pandasio.py
AbstractPandasNDFrameRti.elementTypeName
def elementTypeName(self): """ String representation of the element type. """ if self._ndFrame is None: return super(AbstractPandasNDFrameRti, self).elementTypeName else: try: return str(self._ndFrame.dtype) # Series except AttributeErr...
python
def elementTypeName(self): """ String representation of the element type. """ if self._ndFrame is None: return super(AbstractPandasNDFrameRti, self).elementTypeName else: try: return str(self._ndFrame.dtype) # Series except AttributeErr...
[ "def", "elementTypeName", "(", "self", ")", ":", "if", "self", ".", "_ndFrame", "is", "None", ":", "return", "super", "(", "AbstractPandasNDFrameRti", ",", "self", ")", ".", "elementTypeName", "else", ":", "try", ":", "return", "str", "(", "self", ".", "...
String representation of the element type.
[ "String", "representation", "of", "the", "element", "type", "." ]
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/rtiplugins/pandasio.py#L196-L205
titusjan/argos
argos/repo/rtiplugins/pandasio.py
AbstractPandasNDFrameRti._createIndexRti
def _createIndexRti(self, index, nodeName): """ Auxiliary method that creates a PandasIndexRti. """ return PandasIndexRti(index=index, nodeName=nodeName, fileName=self.fileName, iconColor=self._iconColor)
python
def _createIndexRti(self, index, nodeName): """ Auxiliary method that creates a PandasIndexRti. """ return PandasIndexRti(index=index, nodeName=nodeName, fileName=self.fileName, iconColor=self._iconColor)
[ "def", "_createIndexRti", "(", "self", ",", "index", ",", "nodeName", ")", ":", "return", "PandasIndexRti", "(", "index", "=", "index", ",", "nodeName", "=", "nodeName", ",", "fileName", "=", "self", ".", "fileName", ",", "iconColor", "=", "self", ".", "...
Auxiliary method that creates a PandasIndexRti.
[ "Auxiliary", "method", "that", "creates", "a", "PandasIndexRti", "." ]
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/rtiplugins/pandasio.py#L208-L212
titusjan/argos
argos/repo/rtiplugins/pandasio.py
PandasSeriesRti._fetchAllChildren
def _fetchAllChildren(self): """ Fetches the index if the showIndex member is True Descendants can override this function to add the subdevicions. """ assert self.isSliceable, "No underlying pandas object: self._ndFrame is None" childItems = [] if self._standAlone: ...
python
def _fetchAllChildren(self): """ Fetches the index if the showIndex member is True Descendants can override this function to add the subdevicions. """ assert self.isSliceable, "No underlying pandas object: self._ndFrame is None" childItems = [] if self._standAlone: ...
[ "def", "_fetchAllChildren", "(", "self", ")", ":", "assert", "self", ".", "isSliceable", ",", "\"No underlying pandas object: self._ndFrame is None\"", "childItems", "=", "[", "]", "if", "self", ".", "_standAlone", ":", "childItems", ".", "append", "(", "self", "....
Fetches the index if the showIndex member is True Descendants can override this function to add the subdevicions.
[ "Fetches", "the", "index", "if", "the", "showIndex", "member", "is", "True" ]
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/rtiplugins/pandasio.py#L234-L243