partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
PatternGenerator._apply_mask
Create (if necessary) and apply the mask to the given matrix mat.
imagen/patterngenerator.py
def _apply_mask(self,p,mat): """Create (if necessary) and apply the mask to the given matrix mat.""" mask = p.mask ms=p.mask_shape if ms is not None: mask = ms(x=p.x+p.size*(ms.x*np.cos(p.orientation)-ms.y*np.sin(p.orientation)), y=p.y+p.size*(ms.x*np.si...
def _apply_mask(self,p,mat): """Create (if necessary) and apply the mask to the given matrix mat.""" mask = p.mask ms=p.mask_shape if ms is not None: mask = ms(x=p.x+p.size*(ms.x*np.cos(p.orientation)-ms.y*np.sin(p.orientation)), y=p.y+p.size*(ms.x*np.si...
[ "Create", "(", "if", "necessary", ")", "and", "apply", "the", "mask", "to", "the", "given", "matrix", "mat", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L260-L270
[ "def", "_apply_mask", "(", "self", ",", "p", ",", "mat", ")", ":", "mask", "=", "p", ".", "mask", "ms", "=", "p", ".", "mask_shape", "if", "ms", "is", "not", "None", ":", "mask", "=", "ms", "(", "x", "=", "p", ".", "x", "+", "p", ".", "size...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator.set_matrix_dimensions
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend ...
imagen/patterngenerator.py
def set_matrix_dimensions(self, bounds, xdensity, ydensity): """ Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can ove...
def set_matrix_dimensions(self, bounds, xdensity, ydensity): """ Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can ove...
[ "Change", "the", "dimensions", "of", "the", "matrix", "into", "which", "the", "pattern", "will", "be", "drawn", ".", "Users", "of", "this", "class", "should", "call", "this", "method", "rather", "than", "changing", "the", "bounds", "xdensity", "and", "ydensi...
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L273-L288
[ "def", "set_matrix_dimensions", "(", "self", ",", "bounds", ",", "xdensity", ",", "ydensity", ")", ":", "self", ".", "bounds", "=", "bounds", "self", ".", "xdensity", "=", "xdensity", "self", ".", "ydensity", "=", "ydensity", "scs", "=", "SheetCoordinateSyst...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator.state_push
Save the state of the output functions, to be restored with state_pop.
imagen/patterngenerator.py
def state_push(self): "Save the state of the output functions, to be restored with state_pop." for of in self.output_fns: if hasattr(of,'state_push'): of.state_push() super(PatternGenerator, self).state_push()
def state_push(self): "Save the state of the output functions, to be restored with state_pop." for of in self.output_fns: if hasattr(of,'state_push'): of.state_push() super(PatternGenerator, self).state_push()
[ "Save", "the", "state", "of", "the", "output", "functions", "to", "be", "restored", "with", "state_pop", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L290-L295
[ "def", "state_push", "(", "self", ")", ":", "for", "of", "in", "self", ".", "output_fns", ":", "if", "hasattr", "(", "of", ",", "'state_push'", ")", ":", "of", ".", "state_push", "(", ")", "super", "(", "PatternGenerator", ",", "self", ")", ".", "sta...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator.state_pop
Restore the state of the output functions saved by state_push.
imagen/patterngenerator.py
def state_pop(self): "Restore the state of the output functions saved by state_push." for of in self.output_fns: if hasattr(of,'state_pop'): of.state_pop() super(PatternGenerator, self).state_pop()
def state_pop(self): "Restore the state of the output functions saved by state_push." for of in self.output_fns: if hasattr(of,'state_pop'): of.state_pop() super(PatternGenerator, self).state_pop()
[ "Restore", "the", "state", "of", "the", "output", "functions", "saved", "by", "state_push", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L298-L303
[ "def", "state_pop", "(", "self", ")", ":", "for", "of", "in", "self", ".", "output_fns", ":", "if", "hasattr", "(", "of", ",", "'state_pop'", ")", ":", "of", ".", "state_pop", "(", ")", "super", "(", "PatternGenerator", ",", "self", ")", ".", "state_...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator.anim
duration: The temporal duration to animate in the units defined on the global time function. offset: The temporal offset from which the animation is generated given the supplied pattern timestep: The time interval between successive frames. The duration must be an exact multipl...
imagen/patterngenerator.py
def anim(self, duration, offset=0, timestep=1, label=None, unit=None, time_fn=param.Dynamic.time_fn): """ duration: The temporal duration to animate in the units defined on the global time function. offset: The temporal offset from which the animation is ...
def anim(self, duration, offset=0, timestep=1, label=None, unit=None, time_fn=param.Dynamic.time_fn): """ duration: The temporal duration to animate in the units defined on the global time function. offset: The temporal offset from which the animation is ...
[ "duration", ":", "The", "temporal", "duration", "to", "animate", "in", "the", "units", "defined", "on", "the", "global", "time", "function", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L306-L351
[ "def", "anim", "(", "self", ",", "duration", ",", "offset", "=", "0", ",", "timestep", "=", "1", ",", "label", "=", "None", ",", "unit", "=", "None", ",", "time_fn", "=", "param", ".", "Dynamic", ".", "time_fn", ")", ":", "frames", "=", "(", "dur...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator.pil
Returns a PIL image for this pattern, overriding parameters if provided.
imagen/patterngenerator.py
def pil(self, **params_to_override): """Returns a PIL image for this pattern, overriding parameters if provided.""" from PIL.Image import fromarray nchans = self.num_channels() if nchans in [0, 1]: mode, arr = None, self(**params_to_override) arr = (255.0 / arr.m...
def pil(self, **params_to_override): """Returns a PIL image for this pattern, overriding parameters if provided.""" from PIL.Image import fromarray nchans = self.num_channels() if nchans in [0, 1]: mode, arr = None, self(**params_to_override) arr = (255.0 / arr.m...
[ "Returns", "a", "PIL", "image", "for", "this", "pattern", "overriding", "parameters", "if", "provided", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L394-L411
[ "def", "pil", "(", "self", ",", "*", "*", "params_to_override", ")", ":", "from", "PIL", ".", "Image", "import", "fromarray", "nchans", "=", "self", ".", "num_channels", "(", ")", "if", "nchans", "in", "[", "0", ",", "1", "]", ":", "mode", ",", "ar...
53c5685c880f54b42795964d8db50b02e8590e88
train
Composite.state_push
Push the state of all generators
imagen/patterngenerator.py
def state_push(self): """ Push the state of all generators """ super(Composite,self).state_push() for gen in self.generators: gen.state_push()
def state_push(self): """ Push the state of all generators """ super(Composite,self).state_push() for gen in self.generators: gen.state_push()
[ "Push", "the", "state", "of", "all", "generators" ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L516-L522
[ "def", "state_push", "(", "self", ")", ":", "super", "(", "Composite", ",", "self", ")", ".", "state_push", "(", ")", "for", "gen", "in", "self", ".", "generators", ":", "gen", ".", "state_push", "(", ")" ]
53c5685c880f54b42795964d8db50b02e8590e88
train
Composite.state_pop
Pop the state of all generators
imagen/patterngenerator.py
def state_pop(self): """ Pop the state of all generators """ super(Composite,self).state_pop() for gen in self.generators: gen.state_pop()
def state_pop(self): """ Pop the state of all generators """ super(Composite,self).state_pop() for gen in self.generators: gen.state_pop()
[ "Pop", "the", "state", "of", "all", "generators" ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L524-L530
[ "def", "state_pop", "(", "self", ")", ":", "super", "(", "Composite", ",", "self", ")", ".", "state_pop", "(", ")", "for", "gen", "in", "self", ".", "generators", ":", "gen", ".", "state_pop", "(", ")" ]
53c5685c880f54b42795964d8db50b02e8590e88
train
Composite.function
Constructs combined pattern out of the individual ones.
imagen/patterngenerator.py
def function(self,p): """Constructs combined pattern out of the individual ones.""" generators = self._advance_pattern_generators(p) assert hasattr(p.operator,'reduce'),repr(p.operator)+" does not support 'reduce'." # CEBALERT: mask gets applied by all PGs including the Composite itsel...
def function(self,p): """Constructs combined pattern out of the individual ones.""" generators = self._advance_pattern_generators(p) assert hasattr(p.operator,'reduce'),repr(p.operator)+" does not support 'reduce'." # CEBALERT: mask gets applied by all PGs including the Composite itsel...
[ "Constructs", "combined", "pattern", "out", "of", "the", "individual", "ones", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L535-L552
[ "def", "function", "(", "self", ",", "p", ")", ":", "generators", "=", "self", ".", "_advance_pattern_generators", "(", "p", ")", "assert", "hasattr", "(", "p", ".", "operator", ",", "'reduce'", ")", ",", "repr", "(", "p", ".", "operator", ")", "+", ...
53c5685c880f54b42795964d8db50b02e8590e88
train
compile_create_table
Postgresql Create Table statement formatter.
postpy/ddl.py
def compile_create_table(qualified_name: str, column_statement: str, primary_key_statement: str) -> str: """Postgresql Create Table statement formatter.""" statement = """ CREATE TABLE {table} ({columns} {primary_keys}); """.format(table=qualified_name, ...
def compile_create_table(qualified_name: str, column_statement: str, primary_key_statement: str) -> str: """Postgresql Create Table statement formatter.""" statement = """ CREATE TABLE {table} ({columns} {primary_keys}); """.format(table=qualified_name, ...
[ "Postgresql", "Create", "Table", "statement", "formatter", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/ddl.py#L14-L23
[ "def", "compile_create_table", "(", "qualified_name", ":", "str", ",", "column_statement", ":", "str", ",", "primary_key_statement", ":", "str", ")", "->", "str", ":", "statement", "=", "\"\"\"\n CREATE TABLE {table} ({columns} {primary_keys});\n ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
compile_create_temporary_table
Postgresql Create Temporary Table statement formatter.
postpy/ddl.py
def compile_create_temporary_table(table_name: str, column_statement: str, primary_key_statement: str) -> str: """Postgresql Create Temporary Table statement formatter.""" statement = """ CREATE TEMPORARY TABLE {table} ({colu...
def compile_create_temporary_table(table_name: str, column_statement: str, primary_key_statement: str) -> str: """Postgresql Create Temporary Table statement formatter.""" statement = """ CREATE TEMPORARY TABLE {table} ({colu...
[ "Postgresql", "Create", "Temporary", "Table", "statement", "formatter", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/ddl.py#L26-L36
[ "def", "compile_create_temporary_table", "(", "table_name", ":", "str", ",", "column_statement", ":", "str", ",", "primary_key_statement", ":", "str", ")", "->", "str", ":", "statement", "=", "\"\"\"\n CREATE TEMPORARY TABLE {table} ({columns} {primary_keys});\...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
compile_column
Create column definition statement.
postpy/ddl.py
def compile_column(name: str, data_type: str, nullable: bool) -> str: """Create column definition statement.""" null_str = 'NULL' if nullable else 'NOT NULL' return '{name} {data_type} {null},'.format(name=name, data_type=data_type, ...
def compile_column(name: str, data_type: str, nullable: bool) -> str: """Create column definition statement.""" null_str = 'NULL' if nullable else 'NOT NULL' return '{name} {data_type} {null},'.format(name=name, data_type=data_type, ...
[ "Create", "column", "definition", "statement", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/ddl.py#L39-L46
[ "def", "compile_column", "(", "name", ":", "str", ",", "data_type", ":", "str", ",", "nullable", ":", "bool", ")", "->", "str", ":", "null_str", "=", "'NULL'", "if", "nullable", "else", "'NOT NULL'", "return", "'{name} {data_type} {null},'", ".", "format", "...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
MaterializedView.create
Declare materalized view.
postpy/ddl.py
def create(self, no_data=False): """Declare materalized view.""" if self.query: ddl_statement = self.compile_create_as() else: ddl_statement = self.compile_create() if no_data: ddl_statement += '\nWITH NO DATA' return ddl_statement, self.que...
def create(self, no_data=False): """Declare materalized view.""" if self.query: ddl_statement = self.compile_create_as() else: ddl_statement = self.compile_create() if no_data: ddl_statement += '\nWITH NO DATA' return ddl_statement, self.que...
[ "Declare", "materalized", "view", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/ddl.py#L97-L108
[ "def", "create", "(", "self", ",", "no_data", "=", "False", ")", ":", "if", "self", ".", "query", ":", "ddl_statement", "=", "self", ".", "compile_create_as", "(", ")", "else", ":", "ddl_statement", "=", "self", ".", "compile_create", "(", ")", "if", "...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
predicted_effects_for_variant
For a given variant, return its set of predicted effects. Optionally filter to transcripts where this variant results in a non-synonymous change to the protein sequence. Parameters ---------- variant : varcode.Variant transcript_id_whitelist : set Filter effect predictions to only incl...
isovar/effect_prediction.py
def predicted_effects_for_variant( variant, transcript_id_whitelist=None, only_coding_changes=True): """ For a given variant, return its set of predicted effects. Optionally filter to transcripts where this variant results in a non-synonymous change to the protein sequence. ...
def predicted_effects_for_variant( variant, transcript_id_whitelist=None, only_coding_changes=True): """ For a given variant, return its set of predicted effects. Optionally filter to transcripts where this variant results in a non-synonymous change to the protein sequence. ...
[ "For", "a", "given", "variant", "return", "its", "set", "of", "predicted", "effects", ".", "Optionally", "filter", "to", "transcripts", "where", "this", "variant", "results", "in", "a", "non", "-", "synonymous", "change", "to", "the", "protein", "sequence", ...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/effect_prediction.py#L24-L88
[ "def", "predicted_effects_for_variant", "(", "variant", ",", "transcript_id_whitelist", "=", "None", ",", "only_coding_changes", "=", "True", ")", ":", "effects", "=", "[", "]", "for", "transcript", "in", "variant", ".", "transcripts", ":", "if", "only_coding_chan...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
reference_transcripts_for_variant
For a given variant, find all the transcripts which overlap the variant and for which it has a predictable effect on the amino acid sequence of the protein.
isovar/effect_prediction.py
def reference_transcripts_for_variant( variant, transcript_id_whitelist=None, only_coding_changes=True): """ For a given variant, find all the transcripts which overlap the variant and for which it has a predictable effect on the amino acid sequence of the protein. """ pr...
def reference_transcripts_for_variant( variant, transcript_id_whitelist=None, only_coding_changes=True): """ For a given variant, find all the transcripts which overlap the variant and for which it has a predictable effect on the amino acid sequence of the protein. """ pr...
[ "For", "a", "given", "variant", "find", "all", "the", "transcripts", "which", "overlap", "the", "variant", "and", "for", "which", "it", "has", "a", "predictable", "effect", "on", "the", "amino", "acid", "sequence", "of", "the", "protein", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/effect_prediction.py#L91-L104
[ "def", "reference_transcripts_for_variant", "(", "variant", ",", "transcript_id_whitelist", "=", "None", ",", "only_coding_changes", "=", "True", ")", ":", "predicted_effects", "=", "predicted_effects_for_variant", "(", "variant", "=", "variant", ",", "transcript_id_white...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
pileup_reads_at_position
Returns a pileup column at the specified position. Unclear if a function like this is hiding somewhere in pysam API.
isovar/locus_reads.py
def pileup_reads_at_position(samfile, chromosome, base0_position): """ Returns a pileup column at the specified position. Unclear if a function like this is hiding somewhere in pysam API. """ # TODO: I want to pass truncate=True, stepper="all" # but for some reason I get this error: # ...
def pileup_reads_at_position(samfile, chromosome, base0_position): """ Returns a pileup column at the specified position. Unclear if a function like this is hiding somewhere in pysam API. """ # TODO: I want to pass truncate=True, stepper="all" # but for some reason I get this error: # ...
[ "Returns", "a", "pileup", "column", "at", "the", "specified", "position", ".", "Unclear", "if", "a", "function", "like", "this", "is", "hiding", "somewhere", "in", "pysam", "API", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/locus_reads.py#L215-L240
[ "def", "pileup_reads_at_position", "(", "samfile", ",", "chromosome", ",", "base0_position", ")", ":", "# TODO: I want to pass truncate=True, stepper=\"all\"", "# but for some reason I get this error:", "# pileup() got an unexpected keyword argument 'truncate'", "# ...even though thes...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
locus_read_generator
Generator that yields a sequence of ReadAtLocus records for reads which contain the positions before and after a variant. The actual work to figure out if what's between those positions matches a variant happens later in the `variant_reads` module. Parameters ---------- samfile : pysam.Alignmen...
isovar/locus_reads.py
def locus_read_generator( samfile, chromosome, base1_position_before_variant, base1_position_after_variant, use_duplicate_reads=USE_DUPLICATE_READS, use_secondary_alignments=USE_SECONDARY_ALIGNMENTS, min_mapping_quality=MIN_READ_MAPPING_QUALITY): """ Gener...
def locus_read_generator( samfile, chromosome, base1_position_before_variant, base1_position_after_variant, use_duplicate_reads=USE_DUPLICATE_READS, use_secondary_alignments=USE_SECONDARY_ALIGNMENTS, min_mapping_quality=MIN_READ_MAPPING_QUALITY): """ Gener...
[ "Generator", "that", "yields", "a", "sequence", "of", "ReadAtLocus", "records", "for", "reads", "which", "contain", "the", "positions", "before", "and", "after", "a", "variant", ".", "The", "actual", "work", "to", "figure", "out", "if", "what", "s", "between...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/locus_reads.py#L243-L317
[ "def", "locus_read_generator", "(", "samfile", ",", "chromosome", ",", "base1_position_before_variant", ",", "base1_position_after_variant", ",", "use_duplicate_reads", "=", "USE_DUPLICATE_READS", ",", "use_secondary_alignments", "=", "USE_SECONDARY_ALIGNMENTS", ",", "min_mappi...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
locus_reads_dataframe
Traverse a BAM file to find all the reads overlapping a specified locus. Parameters are the same as those for read_locus_generator.
isovar/locus_reads.py
def locus_reads_dataframe(*args, **kwargs): """ Traverse a BAM file to find all the reads overlapping a specified locus. Parameters are the same as those for read_locus_generator. """ df_builder = DataFrameBuilder( LocusRead, variant_columns=False, converters={ "...
def locus_reads_dataframe(*args, **kwargs): """ Traverse a BAM file to find all the reads overlapping a specified locus. Parameters are the same as those for read_locus_generator. """ df_builder = DataFrameBuilder( LocusRead, variant_columns=False, converters={ "...
[ "Traverse", "a", "BAM", "file", "to", "find", "all", "the", "reads", "overlapping", "a", "specified", "locus", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/locus_reads.py#L320-L335
[ "def", "locus_reads_dataframe", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "df_builder", "=", "DataFrameBuilder", "(", "LocusRead", ",", "variant_columns", "=", "False", ",", "converters", "=", "{", "\"reference_positions\"", ":", "list_to_string", ","...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
LocusRead.from_pysam_pileup_element
Parameters ---------- pileup_element : pysam.PileupRead base0_position_before_variant : int base0_position_after_variant : int use_secondary_alignments : bool use_duplicate_reads : bool min_mapping_quality : int use_soft_clipped_bases : bool. Default...
isovar/locus_reads.py
def from_pysam_pileup_element( cls, pileup_element, base0_position_before_variant, base0_position_after_variant, use_secondary_alignments, use_duplicate_reads, min_mapping_quality, use_soft_clipped_bases=False): """ ...
def from_pysam_pileup_element( cls, pileup_element, base0_position_before_variant, base0_position_after_variant, use_secondary_alignments, use_duplicate_reads, min_mapping_quality, use_soft_clipped_bases=False): """ ...
[ "Parameters", "----------", "pileup_element", ":", "pysam", ".", "PileupRead" ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/locus_reads.py#L62-L212
[ "def", "from_pysam_pileup_element", "(", "cls", ",", "pileup_element", ",", "base0_position_before_variant", ",", "base0_position_after_variant", ",", "use_secondary_alignments", ",", "use_duplicate_reads", ",", "min_mapping_quality", ",", "use_soft_clipped_bases", "=", "False"...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
copy_from_csv_sql
Generate copy from csv statement.
postpy/dml_copy.py
def copy_from_csv_sql(qualified_name: str, delimiter=',', encoding='utf8', null_str='', header=True, escape_str='\\', quote_char='"', force_not_null=None, force_null=None): """Generate copy from csv statement.""" options = [] options.append("DELIMITER '%s'" % del...
def copy_from_csv_sql(qualified_name: str, delimiter=',', encoding='utf8', null_str='', header=True, escape_str='\\', quote_char='"', force_not_null=None, force_null=None): """Generate copy from csv statement.""" options = [] options.append("DELIMITER '%s'" % del...
[ "Generate", "copy", "from", "csv", "statement", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/dml_copy.py#L83-L109
[ "def", "copy_from_csv_sql", "(", "qualified_name", ":", "str", ",", "delimiter", "=", "','", ",", "encoding", "=", "'utf8'", ",", "null_str", "=", "''", ",", "header", "=", "True", ",", "escape_str", "=", "'\\\\'", ",", "quote_char", "=", "'\"'", ",", "f...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
sort_protein_sequences
Sort protein sequences in decreasing order of priority
isovar/protein_sequences.py
def sort_protein_sequences(protein_sequences): """ Sort protein sequences in decreasing order of priority """ return list( sorted( protein_sequences, key=ProteinSequence.ascending_sort_key, reverse=True))
def sort_protein_sequences(protein_sequences): """ Sort protein sequences in decreasing order of priority """ return list( sorted( protein_sequences, key=ProteinSequence.ascending_sort_key, reverse=True))
[ "Sort", "protein", "sequences", "in", "decreasing", "order", "of", "priority" ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/protein_sequences.py#L182-L190
[ "def", "sort_protein_sequences", "(", "protein_sequences", ")", ":", "return", "list", "(", "sorted", "(", "protein_sequences", ",", "key", "=", "ProteinSequence", ".", "ascending_sort_key", ",", "reverse", "=", "True", ")", ")" ]
b39b684920e3f6b344851d6598a1a1c67bce913b
train
reads_generator_to_protein_sequences_generator
Translates each coding variant in a collection to one or more Translation objects, which are then aggregated into equivalent ProteinSequence objects. Parameters ---------- variant_and_overlapping_reads_generator : generator Yields sequence of varcode.Variant objects paired with sequences ...
isovar/protein_sequences.py
def reads_generator_to_protein_sequences_generator( variant_and_overlapping_reads_generator, transcript_id_whitelist=None, protein_sequence_length=PROTEIN_SEQUENCE_LENGTH, min_alt_rna_reads=MIN_ALT_RNA_READS, min_variant_sequence_coverage=MIN_VARIANT_SEQUENCE_COVERAGE, mi...
def reads_generator_to_protein_sequences_generator( variant_and_overlapping_reads_generator, transcript_id_whitelist=None, protein_sequence_length=PROTEIN_SEQUENCE_LENGTH, min_alt_rna_reads=MIN_ALT_RNA_READS, min_variant_sequence_coverage=MIN_VARIANT_SEQUENCE_COVERAGE, mi...
[ "Translates", "each", "coding", "variant", "in", "a", "collection", "to", "one", "or", "more", "Translation", "objects", "which", "are", "then", "aggregated", "into", "equivalent", "ProteinSequence", "objects", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/protein_sequences.py#L192-L311
[ "def", "reads_generator_to_protein_sequences_generator", "(", "variant_and_overlapping_reads_generator", ",", "transcript_id_whitelist", "=", "None", ",", "protein_sequence_length", "=", "PROTEIN_SEQUENCE_LENGTH", ",", "min_alt_rna_reads", "=", "MIN_ALT_RNA_READS", ",", "min_varian...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
protein_sequences_generator_to_dataframe
Given a generator which yields (Variant, [ProteinSequence]) elements, returns a pandas.DataFrame
isovar/protein_sequences.py
def protein_sequences_generator_to_dataframe(variant_and_protein_sequences_generator): """ Given a generator which yields (Variant, [ProteinSequence]) elements, returns a pandas.DataFrame """ return dataframe_from_generator( element_class=ProteinSequence, variant_and_elements_generat...
def protein_sequences_generator_to_dataframe(variant_and_protein_sequences_generator): """ Given a generator which yields (Variant, [ProteinSequence]) elements, returns a pandas.DataFrame """ return dataframe_from_generator( element_class=ProteinSequence, variant_and_elements_generat...
[ "Given", "a", "generator", "which", "yields", "(", "Variant", "[", "ProteinSequence", "]", ")", "elements", "returns", "a", "pandas", ".", "DataFrame" ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/protein_sequences.py#L314-L323
[ "def", "protein_sequences_generator_to_dataframe", "(", "variant_and_protein_sequences_generator", ")", ":", "return", "dataframe_from_generator", "(", "element_class", "=", "ProteinSequence", ",", "variant_and_elements_generator", "=", "variant_and_protein_sequences_generator", ",",...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
ProteinSequence._summarize_translations
Summarize a collection of Translation objects into three values: 1) List of unique reads supporting underlying variant sequences 2) Set of unique transcript names for establishing reading frames of the translations. 3) Set of unique gene names for all transcripts used ...
isovar/protein_sequences.py
def _summarize_translations(cls, translations): """ Summarize a collection of Translation objects into three values: 1) List of unique reads supporting underlying variant sequences 2) Set of unique transcript names for establishing reading frames of the translation...
def _summarize_translations(cls, translations): """ Summarize a collection of Translation objects into three values: 1) List of unique reads supporting underlying variant sequences 2) Set of unique transcript names for establishing reading frames of the translation...
[ "Summarize", "a", "collection", "of", "Translation", "objects", "into", "three", "values", ":", "1", ")", "List", "of", "unique", "reads", "supporting", "underlying", "variant", "sequences", "2", ")", "Set", "of", "unique", "transcript", "names", "for", "estab...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/protein_sequences.py#L110-L128
[ "def", "_summarize_translations", "(", "cls", ",", "translations", ")", ":", "read_name_to_reads", "=", "{", "}", "gene_names", "=", "set", "(", "[", "]", ")", "transcript_ids", "=", "set", "(", "[", "]", ")", "for", "translation", "in", "translations", ":...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
ProteinSequence.from_translation_key
Create a ProteinSequence object from a TranslationKey, along with all the extra fields a ProteinSequence requires.
isovar/protein_sequences.py
def from_translation_key( cls, translation_key, translations, overlapping_reads, ref_reads, alt_reads, alt_reads_supporting_protein_sequence, transcripts_overlapping_variant, transcripts_supporting_protein_sequen...
def from_translation_key( cls, translation_key, translations, overlapping_reads, ref_reads, alt_reads, alt_reads_supporting_protein_sequence, transcripts_overlapping_variant, transcripts_supporting_protein_sequen...
[ "Create", "a", "ProteinSequence", "object", "from", "a", "TranslationKey", "along", "with", "all", "the", "extra", "fields", "a", "ProteinSequence", "requires", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/protein_sequences.py#L131-L161
[ "def", "from_translation_key", "(", "cls", ",", "translation_key", ",", "translations", ",", "overlapping_reads", ",", "ref_reads", ",", "alt_reads", ",", "alt_reads_supporting_protein_sequence", ",", "transcripts_overlapping_variant", ",", "transcripts_supporting_protein_seque...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
ProteinSequence.ascending_sort_key
Sort protein sequences lexicographically by three criteria: - number of unique supporting reads - minimum mismatch versus a supporting reference transcript before variant - minimum mismatch versus a supporting reference transcript after variant - number of supporting refe...
isovar/protein_sequences.py
def ascending_sort_key(self): """ Sort protein sequences lexicographically by three criteria: - number of unique supporting reads - minimum mismatch versus a supporting reference transcript before variant - minimum mismatch versus a supporting reference transcript aft...
def ascending_sort_key(self): """ Sort protein sequences lexicographically by three criteria: - number of unique supporting reads - minimum mismatch versus a supporting reference transcript before variant - minimum mismatch versus a supporting reference transcript aft...
[ "Sort", "protein", "sequences", "lexicographically", "by", "three", "criteria", ":", "-", "number", "of", "unique", "supporting", "reads", "-", "minimum", "mismatch", "versus", "a", "supporting", "reference", "transcript", "before", "variant", "-", "minimum", "mis...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/protein_sequences.py#L163-L180
[ "def", "ascending_sort_key", "(", "self", ")", ":", "return", "(", "len", "(", "self", ".", "alt_reads_supporting_protein_sequence", ")", ",", "min", "(", "t", ".", "number_mismatches_before_variant", "for", "t", "in", "self", ".", "translations", ")", ",", "m...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
make_delete_table
Table referencing a delete from using primary key join.
postpy/base.py
def make_delete_table(table: Table, delete_prefix='delete_from__') -> Table: """Table referencing a delete from using primary key join.""" name = delete_prefix + table.name primary_key = table.primary_key key_names = set(primary_key.column_names) columns = [column for column in table.columns if col...
def make_delete_table(table: Table, delete_prefix='delete_from__') -> Table: """Table referencing a delete from using primary key join.""" name = delete_prefix + table.name primary_key = table.primary_key key_names = set(primary_key.column_names) columns = [column for column in table.columns if col...
[ "Table", "referencing", "a", "delete", "from", "using", "primary", "key", "join", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/base.py#L136-L145
[ "def", "make_delete_table", "(", "table", ":", "Table", ",", "delete_prefix", "=", "'delete_from__'", ")", "->", "Table", ":", "name", "=", "delete_prefix", "+", "table", ".", "name", "primary_key", "=", "table", ".", "primary_key", "key_names", "=", "set", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
order_table_columns
Record table column(s) and primary key columns by specified order.
postpy/base.py
def order_table_columns(table: Table, column_names: list) -> Table: """Record table column(s) and primary key columns by specified order.""" unordered_columns = table.column_names index_order = (unordered_columns.index(name) for name in column_names) ordered_columns = [table.columns[i] for i in index_o...
def order_table_columns(table: Table, column_names: list) -> Table: """Record table column(s) and primary key columns by specified order.""" unordered_columns = table.column_names index_order = (unordered_columns.index(name) for name in column_names) ordered_columns = [table.columns[i] for i in index_o...
[ "Record", "table", "column", "(", "s", ")", "and", "primary", "key", "columns", "by", "specified", "order", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/base.py#L157-L167
[ "def", "order_table_columns", "(", "table", ":", "Table", ",", "column_names", ":", "list", ")", "->", "Table", ":", "unordered_columns", "=", "table", ".", "column_names", "index_order", "=", "(", "unordered_columns", ".", "index", "(", "name", ")", "for", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
trim_variant_fields
Trims common prefixes from the ref and alt sequences Parameters ---------- location : int Position (starting from 1) on some chromosome ref : str Reference nucleotides alt : str Alternate (mutant) nucleotide Returns adjusted triplet (location, ref, alt)
isovar/variant_helpers.py
def trim_variant_fields(location, ref, alt): """ Trims common prefixes from the ref and alt sequences Parameters ---------- location : int Position (starting from 1) on some chromosome ref : str Reference nucleotides alt : str Alternate (mutant) nucleotide Ret...
def trim_variant_fields(location, ref, alt): """ Trims common prefixes from the ref and alt sequences Parameters ---------- location : int Position (starting from 1) on some chromosome ref : str Reference nucleotides alt : str Alternate (mutant) nucleotide Ret...
[ "Trims", "common", "prefixes", "from", "the", "ref", "and", "alt", "sequences" ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_helpers.py#L27-L64
[ "def", "trim_variant_fields", "(", "location", ",", "ref", ",", "alt", ")", ":", "if", "len", "(", "alt", ")", ">", "0", "and", "ref", ".", "startswith", "(", "alt", ")", ":", "# if alt is a prefix of the ref sequence then we actually have a", "# deletion like:", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
base0_interval_for_variant_fields
Inteval of interbase offsets of the affected reference positions for a particular variant's primary fields (pos, ref, alt). Parameters ---------- base1_location : int First reference nucleotide of variant or, for insertions, the base before the insertion. ref : str Referenc...
isovar/variant_helpers.py
def base0_interval_for_variant_fields(base1_location, ref, alt): """ Inteval of interbase offsets of the affected reference positions for a particular variant's primary fields (pos, ref, alt). Parameters ---------- base1_location : int First reference nucleotide of variant or, for inser...
def base0_interval_for_variant_fields(base1_location, ref, alt): """ Inteval of interbase offsets of the affected reference positions for a particular variant's primary fields (pos, ref, alt). Parameters ---------- base1_location : int First reference nucleotide of variant or, for inser...
[ "Inteval", "of", "interbase", "offsets", "of", "the", "affected", "reference", "positions", "for", "a", "particular", "variant", "s", "primary", "fields", "(", "pos", "ref", "alt", ")", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_helpers.py#L78-L107
[ "def", "base0_interval_for_variant_fields", "(", "base1_location", ",", "ref", ",", "alt", ")", ":", "if", "len", "(", "ref", ")", "==", "0", ":", "# in interbase coordinates, the insertion happens", "# at the same start/end offsets, since those are already between", "# refer...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
base0_interval_for_variant
Inteval of interbase offsets of the affected reference positions for a particular variant. Parameters ---------- variant : varcode.Variant Returns triplet of (base1_location, ref, alt)
isovar/variant_helpers.py
def base0_interval_for_variant(variant): """ Inteval of interbase offsets of the affected reference positions for a particular variant. Parameters ---------- variant : varcode.Variant Returns triplet of (base1_location, ref, alt) """ base1_location, ref, alt = trim_variant(variant)...
def base0_interval_for_variant(variant): """ Inteval of interbase offsets of the affected reference positions for a particular variant. Parameters ---------- variant : varcode.Variant Returns triplet of (base1_location, ref, alt) """ base1_location, ref, alt = trim_variant(variant)...
[ "Inteval", "of", "interbase", "offsets", "of", "the", "affected", "reference", "positions", "for", "a", "particular", "variant", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_helpers.py#L110-L125
[ "def", "base0_interval_for_variant", "(", "variant", ")", ":", "base1_location", ",", "ref", ",", "alt", "=", "trim_variant", "(", "variant", ")", "return", "base0_interval_for_variant_fields", "(", "base1_location", "=", "base1_location", ",", "ref", "=", "ref", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
interbase_range_affected_by_variant_on_transcript
Convert from a variant's position in global genomic coordinates on the forward strand to an interval of interbase offsets on a particular transcript's mRNA. Parameters ---------- variant : varcode.Variant transcript : pyensembl.Transcript Assumes that the transcript overlaps the variant. ...
isovar/variant_helpers.py
def interbase_range_affected_by_variant_on_transcript(variant, transcript): """ Convert from a variant's position in global genomic coordinates on the forward strand to an interval of interbase offsets on a particular transcript's mRNA. Parameters ---------- variant : varcode.Variant t...
def interbase_range_affected_by_variant_on_transcript(variant, transcript): """ Convert from a variant's position in global genomic coordinates on the forward strand to an interval of interbase offsets on a particular transcript's mRNA. Parameters ---------- variant : varcode.Variant t...
[ "Convert", "from", "a", "variant", "s", "position", "in", "global", "genomic", "coordinates", "on", "the", "forward", "strand", "to", "an", "interval", "of", "interbase", "offsets", "on", "a", "particular", "transcript", "s", "mRNA", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_helpers.py#L127-L190
[ "def", "interbase_range_affected_by_variant_on_transcript", "(", "variant", ",", "transcript", ")", ":", "if", "variant", ".", "is_insertion", ":", "if", "transcript", ".", "strand", "==", "\"+\"", ":", "# base-1 position of an insertion is the genomic nucleotide", "# befor...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
insert
Insert a collection of namedtuple records.
postpy/dml.py
def insert(conn, qualified_name: str, column_names, records): """Insert a collection of namedtuple records.""" query = create_insert_statement(qualified_name, column_names) with conn: with conn.cursor(cursor_factory=NamedTupleCursor) as cursor: for record in records: cu...
def insert(conn, qualified_name: str, column_names, records): """Insert a collection of namedtuple records.""" query = create_insert_statement(qualified_name, column_names) with conn: with conn.cursor(cursor_factory=NamedTupleCursor) as cursor: for record in records: cu...
[ "Insert", "a", "collection", "of", "namedtuple", "records", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/dml.py#L30-L38
[ "def", "insert", "(", "conn", ",", "qualified_name", ":", "str", ",", "column_names", ",", "records", ")", ":", "query", "=", "create_insert_statement", "(", "qualified_name", ",", "column_names", ")", "with", "conn", ":", "with", "conn", ".", "cursor", "(",...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
insert_many
Insert many records by chunking data into insert statements. Notes ----- records should be Iterable collection of namedtuples or tuples.
postpy/dml.py
def insert_many(conn, tablename, column_names, records, chunksize=2500): """Insert many records by chunking data into insert statements. Notes ----- records should be Iterable collection of namedtuples or tuples. """ groups = chunks(records, chunksize) column_str = ','.join(column_names) ...
def insert_many(conn, tablename, column_names, records, chunksize=2500): """Insert many records by chunking data into insert statements. Notes ----- records should be Iterable collection of namedtuples or tuples. """ groups = chunks(records, chunksize) column_str = ','.join(column_names) ...
[ "Insert", "many", "records", "by", "chunking", "data", "into", "insert", "statements", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/dml.py#L41-L60
[ "def", "insert_many", "(", "conn", ",", "tablename", ",", "column_names", ",", "records", ",", "chunksize", "=", "2500", ")", ":", "groups", "=", "chunks", "(", "records", ",", "chunksize", ")", "column_str", "=", "','", ".", "join", "(", "column_names", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
upsert_records
Upsert records.
postpy/dml.py
def upsert_records(conn, records, upsert_statement): """Upsert records.""" with conn: with conn.cursor() as cursor: for record in records: cursor.execute(upsert_statement, record)
def upsert_records(conn, records, upsert_statement): """Upsert records.""" with conn: with conn.cursor() as cursor: for record in records: cursor.execute(upsert_statement, record)
[ "Upsert", "records", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/dml.py#L63-L69
[ "def", "upsert_records", "(", "conn", ",", "records", ",", "upsert_statement", ")", ":", "with", "conn", ":", "with", "conn", ".", "cursor", "(", ")", "as", "cursor", ":", "for", "record", "in", "records", ":", "cursor", ".", "execute", "(", "upsert_stat...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
delete_joined_table_sql
SQL statement for a joined delete from. Generate SQL statement for deleting the intersection of rows between both tables from table referenced by tablename.
postpy/dml.py
def delete_joined_table_sql(qualified_name, removing_qualified_name, primary_key): """SQL statement for a joined delete from. Generate SQL statement for deleting the intersection of rows between both tables from table referenced by tablename. """ condition_template = 't.{}=d.{}' where_clause = ...
def delete_joined_table_sql(qualified_name, removing_qualified_name, primary_key): """SQL statement for a joined delete from. Generate SQL statement for deleting the intersection of rows between both tables from table referenced by tablename. """ condition_template = 't.{}=d.{}' where_clause = ...
[ "SQL", "statement", "for", "a", "joined", "delete", "from", ".", "Generate", "SQL", "statement", "for", "deleting", "the", "intersection", "of", "rows", "between", "both", "tables", "from", "table", "referenced", "by", "tablename", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/dml.py#L165-L180
[ "def", "delete_joined_table_sql", "(", "qualified_name", ",", "removing_qualified_name", ",", "primary_key", ")", ":", "condition_template", "=", "'t.{}=d.{}'", "where_clause", "=", "' AND '", ".", "join", "(", "condition_template", ".", "format", "(", "pkey", ",", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
copy_from_csv
Copy file-like object to database table. Notes ----- Implementation defaults to postgres standard except for encoding. Postgres falls back on client encoding, while function defaults to utf-8. References ---------- https://www.postgresql.org/docs/current/static/sql-copy.html
postpy/dml.py
def copy_from_csv(conn, file, qualified_name: str, delimiter=',', encoding='utf8', null_str='', header=True, escape_str='\\', quote_char='"', force_not_null=None, force_null=None): """Copy file-like object to database table. Notes ----- Implementation defaults to pos...
def copy_from_csv(conn, file, qualified_name: str, delimiter=',', encoding='utf8', null_str='', header=True, escape_str='\\', quote_char='"', force_not_null=None, force_null=None): """Copy file-like object to database table. Notes ----- Implementation defaults to pos...
[ "Copy", "file", "-", "like", "object", "to", "database", "table", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/dml.py#L237-L261
[ "def", "copy_from_csv", "(", "conn", ",", "file", ",", "qualified_name", ":", "str", ",", "delimiter", "=", "','", ",", "encoding", "=", "'utf8'", ",", "null_str", "=", "''", ",", "header", "=", "True", ",", "escape_str", "=", "'\\\\'", ",", "quote_char"...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
get_user_tables
Retrieve all user tables.
postpy/admin.py
def get_user_tables(conn): """Retrieve all user tables.""" query_string = "select schemaname, relname from pg_stat_user_tables;" with conn.cursor() as cursor: cursor.execute(query_string) tables = cursor.fetchall() return tables
def get_user_tables(conn): """Retrieve all user tables.""" query_string = "select schemaname, relname from pg_stat_user_tables;" with conn.cursor() as cursor: cursor.execute(query_string) tables = cursor.fetchall() return tables
[ "Retrieve", "all", "user", "tables", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/admin.py#L13-L21
[ "def", "get_user_tables", "(", "conn", ")", ":", "query_string", "=", "\"select schemaname, relname from pg_stat_user_tables;\"", "with", "conn", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "query_string", ")", "tables", "=", "curs...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
get_primary_keys
Returns primary key columns for a specific table.
postpy/admin.py
def get_primary_keys(conn, table: str, schema='public'): """Returns primary key columns for a specific table.""" query = """\ SELECT c.constraint_name AS pkey_constraint_name, c.column_name AS column_name FROM information_schema.key_column_usage AS c JOIN information_schema.table_constraints AS t ...
def get_primary_keys(conn, table: str, schema='public'): """Returns primary key columns for a specific table.""" query = """\ SELECT c.constraint_name AS pkey_constraint_name, c.column_name AS column_name FROM information_schema.key_column_usage AS c JOIN information_schema.table_constraints AS t ...
[ "Returns", "primary", "key", "columns", "for", "a", "specific", "table", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/admin.py#L24-L44
[ "def", "get_primary_keys", "(", "conn", ",", "table", ":", "str", ",", "schema", "=", "'public'", ")", ":", "query", "=", "\"\"\"\\\nSELECT\n c.constraint_name AS pkey_constraint_name,\n c.column_name AS column_name\nFROM\n information_schema.key_column_usage AS c\n JOIN info...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
get_column_metadata
Returns column data following db.Column parameter specification.
postpy/admin.py
def get_column_metadata(conn, table: str, schema='public'): """Returns column data following db.Column parameter specification.""" query = """\ SELECT attname as name, format_type(atttypid, atttypmod) AS data_type, NOT attnotnull AS nullable FROM pg_catalog.pg_attribute WHERE attrelid=%s::regclass AND a...
def get_column_metadata(conn, table: str, schema='public'): """Returns column data following db.Column parameter specification.""" query = """\ SELECT attname as name, format_type(atttypid, atttypmod) AS data_type, NOT attnotnull AS nullable FROM pg_catalog.pg_attribute WHERE attrelid=%s::regclass AND a...
[ "Returns", "column", "data", "following", "db", ".", "Column", "parameter", "specification", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/admin.py#L47-L62
[ "def", "get_column_metadata", "(", "conn", ",", "table", ":", "str", ",", "schema", "=", "'public'", ")", ":", "query", "=", "\"\"\"\\\nSELECT\n attname as name,\n format_type(atttypid, atttypmod) AS data_type,\n NOT attnotnull AS nullable\nFROM pg_catalog.pg_attribute\nWHERE attr...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
reflect_table
Reflect basic table attributes.
postpy/admin.py
def reflect_table(conn, table_name, schema='public'): """Reflect basic table attributes.""" column_meta = list(get_column_metadata(conn, table_name, schema=schema)) primary_key_columns = list(get_primary_keys(conn, table_name, schema=schema)) columns = [Column(**column_data) for column_data in column_...
def reflect_table(conn, table_name, schema='public'): """Reflect basic table attributes.""" column_meta = list(get_column_metadata(conn, table_name, schema=schema)) primary_key_columns = list(get_primary_keys(conn, table_name, schema=schema)) columns = [Column(**column_data) for column_data in column_...
[ "Reflect", "basic", "table", "attributes", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/admin.py#L65-L74
[ "def", "reflect_table", "(", "conn", ",", "table_name", ",", "schema", "=", "'public'", ")", ":", "column_meta", "=", "list", "(", "get_column_metadata", "(", "conn", ",", "table_name", ",", "schema", "=", "schema", ")", ")", "primary_key_columns", "=", "lis...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
reset
Reset database.
postpy/admin.py
def reset(db_name): """Reset database.""" conn = psycopg2.connect(database='postgres') db = Database(db_name) conn.autocommit = True with conn.cursor() as cursor: cursor.execute(db.drop_statement()) cursor.execute(db.create_statement()) conn.close()
def reset(db_name): """Reset database.""" conn = psycopg2.connect(database='postgres') db = Database(db_name) conn.autocommit = True with conn.cursor() as cursor: cursor.execute(db.drop_statement()) cursor.execute(db.create_statement()) conn.close()
[ "Reset", "database", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/admin.py#L77-L87
[ "def", "reset", "(", "db_name", ")", ":", "conn", "=", "psycopg2", ".", "connect", "(", "database", "=", "'postgres'", ")", "db", "=", "Database", "(", "db_name", ")", "conn", ".", "autocommit", "=", "True", "with", "conn", ".", "cursor", "(", ")", "...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
install_extensions
Install Postgres extension if available. Notes ----- - superuser is generally required for installing extensions. - Currently does not support specific schema.
postpy/admin.py
def install_extensions(extensions, **connection_parameters): """Install Postgres extension if available. Notes ----- - superuser is generally required for installing extensions. - Currently does not support specific schema. """ from postpy.connections import connect conn = connect(**c...
def install_extensions(extensions, **connection_parameters): """Install Postgres extension if available. Notes ----- - superuser is generally required for installing extensions. - Currently does not support specific schema. """ from postpy.connections import connect conn = connect(**c...
[ "Install", "Postgres", "extension", "if", "available", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/admin.py#L90-L105
[ "def", "install_extensions", "(", "extensions", ",", "*", "*", "connection_parameters", ")", ":", "from", "postpy", ".", "connections", "import", "connect", "conn", "=", "connect", "(", "*", "*", "connection_parameters", ")", "conn", ".", "autocommit", "=", "T...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
ExecutorDriverProxy.update
Sends a status update to the framework scheduler. Retrying as necessary until an acknowledgement has been received or the executor is terminated (in which case, a TASK_LOST status update will be sent). See Scheduler.statusUpdate for more information about status update acknowled...
mentor/proxies/executor.py
def update(self, status): """Sends a status update to the framework scheduler. Retrying as necessary until an acknowledgement has been received or the executor is terminated (in which case, a TASK_LOST status update will be sent). See Scheduler.statusUpdate for more information ...
def update(self, status): """Sends a status update to the framework scheduler. Retrying as necessary until an acknowledgement has been received or the executor is terminated (in which case, a TASK_LOST status update will be sent). See Scheduler.statusUpdate for more information ...
[ "Sends", "a", "status", "update", "to", "the", "framework", "scheduler", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/executor.py#L108-L119
[ "def", "update", "(", "self", ",", "status", ")", ":", "logging", ".", "info", "(", "'Executor sends status update {} for task {}'", ".", "format", "(", "status", ".", "state", ",", "status", ".", "task_id", ")", ")", "return", "self", ".", "driver", ".", ...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
ExecutorDriverProxy.message
Sends a message to the framework scheduler. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion.
mentor/proxies/executor.py
def message(self, data): """Sends a message to the framework scheduler. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion. """ logging.info('Driver sends framework message {}'.format(data)) return self.driver.se...
def message(self, data): """Sends a message to the framework scheduler. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion. """ logging.info('Driver sends framework message {}'.format(data)) return self.driver.se...
[ "Sends", "a", "message", "to", "the", "framework", "scheduler", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/executor.py#L121-L128
[ "def", "message", "(", "self", ",", "data", ")", ":", "logging", ".", "info", "(", "'Driver sends framework message {}'", ".", "format", "(", "data", ")", ")", "return", "self", ".", "driver", ".", "sendFrameworkMessage", "(", "data", ")" ]
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
RailDriver.get_controller_list
Returns an iterable of tuples containing (index, controller_name) pairs. Controller indexes start at 0. You may easily transform this to a {name: index} mapping by using: >>> controllers = {name: index for index, name in raildriver.get_controller_list()} :return enumerate
raildriver/library.py
def get_controller_list(self): """ Returns an iterable of tuples containing (index, controller_name) pairs. Controller indexes start at 0. You may easily transform this to a {name: index} mapping by using: >>> controllers = {name: index for index, name in raildriver.get_contro...
def get_controller_list(self): """ Returns an iterable of tuples containing (index, controller_name) pairs. Controller indexes start at 0. You may easily transform this to a {name: index} mapping by using: >>> controllers = {name: index for index, name in raildriver.get_contro...
[ "Returns", "an", "iterable", "of", "tuples", "containing", "(", "index", "controller_name", ")", "pairs", "." ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/library.py#L50-L65
[ "def", "get_controller_list", "(", "self", ")", ":", "ret_str", "=", "self", ".", "dll", ".", "GetControllerList", "(", ")", ".", "decode", "(", ")", "if", "not", "ret_str", ":", "return", "[", "]", "return", "enumerate", "(", "ret_str", ".", "split", ...
c7f5f551e0436451b9507fc63a62e49a229282b9
train
RailDriver.get_controller_value
Returns current/min/max value of controller at given index or name. It is much more efficient to query using an integer index rather than string name. Name is fine for seldom updates but it's not advised to be used every second or so. See `get_controller_list` for an example how to cache a dict...
raildriver/library.py
def get_controller_value(self, index_or_name, value_type): """ Returns current/min/max value of controller at given index or name. It is much more efficient to query using an integer index rather than string name. Name is fine for seldom updates but it's not advised to be used every sec...
def get_controller_value(self, index_or_name, value_type): """ Returns current/min/max value of controller at given index or name. It is much more efficient to query using an integer index rather than string name. Name is fine for seldom updates but it's not advised to be used every sec...
[ "Returns", "current", "/", "min", "/", "max", "value", "of", "controller", "at", "given", "index", "or", "name", "." ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/library.py#L67-L83
[ "def", "get_controller_value", "(", "self", ",", "index_or_name", ",", "value_type", ")", ":", "if", "not", "isinstance", "(", "index_or_name", ",", "int", ")", ":", "index", "=", "self", ".", "get_controller_index", "(", "index_or_name", ")", "else", ":", "...
c7f5f551e0436451b9507fc63a62e49a229282b9
train
RailDriver.get_current_time
Get current time :return: datetime.time
raildriver/library.py
def get_current_time(self): """ Get current time :return: datetime.time """ hms = [int(self.get_current_controller_value(i)) for i in range(406, 409)] return datetime.time(*hms)
def get_current_time(self): """ Get current time :return: datetime.time """ hms = [int(self.get_current_controller_value(i)) for i in range(406, 409)] return datetime.time(*hms)
[ "Get", "current", "time" ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/library.py#L134-L141
[ "def", "get_current_time", "(", "self", ")", ":", "hms", "=", "[", "int", "(", "self", ".", "get_current_controller_value", "(", "i", ")", ")", "for", "i", "in", "range", "(", "406", ",", "409", ")", "]", "return", "datetime", ".", "time", "(", "*", ...
c7f5f551e0436451b9507fc63a62e49a229282b9
train
RailDriver.get_loco_name
Returns the Provider, Product and Engine name. :return list
raildriver/library.py
def get_loco_name(self): """ Returns the Provider, Product and Engine name. :return list """ ret_str = self.dll.GetLocoName().decode() if not ret_str: return return ret_str.split('.:.')
def get_loco_name(self): """ Returns the Provider, Product and Engine name. :return list """ ret_str = self.dll.GetLocoName().decode() if not ret_str: return return ret_str.split('.:.')
[ "Returns", "the", "Provider", "Product", "and", "Engine", "name", "." ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/library.py#L143-L152
[ "def", "get_loco_name", "(", "self", ")", ":", "ret_str", "=", "self", ".", "dll", ".", "GetLocoName", "(", ")", ".", "decode", "(", ")", "if", "not", "ret_str", ":", "return", "return", "ret_str", ".", "split", "(", "'.:.'", ")" ]
c7f5f551e0436451b9507fc63a62e49a229282b9
train
RailDriver.set_controller_value
Sets controller value :param index_or_name integer index or string name :param value float
raildriver/library.py
def set_controller_value(self, index_or_name, value): """ Sets controller value :param index_or_name integer index or string name :param value float """ if not isinstance(index_or_name, int): index = self.get_controller_index(index_or_name) else: ...
def set_controller_value(self, index_or_name, value): """ Sets controller value :param index_or_name integer index or string name :param value float """ if not isinstance(index_or_name, int): index = self.get_controller_index(index_or_name) else: ...
[ "Sets", "controller", "value" ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/library.py#L172-L183
[ "def", "set_controller_value", "(", "self", ",", "index_or_name", ",", "value", ")", ":", "if", "not", "isinstance", "(", "index_or_name", ",", "int", ")", ":", "index", "=", "self", ".", "get_controller_index", "(", "index_or_name", ")", "else", ":", "index...
c7f5f551e0436451b9507fc63a62e49a229282b9
train
InvenioIndexer.init_app
Flask application initialization. :param app: The Flask application.
invenio_indexer/ext.py
def init_app(self, app): """Flask application initialization. :param app: The Flask application. """ self.init_config(app) app.extensions['invenio-indexer'] = self hooks = app.config.get('INDEXER_BEFORE_INDEX_HOOKS', []) for hook in hooks: if isinsta...
def init_app(self, app): """Flask application initialization. :param app: The Flask application. """ self.init_config(app) app.extensions['invenio-indexer'] = self hooks = app.config.get('INDEXER_BEFORE_INDEX_HOOKS', []) for hook in hooks: if isinsta...
[ "Flask", "application", "initialization", "." ]
inveniosoftware/invenio-indexer
python
https://github.com/inveniosoftware/invenio-indexer/blob/1460aa8976b449d9a3a99d356322b158e9be6f80/invenio_indexer/ext.py#L34-L46
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "self", ".", "init_config", "(", "app", ")", "app", ".", "extensions", "[", "'invenio-indexer'", "]", "=", "self", "hooks", "=", "app", ".", "config", ".", "get", "(", "'INDEXER_BEFORE_INDEX_HOOKS'", ...
1460aa8976b449d9a3a99d356322b158e9be6f80
train
OpanAnharmRepo.close
.. todo:: REPO.close docstring
opan/vpt2/repo.py
def close(self): """ .. todo:: REPO.close docstring """ # Imports import h5py as h5 from ..error import RepoError # Close the repo if it's bound, and wipe link; else complain if self._repo != None: self._repo.close() self._repo = None ...
def close(self): """ .. todo:: REPO.close docstring """ # Imports import h5py as h5 from ..error import RepoError # Close the repo if it's bound, and wipe link; else complain if self._repo != None: self._repo.close() self._repo = None ...
[ "..", "todo", "::", "REPO", ".", "close", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L120-L136
[ "def", "close", "(", "self", ")", ":", "# Imports", "import", "h5py", "as", "h5", "from", ".", ".", "error", "import", "RepoError", "# Close the repo if it's bound, and wipe link; else complain", "if", "self", ".", "_repo", "!=", "None", ":", "self", ".", "_repo...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.load
.. todo:: REPO.load docstring
opan/vpt2/repo.py
def load(self, fname): """ .. todo:: REPO.load docstring """ # Imports import h5py as h5 from ..error import RepoError # If repo not None, complain if not self._repo == None: raise RepoError(RepoError.STATUS, "Repository already o...
def load(self, fname): """ .. todo:: REPO.load docstring """ # Imports import h5py as h5 from ..error import RepoError # If repo not None, complain if not self._repo == None: raise RepoError(RepoError.STATUS, "Repository already o...
[ "..", "todo", "::", "REPO", ".", "load", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L142-L162
[ "def", "load", "(", "self", ",", "fname", ")", ":", "# Imports", "import", "h5py", "as", "h5", "from", ".", ".", "error", "import", "RepoError", "# If repo not None, complain", "if", "not", "self", ".", "_repo", "==", "None", ":", "raise", "RepoError", "("...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.is_open
.. todo:: is_open docstring
opan/vpt2/repo.py
def is_open(self): """ .. todo:: is_open docstring """ # Imports import h5py as h5 # Return whether repo is bound; depends on the 'None' assignment in # 'close' retval = isinstance(self._repo, h5.File) return retval
def is_open(self): """ .. todo:: is_open docstring """ # Imports import h5py as h5 # Return whether repo is bound; depends on the 'None' assignment in # 'close' retval = isinstance(self._repo, h5.File) return retval
[ "..", "todo", "::", "is_open", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L170-L180
[ "def", "is_open", "(", "self", ")", ":", "# Imports", "import", "h5py", "as", "h5", "# Return whether repo is bound; depends on the 'None' assignment in", "# 'close'", "retval", "=", "isinstance", "(", "self", ".", "_repo", ",", "h5", ".", "File", ")", "return", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.store_data
.. todo:: store_data docstring
opan/vpt2/repo.py
def store_data(self, data, datatype, mode, disp, clobber=False): """ .. todo:: store_data docstring """ # Imports import h5py as h5 from ..error import RepoError as RErr from ..const import EnumDispDirection as _E_DD from ..const import EnumAnharmRepoData ...
def store_data(self, data, datatype, mode, disp, clobber=False): """ .. todo:: store_data docstring """ # Imports import h5py as h5 from ..error import RepoError as RErr from ..const import EnumDispDirection as _E_DD from ..const import EnumAnharmRepoData ...
[ "..", "todo", "::", "store_data", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L186-L248
[ "def", "store_data", "(", "self", ",", "data", ",", "datatype", ",", "mode", ",", "disp", ",", "clobber", "=", "False", ")", ":", "# Imports", "import", "h5py", "as", "h5", "from", ".", ".", "error", "import", "RepoError", "as", "RErr", "from", ".", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.get_data
.. todo:: docstring for get_data
opan/vpt2/repo.py
def get_data(self, datatype, mode, disp): """ .. todo:: docstring for get_data """ # Imports import os from ..const import EnumDispDirection as _E_DD from ..const import EnumAnharmRepoData from ..error import RepoError as RErr # Must be valid mode ...
def get_data(self, datatype, mode, disp): """ .. todo:: docstring for get_data """ # Imports import os from ..const import EnumDispDirection as _E_DD from ..const import EnumAnharmRepoData from ..error import RepoError as RErr # Must be valid mode ...
[ "..", "todo", "::", "docstring", "for", "get_data" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L253-L313
[ "def", "get_data", "(", "self", ",", "datatype", ",", "mode", ",", "disp", ")", ":", "# Imports", "import", "os", "from", ".", ".", "const", "import", "EnumDispDirection", "as", "_E_DD", "from", ".", ".", "const", "import", "EnumAnharmRepoData", "from", "....
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.has_data
.. todo:: has_data docstring
opan/vpt2/repo.py
def has_data(self, datatype, mode, disp): """ .. todo:: has_data docstring """ # Imports from ..error import RepoError # Just try to get the data. Simply pass up all exceptions except for # those if the group or data doesn't exist. DO re-raise a non-bound # re...
def has_data(self, datatype, mode, disp): """ .. todo:: has_data docstring """ # Imports from ..error import RepoError # Just try to get the data. Simply pass up all exceptions except for # those if the group or data doesn't exist. DO re-raise a non-bound # re...
[ "..", "todo", "::", "has_data", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L318-L339
[ "def", "has_data", "(", "self", ",", "datatype", ",", "mode", ",", "disp", ")", ":", "# Imports", "from", ".", ".", "error", "import", "RepoError", "# Just try to get the data. Simply pass up all exceptions except for", "# those if the group or data doesn't exist. DO re-rais...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.store_param
.. todo:: store_param docstring
opan/vpt2/repo.py
def store_param(self, value, param, clobber=False): """ .. todo:: store_param docstring """ # Imports from ..const import EnumAnharmRepoParam from ..error import RepoError as RErr # Must be a valid parameter name if not param in EnumAnharmRepoParam: ...
def store_param(self, value, param, clobber=False): """ .. todo:: store_param docstring """ # Imports from ..const import EnumAnharmRepoParam from ..error import RepoError as RErr # Must be a valid parameter name if not param in EnumAnharmRepoParam: ...
[ "..", "todo", "::", "store_param", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L344-L392
[ "def", "store_param", "(", "self", ",", "value", ",", "param", ",", "clobber", "=", "False", ")", ":", "# Imports", "from", ".", ".", "const", "import", "EnumAnharmRepoParam", "from", ".", ".", "error", "import", "RepoError", "as", "RErr", "# Must be a valid...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.get_param
.. todo:: docstring for get_param
opan/vpt2/repo.py
def get_param(self, param): """ .. todo:: docstring for get_param """ # Imports import os from ..const import EnumAnharmRepoParam from ..error import RepoError as RErr # Must be a valid parameter name if not param in EnumAnharmRepoParam: rais...
def get_param(self, param): """ .. todo:: docstring for get_param """ # Imports import os from ..const import EnumAnharmRepoParam from ..error import RepoError as RErr # Must be a valid parameter name if not param in EnumAnharmRepoParam: rais...
[ "..", "todo", "::", "docstring", "for", "get_param" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L397-L432
[ "def", "get_param", "(", "self", ",", "param", ")", ":", "# Imports", "import", "os", "from", ".", ".", "const", "import", "EnumAnharmRepoParam", "from", ".", ".", "error", "import", "RepoError", "as", "RErr", "# Must be a valid parameter name", "if", "not", "...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.has_param
.. todo:: has_param docstring
opan/vpt2/repo.py
def has_param(self, param): """ .. todo:: has_param docstring """ # Imports from ..error import RepoError # Try to get the param; pass along all errors, except 'data' error # from RepoError retval = True try: self.get_param(param) ex...
def has_param(self, param): """ .. todo:: has_param docstring """ # Imports from ..error import RepoError # Try to get the param; pass along all errors, except 'data' error # from RepoError retval = True try: self.get_param(param) ex...
[ "..", "todo", "::", "has_param", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L437-L456
[ "def", "has_param", "(", "self", ",", "param", ")", ":", "# Imports", "from", ".", ".", "error", "import", "RepoError", "# Try to get the param; pass along all errors, except 'data' error", "# from RepoError", "retval", "=", "True", "try", ":", "self", ".", "get_para...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.is_dirty
.. todo:: docstring for is_dirty
opan/vpt2/repo.py
def is_dirty(self): """ .. todo:: docstring for is_dirty """ # Imports from ..error import RepoError as RErr # Get the return value from the dataset, complaining if repo not # bound. Using 'require_dataset' since any repo w/o a defined # 'dirty' value is just ...
def is_dirty(self): """ .. todo:: docstring for is_dirty """ # Imports from ..error import RepoError as RErr # Get the return value from the dataset, complaining if repo not # bound. Using 'require_dataset' since any repo w/o a defined # 'dirty' value is just ...
[ "..", "todo", "::", "docstring", "for", "is_dirty" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L461-L481
[ "def", "is_dirty", "(", "self", ")", ":", "# Imports", "from", ".", ".", "error", "import", "RepoError", "as", "RErr", "# Get the return value from the dataset, complaining if repo not", "# bound. Using 'require_dataset' since any repo w/o a defined", "# 'dirty' value is just goi...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.set_dirty
.. todo:: set_clean docstring
opan/vpt2/repo.py
def set_dirty(self, dirty): """ .. todo:: set_clean docstring """ # Complain if 'dirty' isn't boolean if not isinstance(dirty, bool): raise ValueError("'dirty' must be Boolean") ## end if # Try to retrieve the dataset; complain if repo not bound. try...
def set_dirty(self, dirty): """ .. todo:: set_clean docstring """ # Complain if 'dirty' isn't boolean if not isinstance(dirty, bool): raise ValueError("'dirty' must be Boolean") ## end if # Try to retrieve the dataset; complain if repo not bound. try...
[ "..", "todo", "::", "set_clean", "docstring" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L486-L505
[ "def", "set_dirty", "(", "self", ",", "dirty", ")", ":", "# Complain if 'dirty' isn't boolean", "if", "not", "isinstance", "(", "dirty", ",", "bool", ")", ":", "raise", "ValueError", "(", "\"'dirty' must be Boolean\"", ")", "## end if", "# Try to retrieve the dataset;...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanAnharmRepo.get_XYZ
.. todo:: docstring for get_xyz
opan/vpt2/repo.py
def get_XYZ(self, mode, disp): """ .. todo:: docstring for get_xyz """ # Imports from ..xyz import OpanXYZ as XYZ from ..const import EnumAnharmRepoParam, EnumAnharmRepoData # Generate XYZ and return out_XYZ = XYZ(atom_syms=self.get_param(EnumAnharmRepoParam.ato...
def get_XYZ(self, mode, disp): """ .. todo:: docstring for get_xyz """ # Imports from ..xyz import OpanXYZ as XYZ from ..const import EnumAnharmRepoParam, EnumAnharmRepoData # Generate XYZ and return out_XYZ = XYZ(atom_syms=self.get_param(EnumAnharmRepoParam.ato...
[ "..", "todo", "::", "docstring", "for", "get_xyz" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/repo.py#L511-L522
[ "def", "get_XYZ", "(", "self", ",", "mode", ",", "disp", ")", ":", "# Imports", "from", ".", ".", "xyz", "import", "OpanXYZ", "as", "XYZ", "from", ".", ".", "const", "import", "EnumAnharmRepoParam", ",", "EnumAnharmRepoData", "# Generate XYZ and return", "out_...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
SchedulerDriverProxy.stop
Stops the scheduler driver. If the 'failover' flag is set to False then it is expected that this framework will never reconnect to Mesos and all of its executors and tasks can be terminated. Otherwise, all executors and tasks will remain running (for some framework specific failover ti...
mentor/proxies/scheduler.py
def stop(self, failover=False): """Stops the scheduler driver. If the 'failover' flag is set to False then it is expected that this framework will never reconnect to Mesos and all of its executors and tasks can be terminated. Otherwise, all executors and tasks will remain runni...
def stop(self, failover=False): """Stops the scheduler driver. If the 'failover' flag is set to False then it is expected that this framework will never reconnect to Mesos and all of its executors and tasks can be terminated. Otherwise, all executors and tasks will remain runni...
[ "Stops", "the", "scheduler", "driver", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L86-L97
[ "def", "stop", "(", "self", ",", "failover", "=", "False", ")", ":", "logging", ".", "info", "(", "'Stops Scheduler Driver'", ")", "return", "self", ".", "driver", ".", "stop", "(", "failover", ")" ]
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.request
Requests resources from Mesos. (see mesos.proto for a description of Request and how, for example, to request resources from specific slaves.) Any resources available are offered to the framework via Scheduler.resourceOffers callback, asynchronously.
mentor/proxies/scheduler.py
def request(self, requests): """Requests resources from Mesos. (see mesos.proto for a description of Request and how, for example, to request resources from specific slaves.) Any resources available are offered to the framework via Scheduler.resourceOffers callback, asynchronou...
def request(self, requests): """Requests resources from Mesos. (see mesos.proto for a description of Request and how, for example, to request resources from specific slaves.) Any resources available are offered to the framework via Scheduler.resourceOffers callback, asynchronou...
[ "Requests", "resources", "from", "Mesos", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L121-L131
[ "def", "request", "(", "self", ",", "requests", ")", ":", "logging", ".", "info", "(", "'Request resources from Mesos'", ")", "return", "self", ".", "driver", ".", "requestResources", "(", "map", "(", "encode", ",", "requests", ")", ")" ]
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.launch
Launches the given set of tasks. Any resources remaining (i.e., not used by the tasks or their executors) will be considered declined. The specified filters are applied on all unused resources (see mesos.proto for a description of Filters). Available resources are aggregated whe...
mentor/proxies/scheduler.py
def launch(self, offer_id, tasks, filters=Filters()): """Launches the given set of tasks. Any resources remaining (i.e., not used by the tasks or their executors) will be considered declined. The specified filters are applied on all unused resources (see mesos.proto for a descri...
def launch(self, offer_id, tasks, filters=Filters()): """Launches the given set of tasks. Any resources remaining (i.e., not used by the tasks or their executors) will be considered declined. The specified filters are applied on all unused resources (see mesos.proto for a descri...
[ "Launches", "the", "given", "set", "of", "tasks", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L133-L150
[ "def", "launch", "(", "self", ",", "offer_id", ",", "tasks", ",", "filters", "=", "Filters", "(", ")", ")", ":", "logging", ".", "info", "(", "'Launches tasks {}'", ".", "format", "(", "tasks", ")", ")", "return", "self", ".", "driver", ".", "launchTas...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.kill
Kills the specified task. Note that attempting to kill a task is currently not reliable. If, for example, a scheduler fails over while it was attempting to kill a task it will need to retry in the future. Likewise, if unregistered / disconnected, the request will be dropped (the...
mentor/proxies/scheduler.py
def kill(self, task_id): """Kills the specified task. Note that attempting to kill a task is currently not reliable. If, for example, a scheduler fails over while it was attempting to kill a task it will need to retry in the future. Likewise, if unregistered / disconnected, the ...
def kill(self, task_id): """Kills the specified task. Note that attempting to kill a task is currently not reliable. If, for example, a scheduler fails over while it was attempting to kill a task it will need to retry in the future. Likewise, if unregistered / disconnected, the ...
[ "Kills", "the", "specified", "task", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L152-L162
[ "def", "kill", "(", "self", ",", "task_id", ")", ":", "logging", ".", "info", "(", "'Kills task {}'", ".", "format", "(", "task_id", ")", ")", "return", "self", ".", "driver", ".", "killTask", "(", "encode", "(", "task_id", ")", ")" ]
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.reconcile
Allows the framework to query the status for non-terminal tasks. This causes the master to send back the latest task status for each task in 'statuses', if possible. Tasks that are no longer known will result in a TASK_LOST update. If statuses is empty, then the master will send the lat...
mentor/proxies/scheduler.py
def reconcile(self, statuses): """Allows the framework to query the status for non-terminal tasks. This causes the master to send back the latest task status for each task in 'statuses', if possible. Tasks that are no longer known will result in a TASK_LOST update. If statuses is empty,...
def reconcile(self, statuses): """Allows the framework to query the status for non-terminal tasks. This causes the master to send back the latest task status for each task in 'statuses', if possible. Tasks that are no longer known will result in a TASK_LOST update. If statuses is empty,...
[ "Allows", "the", "framework", "to", "query", "the", "status", "for", "non", "-", "terminal", "tasks", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L164-L173
[ "def", "reconcile", "(", "self", ",", "statuses", ")", ":", "logging", ".", "info", "(", "'Reconciles task statuses {}'", ".", "format", "(", "statuses", ")", ")", "return", "self", ".", "driver", ".", "reconcileTasks", "(", "map", "(", "encode", ",", "sta...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.decline
Declines an offer in its entirety and applies the specified filters on the resources (see mesos.proto for a description of Filters). Note that this can be done at any time, it is not necessary to do this within the Scheduler::resourceOffers callback.
mentor/proxies/scheduler.py
def decline(self, offer_id, filters=Filters()): """Declines an offer in its entirety and applies the specified filters on the resources (see mesos.proto for a description of Filters). Note that this can be done at any time, it is not necessary to do this within the Schedul...
def decline(self, offer_id, filters=Filters()): """Declines an offer in its entirety and applies the specified filters on the resources (see mesos.proto for a description of Filters). Note that this can be done at any time, it is not necessary to do this within the Schedul...
[ "Declines", "an", "offer", "in", "its", "entirety", "and", "applies", "the", "specified", "filters", "on", "the", "resources", "(", "see", "mesos", ".", "proto", "for", "a", "description", "of", "Filters", ")", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L175-L185
[ "def", "decline", "(", "self", ",", "offer_id", ",", "filters", "=", "Filters", "(", ")", ")", ":", "logging", ".", "info", "(", "'Declines offer {}'", ".", "format", "(", "offer_id", ")", ")", "return", "self", ".", "driver", ".", "declineOffer", "(", ...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.accept
Accepts the given offers and performs a sequence of operations on those accepted offers. See Offer.Operation in mesos.proto for the set of available operations. Available resources are aggregated when multiple offers are provided. Note that all offers must belong to the same slave. ...
mentor/proxies/scheduler.py
def accept(self, offer_ids, operations, filters=Filters()): """Accepts the given offers and performs a sequence of operations on those accepted offers. See Offer.Operation in mesos.proto for the set of available operations. Available resources are aggregated when multiple offers are ...
def accept(self, offer_ids, operations, filters=Filters()): """Accepts the given offers and performs a sequence of operations on those accepted offers. See Offer.Operation in mesos.proto for the set of available operations. Available resources are aggregated when multiple offers are ...
[ "Accepts", "the", "given", "offers", "and", "performs", "a", "sequence", "of", "operations", "on", "those", "accepted", "offers", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L187-L201
[ "def", "accept", "(", "self", ",", "offer_ids", ",", "operations", ",", "filters", "=", "Filters", "(", ")", ")", ":", "logging", ".", "info", "(", "'Accepts offers {}'", ".", "format", "(", "offer_ids", ")", ")", "return", "self", ".", "driver", ".", ...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.acknowledge
Acknowledges the status update. This should only be called once the status update is processed durably by the scheduler. Not that explicit acknowledgements must be requested via the constructor argument, otherwise a call to this method will cause the driver to crash.
mentor/proxies/scheduler.py
def acknowledge(self, status): """Acknowledges the status update. This should only be called once the status update is processed durably by the scheduler. Not that explicit acknowledgements must be requested via the constructor argument, otherwise a call to this method will cau...
def acknowledge(self, status): """Acknowledges the status update. This should only be called once the status update is processed durably by the scheduler. Not that explicit acknowledgements must be requested via the constructor argument, otherwise a call to this method will cau...
[ "Acknowledges", "the", "status", "update", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L221-L232
[ "def", "acknowledge", "(", "self", ",", "status", ")", ":", "logging", ".", "info", "(", "'Acknowledges status update {}'", ".", "format", "(", "status", ")", ")", "return", "self", ".", "driver", ".", "acknowledgeStatusUpdate", "(", "encode", "(", "status", ...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
SchedulerDriverProxy.message
Sends a message from the framework to one of its executors. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion.
mentor/proxies/scheduler.py
def message(self, executor_id, slave_id, message): """Sends a message from the framework to one of its executors. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion. """ logging.info('Sends message `{}` to executor `{}` ...
def message(self, executor_id, slave_id, message): """Sends a message from the framework to one of its executors. These messages are best effort; do not expect a framework message to be retransmitted in any reliable fashion. """ logging.info('Sends message `{}` to executor `{}` ...
[ "Sends", "a", "message", "from", "the", "framework", "to", "one", "of", "its", "executors", "." ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/proxies/scheduler.py#L234-L244
[ "def", "message", "(", "self", ",", "executor_id", ",", "slave_id", ",", "message", ")", ":", "logging", ".", "info", "(", "'Sends message `{}` to executor `{}` on slave `{}`'", ".", "format", "(", "message", ",", "executor_id", ",", "slave_id", ")", ")", "retur...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
_connect_func
Handles GtkBuilder signal connect events
gi_composites.py
def _connect_func(builder, obj, signal_name, handler_name, connect_object, flags, cls): '''Handles GtkBuilder signal connect events''' if connect_object is None: extra = () else: extra = (connect_object,) # The handler name refers to an attribute on the template insta...
def _connect_func(builder, obj, signal_name, handler_name, connect_object, flags, cls): '''Handles GtkBuilder signal connect events''' if connect_object is None: extra = () else: extra = (connect_object,) # The handler name refers to an attribute on the template insta...
[ "Handles", "GtkBuilder", "signal", "connect", "events" ]
virtuald/pygi-composite-templates
python
https://github.com/virtuald/pygi-composite-templates/blob/a22be54ea95b8125b36deaa3ce7171e84158d486/gi_composites.py#L36-L63
[ "def", "_connect_func", "(", "builder", ",", "obj", ",", "signal_name", ",", "handler_name", ",", "connect_object", ",", "flags", ",", "cls", ")", ":", "if", "connect_object", "is", "None", ":", "extra", "=", "(", ")", "else", ":", "extra", "=", "(", "...
a22be54ea95b8125b36deaa3ce7171e84158d486
train
_register_template
Registers the template for the widget and hooks init_template
gi_composites.py
def _register_template(cls, template_bytes): '''Registers the template for the widget and hooks init_template''' # This implementation won't work if there are nested templates, but # we can't do that anyways due to PyGObject limitations so it's ok if not hasattr(cls, 'set_template'): raise Typ...
def _register_template(cls, template_bytes): '''Registers the template for the widget and hooks init_template''' # This implementation won't work if there are nested templates, but # we can't do that anyways due to PyGObject limitations so it's ok if not hasattr(cls, 'set_template'): raise Typ...
[ "Registers", "the", "template", "for", "the", "widget", "and", "hooks", "init_template" ]
virtuald/pygi-composite-templates
python
https://github.com/virtuald/pygi-composite-templates/blob/a22be54ea95b8125b36deaa3ce7171e84158d486/gi_composites.py#L66-L101
[ "def", "_register_template", "(", "cls", ",", "template_bytes", ")", ":", "# This implementation won't work if there are nested templates, but", "# we can't do that anyways due to PyGObject limitations so it's ok", "if", "not", "hasattr", "(", "cls", ",", "'set_template'", ")", "...
a22be54ea95b8125b36deaa3ce7171e84158d486
train
_init_template
This would be better as an override for Gtk.Widget
gi_composites.py
def _init_template(self, cls, base_init_template): '''This would be better as an override for Gtk.Widget''' # TODO: could disallow using a metaclass.. but this is good enough # .. if you disagree, feel free to fix it and issue a PR :) if self.__class__ is not cls: raise TypeError("Inheritance f...
def _init_template(self, cls, base_init_template): '''This would be better as an override for Gtk.Widget''' # TODO: could disallow using a metaclass.. but this is good enough # .. if you disagree, feel free to fix it and issue a PR :) if self.__class__ is not cls: raise TypeError("Inheritance f...
[ "This", "would", "be", "better", "as", "an", "override", "for", "Gtk", ".", "Widget" ]
virtuald/pygi-composite-templates
python
https://github.com/virtuald/pygi-composite-templates/blob/a22be54ea95b8125b36deaa3ce7171e84158d486/gi_composites.py#L104-L136
[ "def", "_init_template", "(", "self", ",", "cls", ",", "base_init_template", ")", ":", "# TODO: could disallow using a metaclass.. but this is good enough", "# .. if you disagree, feel free to fix it and issue a PR :)", "if", "self", ".", "__class__", "is", "not", "cls", ":", ...
a22be54ea95b8125b36deaa3ce7171e84158d486
train
extract_haml
babel translation token extract function for haml files
haml/util.py
def extract_haml(fileobj, keywords, comment_tags, options): """ babel translation token extract function for haml files """ import haml from mako import lexer, parsetree from mako.ext.babelplugin import extract_nodes encoding = options.get('input_encoding', options.get('encoding', None)) temp...
def extract_haml(fileobj, keywords, comment_tags, options): """ babel translation token extract function for haml files """ import haml from mako import lexer, parsetree from mako.ext.babelplugin import extract_nodes encoding = options.get('input_encoding', options.get('encoding', None)) temp...
[ "babel", "translation", "token", "extract", "function", "for", "haml", "files" ]
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/haml/util.py#L3-L13
[ "def", "extract_haml", "(", "fileobj", ",", "keywords", ",", "comment_tags", ",", "options", ")", ":", "import", "haml", "from", "mako", "import", "lexer", ",", "parsetree", "from", "mako", ".", "ext", ".", "babelplugin", "import", "extract_nodes", "encoding",...
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
PatternCoordinator._create_patterns
Return a list (of length patterns_per_label) of PatternGenerator instances. Should use pattern_type and pattern_parameters to create each pattern. properties is a dictionary, e.g. {'pattern_label': pattern_label}, which can be used to create PatternGenerators depending on the r...
imagen/patterncoordinator.py
def _create_patterns(self, properties=None): """ Return a list (of length patterns_per_label) of PatternGenerator instances. Should use pattern_type and pattern_parameters to create each pattern. properties is a dictionary, e.g. {'pattern_label': pattern_label}, which c...
def _create_patterns(self, properties=None): """ Return a list (of length patterns_per_label) of PatternGenerator instances. Should use pattern_type and pattern_parameters to create each pattern. properties is a dictionary, e.g. {'pattern_label': pattern_label}, which c...
[ "Return", "a", "list", "(", "of", "length", "patterns_per_label", ")", "of", "PatternGenerator", "instances", ".", "Should", "use", "pattern_type", "and", "pattern_parameters", "to", "create", "each", "pattern", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterncoordinator.py#L215-L226
[ "def", "_create_patterns", "(", "self", ",", "properties", "=", "None", ")", ":", "return", "[", "self", ".", "pattern_type", "(", "*", "*", "self", ".", "pattern_parameters", ")", "for", "i", "in", "range", "(", "self", ".", "patterns_per_label", ")", "...
53c5685c880f54b42795964d8db50b02e8590e88
train
add_rna_args
Extends an ArgumentParser instance with the following commandline arguments: --bam --min-reads --min-mapping-quality --use-duplicate-reads --drop-secondary-alignments
isovar/cli/rna_args.py
def add_rna_args( parser, min_mapping_quality_default=MIN_READ_MAPPING_QUALITY): """ Extends an ArgumentParser instance with the following commandline arguments: --bam --min-reads --min-mapping-quality --use-duplicate-reads --drop-secondary-alignments ...
def add_rna_args( parser, min_mapping_quality_default=MIN_READ_MAPPING_QUALITY): """ Extends an ArgumentParser instance with the following commandline arguments: --bam --min-reads --min-mapping-quality --use-duplicate-reads --drop-secondary-alignments ...
[ "Extends", "an", "ArgumentParser", "instance", "with", "the", "following", "commandline", "arguments", ":", "--", "bam", "--", "min", "-", "reads", "--", "min", "-", "mapping", "-", "quality", "--", "use", "-", "duplicate", "-", "reads", "--", "drop", "-",...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/cli/rna_args.py#L27-L59
[ "def", "add_rna_args", "(", "parser", ",", "min_mapping_quality_default", "=", "MIN_READ_MAPPING_QUALITY", ")", ":", "rna_group", "=", "parser", ".", "add_argument_group", "(", "\"RNA\"", ")", "rna_group", ".", "add_argument", "(", "\"--bam\"", ",", "required", "=",...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
make_variant_sequences_arg_parser
Parameters ---------- add_sequence_length_arg : bool If True then add the `--cdna-sequence-length` argument. This may be omitted if the cDNA sequence length is inferred from a protein length. **kwargs : dict Passed directly to argparse.ArgumentParser Creates argparse.ArgumentPa...
isovar/cli/variant_sequences_args.py
def make_variant_sequences_arg_parser(add_sequence_length_arg=False, **kwargs): """ Parameters ---------- add_sequence_length_arg : bool If True then add the `--cdna-sequence-length` argument. This may be omitted if the cDNA sequence length is inferred from a protein length. **kwarg...
def make_variant_sequences_arg_parser(add_sequence_length_arg=False, **kwargs): """ Parameters ---------- add_sequence_length_arg : bool If True then add the `--cdna-sequence-length` argument. This may be omitted if the cDNA sequence length is inferred from a protein length. **kwarg...
[ "Parameters", "----------", "add_sequence_length_arg", ":", "bool", "If", "True", "then", "add", "the", "--", "cdna", "-", "sequence", "-", "length", "argument", ".", "This", "may", "be", "omitted", "if", "the", "cDNA", "sequence", "length", "is", "inferred", ...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/cli/variant_sequences_args.py#L61-L83
[ "def", "make_variant_sequences_arg_parser", "(", "add_sequence_length_arg", "=", "False", ",", "*", "*", "kwargs", ")", ":", "parser", "=", "make_rna_reads_arg_parser", "(", "*", "*", "kwargs", ")", "add_variant_sequence_args", "(", "parser", "=", "parser", ",", "...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
iter_
A custom replacement for iter(), dispatching a few custom picklable iterators for known types.
picklable_itertools/iter_dispatch.py
def iter_(obj): """A custom replacement for iter(), dispatching a few custom picklable iterators for known types. """ if six.PY2: file_types = file, # noqa if six.PY3: file_types = io.IOBase, dict_items = {}.items().__class__ dict_values = {}.values().__class__ ...
def iter_(obj): """A custom replacement for iter(), dispatching a few custom picklable iterators for known types. """ if six.PY2: file_types = file, # noqa if six.PY3: file_types = io.IOBase, dict_items = {}.items().__class__ dict_values = {}.values().__class__ ...
[ "A", "custom", "replacement", "for", "iter", "()", "dispatching", "a", "few", "custom", "picklable", "iterators", "for", "known", "types", "." ]
mila-iqia/picklable-itertools
python
https://github.com/mila-iqia/picklable-itertools/blob/e00238867875df0258cf4f83f528d846e7c1afc4/picklable_itertools/iter_dispatch.py#L15-L41
[ "def", "iter_", "(", "obj", ")", ":", "if", "six", ".", "PY2", ":", "file_types", "=", "file", ",", "# noqa", "if", "six", ".", "PY3", ":", "file_types", "=", "io", ".", "IOBase", ",", "dict_items", "=", "{", "}", ".", "items", "(", ")", ".", "...
e00238867875df0258cf4f83f528d846e7c1afc4
train
get_single_allele_from_reads
Given a sequence of AlleleRead objects, which are expected to all have the same allele, return that allele.
isovar/read_helpers.py
def get_single_allele_from_reads(allele_reads): """ Given a sequence of AlleleRead objects, which are expected to all have the same allele, return that allele. """ allele_reads = list(allele_reads) if len(allele_reads) == 0: raise ValueError("Expected non-empty list of AlleleRead object...
def get_single_allele_from_reads(allele_reads): """ Given a sequence of AlleleRead objects, which are expected to all have the same allele, return that allele. """ allele_reads = list(allele_reads) if len(allele_reads) == 0: raise ValueError("Expected non-empty list of AlleleRead object...
[ "Given", "a", "sequence", "of", "AlleleRead", "objects", "which", "are", "expected", "to", "all", "have", "the", "same", "allele", "return", "that", "allele", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/read_helpers.py#L25-L39
[ "def", "get_single_allele_from_reads", "(", "allele_reads", ")", ":", "allele_reads", "=", "list", "(", "allele_reads", ")", "if", "len", "(", "allele_reads", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Expected non-empty list of AlleleRead objects\"", ")", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
group_unique_sequences
Given a list of AlleleRead objects, extracts all unique (prefix, allele, suffix) sequences and associate each with a list of reads that contained that sequence.
isovar/read_helpers.py
def group_unique_sequences( allele_reads, max_prefix_size=None, max_suffix_size=None): """ Given a list of AlleleRead objects, extracts all unique (prefix, allele, suffix) sequences and associate each with a list of reads that contained that sequence. """ groups = default...
def group_unique_sequences( allele_reads, max_prefix_size=None, max_suffix_size=None): """ Given a list of AlleleRead objects, extracts all unique (prefix, allele, suffix) sequences and associate each with a list of reads that contained that sequence. """ groups = default...
[ "Given", "a", "list", "of", "AlleleRead", "objects", "extracts", "all", "unique", "(", "prefix", "allele", "suffix", ")", "sequences", "and", "associate", "each", "with", "a", "list", "of", "reads", "that", "contained", "that", "sequence", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/read_helpers.py#L46-L66
[ "def", "group_unique_sequences", "(", "allele_reads", ",", "max_prefix_size", "=", "None", ",", "max_suffix_size", "=", "None", ")", ":", "groups", "=", "defaultdict", "(", "set", ")", "for", "r", "in", "allele_reads", ":", "prefix", "=", "r", ".", "prefix",...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
count_unique_sequences
Given a list of AlleleRead objects, extracts all unique (prefix, allele, suffix) sequences and associate each with the number of reads that contain that sequence.
isovar/read_helpers.py
def count_unique_sequences( allele_reads, max_prefix_size=None, max_suffix_size=None): """ Given a list of AlleleRead objects, extracts all unique (prefix, allele, suffix) sequences and associate each with the number of reads that contain that sequence. """ groups = group...
def count_unique_sequences( allele_reads, max_prefix_size=None, max_suffix_size=None): """ Given a list of AlleleRead objects, extracts all unique (prefix, allele, suffix) sequences and associate each with the number of reads that contain that sequence. """ groups = group...
[ "Given", "a", "list", "of", "AlleleRead", "objects", "extracts", "all", "unique", "(", "prefix", "allele", "suffix", ")", "sequences", "and", "associate", "each", "with", "the", "number", "of", "reads", "that", "contain", "that", "sequence", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/read_helpers.py#L69-L85
[ "def", "count_unique_sequences", "(", "allele_reads", ",", "max_prefix_size", "=", "None", ",", "max_suffix_size", "=", "None", ")", ":", "groups", "=", "group_unique_sequences", "(", "allele_reads", ",", "max_prefix_size", "=", "max_prefix_size", ",", "max_suffix_siz...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
AudioFolder.extract_specific_interval
Overload if special behaviour is required when a series ends.
imagen/audio.py
def extract_specific_interval(self, interval_start, interval_end): """ Overload if special behaviour is required when a series ends. """ interval_start = int(interval_start) interval_end = int(interval_end) if interval_start >= interval_end: raise ValueError...
def extract_specific_interval(self, interval_start, interval_end): """ Overload if special behaviour is required when a series ends. """ interval_start = int(interval_start) interval_end = int(interval_end) if interval_start >= interval_end: raise ValueError...
[ "Overload", "if", "special", "behaviour", "is", "required", "when", "a", "series", "ends", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/audio.py#L90-L140
[ "def", "extract_specific_interval", "(", "self", ",", "interval_start", ",", "interval_end", ")", ":", "interval_start", "=", "int", "(", "interval_start", ")", "interval_end", "=", "int", "(", "interval_end", ")", "if", "interval_start", ">=", "interval_end", ":"...
53c5685c880f54b42795964d8db50b02e8590e88
train
LyonsCochlearModel._get_row_amplitudes
Perform a real Discrete Fourier Transform (DFT; implemented using a Fast Fourier Transform algorithm, FFT) of the current sample from the signal multiplied by the smoothing window. See numpy.rfft for information about the Fourier transform.
imagen/audio.py
def _get_row_amplitudes(self): """ Perform a real Discrete Fourier Transform (DFT; implemented using a Fast Fourier Transform algorithm, FFT) of the current sample from the signal multiplied by the smoothing window. See numpy.rfft for information about the Fourier transform. ...
def _get_row_amplitudes(self): """ Perform a real Discrete Fourier Transform (DFT; implemented using a Fast Fourier Transform algorithm, FFT) of the current sample from the signal multiplied by the smoothing window. See numpy.rfft for information about the Fourier transform. ...
[ "Perform", "a", "real", "Discrete", "Fourier", "Transform", "(", "DFT", ";", "implemented", "using", "a", "Fast", "Fourier", "Transform", "algorithm", "FFT", ")", "of", "the", "current", "sample", "from", "the", "signal", "multiplied", "by", "the", "smoothing"...
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/audio.py#L463-L492
[ "def", "_get_row_amplitudes", "(", "self", ")", ":", "sample_rate", "=", "self", ".", "signal", ".", "sample_rate", "# A signal window *must* span one sample rate, irrespective of interval length.", "signal_window", "=", "tile", "(", "self", ".", "signal", "(", ")", ","...
53c5685c880f54b42795964d8db50b02e8590e88
train
Base.iter_all_children
Return an iterator that yields every node which is a child of this one. This includes inline children, and control structure `else` clauses.
haml/nodes.py
def iter_all_children(self): '''Return an iterator that yields every node which is a child of this one. This includes inline children, and control structure `else` clauses. ''' if self.inline_child: yield self.inline_child for x in self.children: ...
def iter_all_children(self): '''Return an iterator that yields every node which is a child of this one. This includes inline children, and control structure `else` clauses. ''' if self.inline_child: yield self.inline_child for x in self.children: ...
[ "Return", "an", "iterator", "that", "yields", "every", "node", "which", "is", "a", "child", "of", "this", "one", "." ]
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/haml/nodes.py#L18-L27
[ "def", "iter_all_children", "(", "self", ")", ":", "if", "self", ".", "inline_child", ":", "yield", "self", ".", "inline_child", "for", "x", "in", "self", ".", "children", ":", "yield", "x" ]
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
TransferFn.initialize
Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordin...
imagen/transferfn/__init__.py
def initialize(self, **kwargs): """ Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfe...
def initialize(self, **kwargs): """ Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfe...
[ "Transfer", "functions", "may", "need", "additional", "information", "before", "the", "supplied", "numpy", "array", "can", "be", "modified", "in", "place", ".", "For", "instance", "transfer", "functions", "may", "have", "state", "which", "needs", "to", "be", "...
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/transferfn/__init__.py#L31-L42
[ "def", "initialize", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "set", "(", "kwargs", ".", "keys", "(", ")", ")", ".", "issuperset", "(", "self", ".", "init_keys", ")", ":", "raise", "Exception", "(", "\"TransferFn needs to be initializ...
53c5685c880f54b42795964d8db50b02e8590e88
train
TransferFnWithState.override_plasticity_state
Temporarily disable plasticity of internal state. This function should be implemented by all subclasses so that after a call, the output should always be the same for any given input pattern, and no call should have any effect that persists after restore_plasticity_state() is called. ...
imagen/transferfn/__init__.py
def override_plasticity_state(self, new_plasticity_state): """ Temporarily disable plasticity of internal state. This function should be implemented by all subclasses so that after a call, the output should always be the same for any given input pattern, and no call should have ...
def override_plasticity_state(self, new_plasticity_state): """ Temporarily disable plasticity of internal state. This function should be implemented by all subclasses so that after a call, the output should always be the same for any given input pattern, and no call should have ...
[ "Temporarily", "disable", "plasticity", "of", "internal", "state", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/transferfn/__init__.py#L70-L85
[ "def", "override_plasticity_state", "(", "self", ",", "new_plasticity_state", ")", ":", "self", ".", "_plasticity_setting_stack", ".", "append", "(", "self", ".", "plastic", ")", "self", ".", "plastic", "=", "new_plasticity_state" ]
53c5685c880f54b42795964d8db50b02e8590e88
train
setup
Setup integration Register plug-ins and integrate into the host Arguments: console (bool): DEPRECATED port (int, optional): DEPRECATED
pyblish_houdini/lib.py
def setup(console=False, port=None): """Setup integration Register plug-ins and integrate into the host Arguments: console (bool): DEPRECATED port (int, optional): DEPRECATED """ if self._has_been_setup: teardown() register_plugins() register_host() self._ha...
def setup(console=False, port=None): """Setup integration Register plug-ins and integrate into the host Arguments: console (bool): DEPRECATED port (int, optional): DEPRECATED """ if self._has_been_setup: teardown() register_plugins() register_host() self._ha...
[ "Setup", "integration" ]
pyblish/pyblish-houdini
python
https://github.com/pyblish/pyblish-houdini/blob/661b08696f04b4c5d8b03aa0c75cba3ca72f1e8d/pyblish_houdini/lib.py#L20-L38
[ "def", "setup", "(", "console", "=", "False", ",", "port", "=", "None", ")", ":", "if", "self", ".", "_has_been_setup", ":", "teardown", "(", ")", "register_plugins", "(", ")", "register_host", "(", ")", "self", ".", "_has_been_setup", "=", "True", "prin...
661b08696f04b4c5d8b03aa0c75cba3ca72f1e8d
train
register_host
Register supported hosts
pyblish_houdini/lib.py
def register_host(): """Register supported hosts""" pyblish.api.register_host("hython") pyblish.api.register_host("hpython") pyblish.api.register_host("houdini")
def register_host(): """Register supported hosts""" pyblish.api.register_host("hython") pyblish.api.register_host("hpython") pyblish.api.register_host("houdini")
[ "Register", "supported", "hosts" ]
pyblish/pyblish-houdini
python
https://github.com/pyblish/pyblish-houdini/blob/661b08696f04b4c5d8b03aa0c75cba3ca72f1e8d/pyblish_houdini/lib.py#L80-L84
[ "def", "register_host", "(", ")", ":", "pyblish", ".", "api", ".", "register_host", "(", "\"hython\"", ")", "pyblish", ".", "api", ".", "register_host", "(", "\"hpython\"", ")", "pyblish", ".", "api", ".", "register_host", "(", "\"houdini\"", ")" ]
661b08696f04b4c5d8b03aa0c75cba3ca72f1e8d
train
maintained_selection
Maintain selection during context Example: >>> with maintained_selection(): ... # Modify selection ... node.setSelected(on=False, clear_all_selected=True) >>> # Selection restored
pyblish_houdini/lib.py
def maintained_selection(): """Maintain selection during context Example: >>> with maintained_selection(): ... # Modify selection ... node.setSelected(on=False, clear_all_selected=True) >>> # Selection restored """ previous_selection = hou.selectedNodes() t...
def maintained_selection(): """Maintain selection during context Example: >>> with maintained_selection(): ... # Modify selection ... node.setSelected(on=False, clear_all_selected=True) >>> # Selection restored """ previous_selection = hou.selectedNodes() t...
[ "Maintain", "selection", "during", "context" ]
pyblish/pyblish-houdini
python
https://github.com/pyblish/pyblish-houdini/blob/661b08696f04b4c5d8b03aa0c75cba3ca72f1e8d/pyblish_houdini/lib.py#L104-L124
[ "def", "maintained_selection", "(", ")", ":", "previous_selection", "=", "hou", ".", "selectedNodes", "(", ")", "try", ":", "yield", "finally", ":", "if", "previous_selection", ":", "for", "node", "in", "previous_selection", ":", "node", ".", "setSelected", "(...
661b08696f04b4c5d8b03aa0c75cba3ca72f1e8d
train
execute_transaction
Execute several statements in single DB transaction.
postpy/sql.py
def execute_transaction(conn, statements: Iterable): """Execute several statements in single DB transaction.""" with conn: with conn.cursor() as cursor: for statement in statements: cursor.execute(statement) conn.commit()
def execute_transaction(conn, statements: Iterable): """Execute several statements in single DB transaction.""" with conn: with conn.cursor() as cursor: for statement in statements: cursor.execute(statement) conn.commit()
[ "Execute", "several", "statements", "in", "single", "DB", "transaction", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L10-L17
[ "def", "execute_transaction", "(", "conn", ",", "statements", ":", "Iterable", ")", ":", "with", "conn", ":", "with", "conn", ".", "cursor", "(", ")", "as", "cursor", ":", "for", "statement", "in", "statements", ":", "cursor", ".", "execute", "(", "state...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
execute_transactions
Execute several statements each as a single DB transaction.
postpy/sql.py
def execute_transactions(conn, statements: Iterable): """Execute several statements each as a single DB transaction.""" with conn.cursor() as cursor: for statement in statements: try: cursor.execute(statement) conn.commit() except psycopg2.Program...
def execute_transactions(conn, statements: Iterable): """Execute several statements each as a single DB transaction.""" with conn.cursor() as cursor: for statement in statements: try: cursor.execute(statement) conn.commit() except psycopg2.Program...
[ "Execute", "several", "statements", "each", "as", "a", "single", "DB", "transaction", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L20-L29
[ "def", "execute_transactions", "(", "conn", ",", "statements", ":", "Iterable", ")", ":", "with", "conn", ".", "cursor", "(", ")", "as", "cursor", ":", "for", "statement", "in", "statements", ":", "try", ":", "cursor", ".", "execute", "(", "statement", "...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
execute_closing_transaction
Open a connection, commit a transaction, and close it.
postpy/sql.py
def execute_closing_transaction(statements: Iterable): """Open a connection, commit a transaction, and close it.""" with closing(connect()) as conn: with conn.cursor() as cursor: for statement in statements: cursor.execute(statement)
def execute_closing_transaction(statements: Iterable): """Open a connection, commit a transaction, and close it.""" with closing(connect()) as conn: with conn.cursor() as cursor: for statement in statements: cursor.execute(statement)
[ "Open", "a", "connection", "commit", "a", "transaction", "and", "close", "it", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L32-L38
[ "def", "execute_closing_transaction", "(", "statements", ":", "Iterable", ")", ":", "with", "closing", "(", "connect", "(", ")", ")", "as", "conn", ":", "with", "conn", ".", "cursor", "(", ")", "as", "cursor", ":", "for", "statement", "in", "statements", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
select
Return a select statement's results as a namedtuple. Parameters ---------- conn : database connection query : select query string params : query parameters. name : server side cursor name. defaults to client side. itersize : number of records fetched by server.
postpy/sql.py
def select(conn, query: str, params=None, name=None, itersize=5000): """Return a select statement's results as a namedtuple. Parameters ---------- conn : database connection query : select query string params : query parameters. name : server side cursor name. defaults to client side. i...
def select(conn, query: str, params=None, name=None, itersize=5000): """Return a select statement's results as a namedtuple. Parameters ---------- conn : database connection query : select query string params : query parameters. name : server side cursor name. defaults to client side. i...
[ "Return", "a", "select", "statement", "s", "results", "as", "a", "namedtuple", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L41-L58
[ "def", "select", "(", "conn", ",", "query", ":", "str", ",", "params", "=", "None", ",", "name", "=", "None", ",", "itersize", "=", "5000", ")", ":", "with", "conn", ".", "cursor", "(", "name", ",", "cursor_factory", "=", "NamedTupleCursor", ")", "as...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
select_dict
Return a select statement's results as dictionary. Parameters ---------- conn : database connection query : select query string params : query parameters. name : server side cursor name. defaults to client side. itersize : number of records fetched by server.
postpy/sql.py
def select_dict(conn, query: str, params=None, name=None, itersize=5000): """Return a select statement's results as dictionary. Parameters ---------- conn : database connection query : select query string params : query parameters. name : server side cursor name. defaults to client side. ...
def select_dict(conn, query: str, params=None, name=None, itersize=5000): """Return a select statement's results as dictionary. Parameters ---------- conn : database connection query : select query string params : query parameters. name : server side cursor name. defaults to client side. ...
[ "Return", "a", "select", "statement", "s", "results", "as", "dictionary", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L61-L78
[ "def", "select_dict", "(", "conn", ",", "query", ":", "str", ",", "params", "=", "None", ",", "name", "=", "None", ",", "itersize", "=", "5000", ")", ":", "with", "conn", ".", "cursor", "(", "name", ",", "cursor_factory", "=", "RealDictCursor", ")", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
select_each
Run select query for each parameter set in single transaction.
postpy/sql.py
def select_each(conn, query: str, parameter_groups, name=None): """Run select query for each parameter set in single transaction.""" with conn: with conn.cursor(name=name) as cursor: for parameters in parameter_groups: cursor.execute(query, parameters) yield ...
def select_each(conn, query: str, parameter_groups, name=None): """Run select query for each parameter set in single transaction.""" with conn: with conn.cursor(name=name) as cursor: for parameters in parameter_groups: cursor.execute(query, parameters) yield ...
[ "Run", "select", "query", "for", "each", "parameter", "set", "in", "single", "transaction", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L81-L88
[ "def", "select_each", "(", "conn", ",", "query", ":", "str", ",", "parameter_groups", ",", "name", "=", "None", ")", ":", "with", "conn", ":", "with", "conn", ".", "cursor", "(", "name", "=", "name", ")", "as", "cursor", ":", "for", "parameters", "in...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
query_columns
Lightweight query to retrieve column list of select query. Notes ----- Strongly urged to specify a cursor name for performance.
postpy/sql.py
def query_columns(conn, query, name=None): """Lightweight query to retrieve column list of select query. Notes ----- Strongly urged to specify a cursor name for performance. """ with conn.cursor(name) as cursor: cursor.itersize = 1 cursor.execute(query) cursor.fetchmany...
def query_columns(conn, query, name=None): """Lightweight query to retrieve column list of select query. Notes ----- Strongly urged to specify a cursor name for performance. """ with conn.cursor(name) as cursor: cursor.itersize = 1 cursor.execute(query) cursor.fetchmany...
[ "Lightweight", "query", "to", "retrieve", "column", "list", "of", "select", "query", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/sql.py#L91-L105
[ "def", "query_columns", "(", "conn", ",", "query", ",", "name", "=", "None", ")", ":", "with", "conn", ".", "cursor", "(", "name", ")", "as", "cursor", ":", "cursor", ".", "itersize", "=", "1", "cursor", ".", "execute", "(", "query", ")", "cursor", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
ReferenceCodingSequenceKey.from_variant_and_transcript_and_sequence_key
Assuming that the transcript has a coding sequence, take a ReferenceSequenceKey (region of the transcript around the variant) and return a ReferenceCodingSequenceKey (or None).
isovar/reference_coding_sequence_key.py
def from_variant_and_transcript_and_sequence_key( cls, variant, transcript, sequence_key): """ Assuming that the transcript has a coding sequence, take a ReferenceSequenceKey (region of the transcript around the variant) and return a ReferenceCodingSequenceKey (or None). ...
def from_variant_and_transcript_and_sequence_key( cls, variant, transcript, sequence_key): """ Assuming that the transcript has a coding sequence, take a ReferenceSequenceKey (region of the transcript around the variant) and return a ReferenceCodingSequenceKey (or None). ...
[ "Assuming", "that", "the", "transcript", "has", "a", "coding", "sequence", "take", "a", "ReferenceSequenceKey", "(", "region", "of", "the", "transcript", "around", "the", "variant", ")", "and", "return", "a", "ReferenceCodingSequenceKey", "(", "or", "None", ")",...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_coding_sequence_key.py#L72-L147
[ "def", "from_variant_and_transcript_and_sequence_key", "(", "cls", ",", "variant", ",", "transcript", ",", "sequence_key", ")", ":", "# get the interbase range of offsets which capture all reference", "# bases modified by the variant", "variant_start_offset", ",", "variant_end_offset...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
ReferenceCodingSequenceKey.from_variant_and_transcript
Extracts the reference sequence around a variant locus on a particular transcript and determines the reading frame at the start of that sequence context. Parameters ---------- variant : varcode.Variant transcript : pyensembl.Transcript context_size : int ...
isovar/reference_coding_sequence_key.py
def from_variant_and_transcript( cls, variant, transcript, context_size): """ Extracts the reference sequence around a variant locus on a particular transcript and determines the reading frame at the start of that sequence context. ...
def from_variant_and_transcript( cls, variant, transcript, context_size): """ Extracts the reference sequence around a variant locus on a particular transcript and determines the reading frame at the start of that sequence context. ...
[ "Extracts", "the", "reference", "sequence", "around", "a", "variant", "locus", "on", "a", "particular", "transcript", "and", "determines", "the", "reading", "frame", "at", "the", "start", "of", "that", "sequence", "context", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_coding_sequence_key.py#L150-L207
[ "def", "from_variant_and_transcript", "(", "cls", ",", "variant", ",", "transcript", ",", "context_size", ")", ":", "if", "not", "transcript", ".", "contains_start_codon", ":", "logger", ".", "info", "(", "\"Expected transcript %s for variant %s to have start codon\"", ...
b39b684920e3f6b344851d6598a1a1c67bce913b