repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
moralrecordings/mrcrowbar
mrcrowbar/refs.py
Ref.get
def get( self, instance, **kwargs ): """Return an attribute from an object using the Ref path. instance The object instance to traverse. """ target = instance for attr in self._path: target = getattr( target, attr ) return target
python
def get( self, instance, **kwargs ): """Return an attribute from an object using the Ref path. instance The object instance to traverse. """ target = instance for attr in self._path: target = getattr( target, attr ) return target
[ "def", "get", "(", "self", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "target", "=", "instance", "for", "attr", "in", "self", ".", "_path", ":", "target", "=", "getattr", "(", "target", ",", "attr", ")", "return", "target" ]
Return an attribute from an object using the Ref path. instance The object instance to traverse.
[ "Return", "an", "attribute", "from", "an", "object", "using", "the", "Ref", "path", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L33-L42
train
Return an attribute from an object using the Ref path.
moralrecordings/mrcrowbar
mrcrowbar/refs.py
Ref.set
def set( self, instance, value, **kwargs ): """Set an attribute on an object using the Ref path. instance The object instance to traverse. value The value to set. Throws AttributeError if allow_write is False. """ if not self._allow_write: ...
python
def set( self, instance, value, **kwargs ): """Set an attribute on an object using the Ref path. instance The object instance to traverse. value The value to set. Throws AttributeError if allow_write is False. """ if not self._allow_write: ...
[ "def", "set", "(", "self", ",", "instance", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_allow_write", ":", "raise", "AttributeError", "(", "\"can't set Ref directly, allow_write is disabled\"", ")", "target", "=", "instance", "...
Set an attribute on an object using the Ref path. instance The object instance to traverse. value The value to set. Throws AttributeError if allow_write is False.
[ "Set", "an", "attribute", "on", "an", "object", "using", "the", "Ref", "path", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L44-L61
train
Set an attribute on an object using the Ref path.
ProjetPP/PPP-libmodule-Python
ppp_libmodule/shortcuts.py
traverse_until_fixpoint
def traverse_until_fixpoint(predicate, tree): """Traverses the tree again and again until it is not modified.""" old_tree = None tree = simplify(tree) while tree and old_tree != tree: old_tree = tree tree = tree.traverse(predicate) if not tree: return None tre...
python
def traverse_until_fixpoint(predicate, tree): """Traverses the tree again and again until it is not modified.""" old_tree = None tree = simplify(tree) while tree and old_tree != tree: old_tree = tree tree = tree.traverse(predicate) if not tree: return None tre...
[ "def", "traverse_until_fixpoint", "(", "predicate", ",", "tree", ")", ":", "old_tree", "=", "None", "tree", "=", "simplify", "(", "tree", ")", "while", "tree", "and", "old_tree", "!=", "tree", ":", "old_tree", "=", "tree", "tree", "=", "tree", ".", "trav...
Traverses the tree again and again until it is not modified.
[ "Traverses", "the", "tree", "again", "and", "again", "until", "it", "is", "not", "modified", "." ]
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/shortcuts.py#L6-L16
train
Traverses the tree until the tree is not modified.
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.runner
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Initialise the GenObject for sample in self.runmetadata.samples: setattr(sample, self.analysistype, GenObject()) ...
python
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Initialise the GenObject for sample in self.runmetadata.samples: setattr(sample, self.analysistype, GenObject()) ...
[ "def", "runner", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "# Initialise the GenObject", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ...
Run the necessary methods in the correct order
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L19-L39
train
Run the necessary methods in the correct order for the current runmetadata object
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.fasta
def fasta(self): """ Create FASTA files of the PointFinder results to be fed into PointFinder """ logging.info('Extracting FASTA sequences matching PointFinder database') for sample in self.runmetadata.samples: # Ensure that there are sequence data to extract from the...
python
def fasta(self): """ Create FASTA files of the PointFinder results to be fed into PointFinder """ logging.info('Extracting FASTA sequences matching PointFinder database') for sample in self.runmetadata.samples: # Ensure that there are sequence data to extract from the...
[ "def", "fasta", "(", "self", ")", ":", "logging", ".", "info", "(", "'Extracting FASTA sequences matching PointFinder database'", ")", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "# Ensure that there are sequence data to extract from the GenObjec...
Create FASTA files of the PointFinder results to be fed into PointFinder
[ "Create", "FASTA", "files", "of", "the", "PointFinder", "results", "to", "be", "fed", "into", "PointFinder" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L41-L64
train
Create the FASTA files of the PointFinder results that are fed into PointFinder
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.run_pointfinder
def run_pointfinder(self): """ Run PointFinder on the FASTA sequences extracted from the raw reads """ logging.info('Running PointFinder on FASTA files') for i in range(len(self.runmetadata.samples)): # Start threads threads = Thread(target=self.pointfinde...
python
def run_pointfinder(self): """ Run PointFinder on the FASTA sequences extracted from the raw reads """ logging.info('Running PointFinder on FASTA files') for i in range(len(self.runmetadata.samples)): # Start threads threads = Thread(target=self.pointfinde...
[ "def", "run_pointfinder", "(", "self", ")", ":", "logging", ".", "info", "(", "'Running PointFinder on FASTA files'", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "runmetadata", ".", "samples", ")", ")", ":", "# Start threads", "threads", "=...
Run PointFinder on the FASTA sequences extracted from the raw reads
[ "Run", "PointFinder", "on", "the", "FASTA", "sequences", "extracted", "from", "the", "raw", "reads" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L66-L99
train
Run PointFinder on the FASTA files extracted from the raw reads and store the results in the output directory.
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.populate_summary_dict
def populate_summary_dict(self, genus=str(), key=str()): """ :param genus: Non-supported genus to be added to the dictionary :param key: section of dictionary to be populated. Supported keys are: prediction, table, and results Populate self.summary_dict as required. If the genus is not p...
python
def populate_summary_dict(self, genus=str(), key=str()): """ :param genus: Non-supported genus to be added to the dictionary :param key: section of dictionary to be populated. Supported keys are: prediction, table, and results Populate self.summary_dict as required. If the genus is not p...
[ "def", "populate_summary_dict", "(", "self", ",", "genus", "=", "str", "(", ")", ",", "key", "=", "str", "(", ")", ")", ":", "# If the genus is not provided, generate the generic dictionary", "if", "not", "genus", ":", "# Populate the summary dict", "self", ".", "...
:param genus: Non-supported genus to be added to the dictionary :param key: section of dictionary to be populated. Supported keys are: prediction, table, and results Populate self.summary_dict as required. If the genus is not provided, populate the dictionary for Salmonella Escherichia and Campy...
[ ":", "param", "genus", ":", "Non", "-", "supported", "genus", "to", "be", "added", "to", "the", "dictionary", ":", "param", "key", ":", "section", "of", "dictionary", "to", "be", "populated", ".", "Supported", "keys", "are", ":", "prediction", "table", "...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L107-L213
train
Populate the summary dictionary for the specified genus.
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.parse_pointfinder
def parse_pointfinder(self): """ Create summary reports for the PointFinder outputs """ # Create the nested dictionary that stores the necessary values for creating summary reports self.populate_summary_dict() # Clear out any previous reports for organism in self....
python
def parse_pointfinder(self): """ Create summary reports for the PointFinder outputs """ # Create the nested dictionary that stores the necessary values for creating summary reports self.populate_summary_dict() # Clear out any previous reports for organism in self....
[ "def", "parse_pointfinder", "(", "self", ")", ":", "# Create the nested dictionary that stores the necessary values for creating summary reports", "self", ".", "populate_summary_dict", "(", ")", "# Clear out any previous reports", "for", "organism", "in", "self", ".", "summary_di...
Create summary reports for the PointFinder outputs
[ "Create", "summary", "reports", "for", "the", "PointFinder", "outputs" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L215-L275
train
Parse the PointFinder output files and create the nested dictionary that stores the necessary values for creating the summary reports for the PointFinder outputs
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.write_report
def write_report(summary_dict, seqid, genus, key): """ Parse the PointFinder outputs, and write the summary report for the current analysis type :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :...
python
def write_report(summary_dict, seqid, genus, key): """ Parse the PointFinder outputs, and write the summary report for the current analysis type :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :...
[ "def", "write_report", "(", "summary_dict", ",", "seqid", ",", "genus", ",", "key", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "genus", "]", "[", "key", ...
Parse the PointFinder outputs, and write the summary report for the current analysis type :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculated genus of current isolate :param ke...
[ "Parse", "the", "PointFinder", "outputs", "and", "write", "the", "summary", "report", "for", "the", "current", "analysis", "type", ":", "param", "summary_dict", ":", "nested", "dictionary", "containing", "data", "such", "as", "header", "strings", "and", "paths",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L278-L342
train
Parse the PointFinder outputs and write the summary report for the current analysis type and the current result type.
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSippr.write_table_report
def write_table_report(summary_dict, seqid, genus): """ Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculat...
python
def write_table_report(summary_dict, seqid, genus): """ Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculat...
[ "def", "write_table_report", "(", "summary_dict", ",", "seqid", ",", "genus", ")", ":", "# Set the header string if the summary report doesn't already exist", "if", "not", "os", ".", "path", ".", "isfile", "(", "summary_dict", "[", "genus", "]", "[", "'table'", "]",...
Parse the PointFinder table output, and write a summary report :param summary_dict: nested dictionary containing data such as header strings, and paths to reports :param seqid: name of the strain, :param genus: MASH-calculated genus of current isolate
[ "Parse", "the", "PointFinder", "table", "output", "and", "write", "a", "summary", "report", ":", "param", "summary_dict", ":", "nested", "dictionary", "containing", "data", "such", "as", "header", "strings", "and", "paths", "to", "reports", ":", "param", "seqi...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L345-L403
train
Parse the PointFinder table output and write a summary report
OLC-Bioinformatics/sipprverse
pointsippr/pointsippr.py
PointSipping.targets
def targets(self): """ Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects """ logging.info('Performing analysis with {} targets folder'.format(self.analysistype)) for sample in self.runmetadata: ...
python
def targets(self): """ Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects """ logging.info('Performing analysis with {} targets folder'.format(self.analysistype)) for sample in self.runmetadata: ...
[ "def", "targets", "(", "self", ")", ":", "logging", ".", "info", "(", "'Performing analysis with {} targets folder'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "runmetadata", ":", "sample", "[", "self", "....
Search the targets folder for FASTA files, create the multi-FASTA file of all targets if necessary, and populate objects
[ "Search", "the", "targets", "folder", "for", "FASTA", "files", "create", "the", "multi", "-", "FASTA", "file", "of", "all", "targets", "if", "necessary", "and", "populate", "objects" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L426-L467
train
Create the multi - FASTA files of all targets if necessary and populate objects
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.strains
def strains(self): """ Create a dictionary of SEQID: OLNID from the supplied """ with open(os.path.join(self.path, 'strains.csv')) as strains: next(strains) for line in strains: oln, seqid = line.split(',') self.straindict[oln] = se...
python
def strains(self): """ Create a dictionary of SEQID: OLNID from the supplied """ with open(os.path.join(self.path, 'strains.csv')) as strains: next(strains) for line in strains: oln, seqid = line.split(',') self.straindict[oln] = se...
[ "def", "strains", "(", "self", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'strains.csv'", ")", ")", "as", "strains", ":", "next", "(", "strains", ")", "for", "line", "in", "strains", ":", "oln", ...
Create a dictionary of SEQID: OLNID from the supplied
[ "Create", "a", "dictionary", "of", "SEQID", ":", "OLNID", "from", "the", "supplied" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L33-L45
train
Create a dictionary of SEQID - > OLNID
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.write_json
def write_json(metadata): """ Write the metadata object to file :param metadata: Metadata object """ # Open the metadata file to write with open(metadata.jsonfile, 'w') as metadatafile: # Write the json dump of the object dump to the metadata file ...
python
def write_json(metadata): """ Write the metadata object to file :param metadata: Metadata object """ # Open the metadata file to write with open(metadata.jsonfile, 'w') as metadatafile: # Write the json dump of the object dump to the metadata file ...
[ "def", "write_json", "(", "metadata", ")", ":", "# Open the metadata file to write", "with", "open", "(", "metadata", ".", "jsonfile", ",", "'w'", ")", "as", "metadatafile", ":", "# Write the json dump of the object dump to the metadata file", "json", ".", "dump", "(", ...
Write the metadata object to file :param metadata: Metadata object
[ "Write", "the", "metadata", "object", "to", "file", ":", "param", "metadata", ":", "Metadata", "object" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L92-L100
train
Write the metadata object to the metadata. jsonfile
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.read_json
def read_json(json_metadata): """ Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object """ # Load the metadata object from the file with open(json_metadata) as metadatareport: ...
python
def read_json(json_metadata): """ Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object """ # Load the metadata object from the file with open(json_metadata) as metadatareport: ...
[ "def", "read_json", "(", "json_metadata", ")", ":", "# Load the metadata object from the file", "with", "open", "(", "json_metadata", ")", "as", "metadatareport", ":", "jsondata", "=", "json", ".", "load", "(", "metadatareport", ")", "# Create the metadata objects", "...
Read the metadata object from file :param json_metadata: Path and file name of JSON-formatted metadata object file :return: metadata object
[ "Read", "the", "metadata", "object", "from", "file", ":", "param", "json_metadata", ":", "Path", "and", "file", "name", "of", "JSON", "-", "formatted", "metadata", "object", "file", ":", "return", ":", "metadata", "object" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L103-L120
train
Read the metadata object from a JSON - formatted metadata object file.
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.assembly_length
def assembly_length(self): """ Use SeqIO.parse to extract the total number of bases in each assembly file """ for sample in self.metadata: # Only determine the assembly length if is has not been previously calculated if not GenObject.isattr(sample, 'assembly_lengt...
python
def assembly_length(self): """ Use SeqIO.parse to extract the total number of bases in each assembly file """ for sample in self.metadata: # Only determine the assembly length if is has not been previously calculated if not GenObject.isattr(sample, 'assembly_lengt...
[ "def", "assembly_length", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "metadata", ":", "# Only determine the assembly length if is has not been previously calculated", "if", "not", "GenObject", ".", "isattr", "(", "sample", ",", "'assembly_length'", ")", ...
Use SeqIO.parse to extract the total number of bases in each assembly file
[ "Use", "SeqIO", ".", "parse", "to", "extract", "the", "total", "number", "of", "bases", "in", "each", "assembly", "file" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L122-L135
train
Determine the total number of bases in each assembly file in each assembly file and update the assembly_length attribute with the total number of bases in each assembly file in each assembly file.
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.simulate_reads
def simulate_reads(self): """ Use the PacBio assembly FASTA files to generate simulated reads of appropriate forward and reverse lengths at different depths of sequencing using randomreads.sh from the bbtools suite """ logging.info('Read simulation') for sample in self.me...
python
def simulate_reads(self): """ Use the PacBio assembly FASTA files to generate simulated reads of appropriate forward and reverse lengths at different depths of sequencing using randomreads.sh from the bbtools suite """ logging.info('Read simulation') for sample in self.me...
[ "def", "simulate_reads", "(", "self", ")", ":", "logging", ".", "info", "(", "'Read simulation'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Create the simulated_reads GenObject", "sample", ".", "simulated_reads", "=", "GenObject", "(", ")", "#...
Use the PacBio assembly FASTA files to generate simulated reads of appropriate forward and reverse lengths at different depths of sequencing using randomreads.sh from the bbtools suite
[ "Use", "the", "PacBio", "assembly", "FASTA", "files", "to", "generate", "simulated", "reads", "of", "appropriate", "forward", "and", "reverse", "lengths", "at", "different", "depths", "of", "sequencing", "using", "randomreads", ".", "sh", "from", "the", "bbtools...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L137-L295
train
Create the simulated reads file for each sample in the metadata and generate the corresponding forward and reverse lengths for each depth of sequencing.
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.read_length_adjust
def read_length_adjust(self, analysistype): """ Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled' """ logging.info('Trimming {at} reads'.format(at=analysistype)) for sample in self.me...
python
def read_length_adjust(self, analysistype): """ Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled' """ logging.info('Trimming {at} reads'.format(at=analysistype)) for sample in self.me...
[ "def", "read_length_adjust", "(", "self", ",", "analysistype", ")", ":", "logging", ".", "info", "(", "'Trimming {at} reads'", ".", "format", "(", "at", "=", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Iterate through all ...
Trim the reads to the correct length using reformat.sh :param analysistype: current analysis type. Will be either 'simulated' or 'sampled'
[ "Trim", "the", "reads", "to", "the", "correct", "length", "using", "reformat", ".", "sh", ":", "param", "analysistype", ":", "current", "analysis", "type", ".", "Will", "be", "either", "simulated", "or", "sampled" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L297-L378
train
This method will trim the reads to the correct length using reformat. sh
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.read_quality_trim
def read_quality_trim(self): """ Perform quality trim, and toss reads below appropriate thresholds """ logging.info('Quality trim') for sample in self.metadata: sample.sampled_reads = GenObject() sample.sampled_reads.outputdir = os.path.join(sample.outputd...
python
def read_quality_trim(self): """ Perform quality trim, and toss reads below appropriate thresholds """ logging.info('Quality trim') for sample in self.metadata: sample.sampled_reads = GenObject() sample.sampled_reads.outputdir = os.path.join(sample.outputd...
[ "def", "read_quality_trim", "(", "self", ")", ":", "logging", ".", "info", "(", "'Quality trim'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "sample", ".", "sampled_reads", "=", "GenObject", "(", ")", "sample", ".", "sampled_reads", ".", "ou...
Perform quality trim, and toss reads below appropriate thresholds
[ "Perform", "quality", "trim", "and", "toss", "reads", "below", "appropriate", "thresholds" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L380-L470
train
Perform quality trim and toss reads below appropriate thresholds
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.sample_reads
def sample_reads(self): """ For each PacBio assembly, sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths using reformat.sh from the bbtools suite """ logging.info('Read sampling') for sample in self.metadata: ...
python
def sample_reads(self): """ For each PacBio assembly, sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths using reformat.sh from the bbtools suite """ logging.info('Read sampling') for sample in self.metadata: ...
[ "def", "sample_reads", "(", "self", ")", ":", "logging", ".", "info", "(", "'Read sampling'", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Iterate through all the desired depths of coverage", "for", "depth", "in", "self", ".", "read_depths", ":", ...
For each PacBio assembly, sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths using reformat.sh from the bbtools suite
[ "For", "each", "PacBio", "assembly", "sample", "reads", "from", "corresponding", "FASTQ", "files", "for", "appropriate", "forward", "and", "reverse", "lengths", "and", "sequencing", "depths", "using", "reformat", ".", "sh", "from", "the", "bbtools", "suite" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L472-L535
train
Sample reads from corresponding FASTQ files for appropriate forward and reverse lengths and sequencing depths.
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.link_reads
def link_reads(self, analysistype): """ Create folders with relative symlinks to the desired simulated/sampled reads. These folders will contain all the reads created for each sample, and will be processed with GeneSippr and COWBAT pipelines :param analysistype: Current analysis type. Wi...
python
def link_reads(self, analysistype): """ Create folders with relative symlinks to the desired simulated/sampled reads. These folders will contain all the reads created for each sample, and will be processed with GeneSippr and COWBAT pipelines :param analysistype: Current analysis type. Wi...
[ "def", "link_reads", "(", "self", ",", "analysistype", ")", ":", "logging", ".", "info", "(", "'Linking {at} reads'", ".", "format", "(", "at", "=", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "metadata", ":", "# Create the output directories...
Create folders with relative symlinks to the desired simulated/sampled reads. These folders will contain all the reads created for each sample, and will be processed with GeneSippr and COWBAT pipelines :param analysistype: Current analysis type. Will either be 'simulated' or 'sampled'
[ "Create", "folders", "with", "relative", "symlinks", "to", "the", "desired", "simulated", "/", "sampled", "reads", ".", "These", "folders", "will", "contain", "all", "the", "reads", "created", "for", "each", "sample", "and", "will", "be", "processed", "with", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L537-L584
train
Create the necessary directories to link the reads to the output directories
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.run_genesippr
def run_genesippr(self): """ Run GeneSippr on each of the samples """ from pathlib import Path home = str(Path.home()) logging.info('GeneSippr') # These unfortunate hard coded paths appear to be necessary miniconda_path = os.path.join(home, 'miniconda3') ...
python
def run_genesippr(self): """ Run GeneSippr on each of the samples """ from pathlib import Path home = str(Path.home()) logging.info('GeneSippr') # These unfortunate hard coded paths appear to be necessary miniconda_path = os.path.join(home, 'miniconda3') ...
[ "def", "run_genesippr", "(", "self", ")", ":", "from", "pathlib", "import", "Path", "home", "=", "str", "(", "Path", ".", "home", "(", ")", ")", "logging", ".", "info", "(", "'GeneSippr'", ")", "# These unfortunate hard coded paths appear to be necessary", "mini...
Run GeneSippr on each of the samples
[ "Run", "GeneSippr", "on", "each", "of", "the", "samples" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L586-L620
train
Run GeneSippr on each of the samples in the current directory.
dnanhkhoa/logone
logone/logone.py
LogOne.set_level
def set_level(self, level): """ Set the logging level of this logger. :param level: must be an int or a str. """ for handler in self.__coloredlogs_handlers: handler.setLevel(level=level) self.logger.setLevel(level=level)
python
def set_level(self, level): """ Set the logging level of this logger. :param level: must be an int or a str. """ for handler in self.__coloredlogs_handlers: handler.setLevel(level=level) self.logger.setLevel(level=level)
[ "def", "set_level", "(", "self", ",", "level", ")", ":", "for", "handler", "in", "self", ".", "__coloredlogs_handlers", ":", "handler", ".", "setLevel", "(", "level", "=", "level", ")", "self", ".", "logger", ".", "setLevel", "(", "level", "=", "level", ...
Set the logging level of this logger. :param level: must be an int or a str.
[ "Set", "the", "logging", "level", "of", "this", "logger", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L87-L96
train
Sets the logging level of this logger.
dnanhkhoa/logone
logone/logone.py
LogOne.disable_logger
def disable_logger(self, disabled=True): """ Disable all logging calls. """ # Disable standard IO streams if disabled: sys.stdout = _original_stdout sys.stderr = _original_stderr else: sys.stdout = self.__stdout_stream sys.s...
python
def disable_logger(self, disabled=True): """ Disable all logging calls. """ # Disable standard IO streams if disabled: sys.stdout = _original_stdout sys.stderr = _original_stderr else: sys.stdout = self.__stdout_stream sys.s...
[ "def", "disable_logger", "(", "self", ",", "disabled", "=", "True", ")", ":", "# Disable standard IO streams", "if", "disabled", ":", "sys", ".", "stdout", "=", "_original_stdout", "sys", ".", "stderr", "=", "_original_stderr", "else", ":", "sys", ".", "stdout...
Disable all logging calls.
[ "Disable", "all", "logging", "calls", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L98-L111
train
Disable all logging calls.
dnanhkhoa/logone
logone/logone.py
LogOne.redirect_stdout
def redirect_stdout(self, enabled=True, log_level=logging.INFO): """ Redirect sys.stdout to file-like object. """ if enabled: if self.__stdout_wrapper: self.__stdout_wrapper.update_log_level(log_level=log_level) else: self.__stdout_...
python
def redirect_stdout(self, enabled=True, log_level=logging.INFO): """ Redirect sys.stdout to file-like object. """ if enabled: if self.__stdout_wrapper: self.__stdout_wrapper.update_log_level(log_level=log_level) else: self.__stdout_...
[ "def", "redirect_stdout", "(", "self", ",", "enabled", "=", "True", ",", "log_level", "=", "logging", ".", "INFO", ")", ":", "if", "enabled", ":", "if", "self", ".", "__stdout_wrapper", ":", "self", ".", "__stdout_wrapper", ".", "update_log_level", "(", "l...
Redirect sys.stdout to file-like object.
[ "Redirect", "sys", ".", "stdout", "to", "file", "-", "like", "object", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L113-L128
train
Redirect sys. stdout to file - like object.
dnanhkhoa/logone
logone/logone.py
LogOne.redirect_stderr
def redirect_stderr(self, enabled=True, log_level=logging.ERROR): """ Redirect sys.stderr to file-like object. """ if enabled: if self.__stderr_wrapper: self.__stderr_wrapper.update_log_level(log_level=log_level) else: self.__stderr...
python
def redirect_stderr(self, enabled=True, log_level=logging.ERROR): """ Redirect sys.stderr to file-like object. """ if enabled: if self.__stderr_wrapper: self.__stderr_wrapper.update_log_level(log_level=log_level) else: self.__stderr...
[ "def", "redirect_stderr", "(", "self", ",", "enabled", "=", "True", ",", "log_level", "=", "logging", ".", "ERROR", ")", ":", "if", "enabled", ":", "if", "self", ".", "__stderr_wrapper", ":", "self", ".", "__stderr_wrapper", ".", "update_log_level", "(", "...
Redirect sys.stderr to file-like object.
[ "Redirect", "sys", ".", "stderr", "to", "file", "-", "like", "object", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L130-L145
train
Redirect sys. stderr to file - like object.
dnanhkhoa/logone
logone/logone.py
LogOne.use_file
def use_file(self, enabled=True, file_name=None, level=logging.WARNING, when='d', interval=1, backup_count=30, delay=False, utc=False, at_time=None, log_format=None, ...
python
def use_file(self, enabled=True, file_name=None, level=logging.WARNING, when='d', interval=1, backup_count=30, delay=False, utc=False, at_time=None, log_format=None, ...
[ "def", "use_file", "(", "self", ",", "enabled", "=", "True", ",", "file_name", "=", "None", ",", "level", "=", "logging", ".", "WARNING", ",", "when", "=", "'d'", ",", "interval", "=", "1", ",", "backup_count", "=", "30", ",", "delay", "=", "False", ...
Handler for logging to a file, rotating the log file at certain timed intervals.
[ "Handler", "for", "logging", "to", "a", "file", "rotating", "the", "log", "file", "at", "certain", "timed", "intervals", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L147-L199
train
Set the logging level and time for a file.
dnanhkhoa/logone
logone/logone.py
LogOne.use_loggly
def use_loggly(self, enabled=True, loggly_token=None, loggly_tag=None, level=logging.WARNING, log_format=None, date_format=None): """ Enable handler for sending the record to Loggly service. """ ...
python
def use_loggly(self, enabled=True, loggly_token=None, loggly_tag=None, level=logging.WARNING, log_format=None, date_format=None): """ Enable handler for sending the record to Loggly service. """ ...
[ "def", "use_loggly", "(", "self", ",", "enabled", "=", "True", ",", "loggly_token", "=", "None", ",", "loggly_tag", "=", "None", ",", "level", "=", "logging", ".", "WARNING", ",", "log_format", "=", "None", ",", "date_format", "=", "None", ")", ":", "i...
Enable handler for sending the record to Loggly service.
[ "Enable", "handler", "for", "sending", "the", "record", "to", "Loggly", "service", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L201-L241
train
Enable handler for sending the record to Loggly service.
dnanhkhoa/logone
logone/logone.py
LogOne.__find_caller
def __find_caller(stack_info=False): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ frame = logging.currentframe() # On some versions of IronPython, currentframe() returns None if # IronPython is...
python
def __find_caller(stack_info=False): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ frame = logging.currentframe() # On some versions of IronPython, currentframe() returns None if # IronPython is...
[ "def", "__find_caller", "(", "stack_info", "=", "False", ")", ":", "frame", "=", "logging", ".", "currentframe", "(", ")", "# On some versions of IronPython, currentframe() returns None if", "# IronPython isn't run with -X:Frames.", "if", "frame", ":", "frame", "=", "fram...
Find the stack frame of the caller so that we can note the source file name, line number and function name.
[ "Find", "the", "stack", "frame", "of", "the", "caller", "so", "that", "we", "can", "note", "the", "source", "file", "name", "line", "number", "and", "function", "name", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L244-L272
train
Find the caller name so that we can note the source file name line number and function name.
dnanhkhoa/logone
logone/logone.py
LogOne._log
def _log(self, level, msg, *args, **kwargs): """ Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ ...
python
def _log(self, level, msg, *args, **kwargs): """ Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ ...
[ "def", "_log", "(", "self", ",", "level", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "level", ",", "int", ")", ":", "if", "logging", ".", "raiseExceptions", ":", "raise", "TypeError", "(", "'Lev...
Log 'msg % args' with the integer severity 'level'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
[ "Log", "msg", "%", "args", "with", "the", "integer", "severity", "level", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L274-L333
train
Log a message at the specified severity level.
dnanhkhoa/logone
logone/logone.py
StdErrWrapper.flush
def flush(self): """ Flush the buffer, if applicable. """ if self.__buffer.tell() > 0: # Write the buffer to log # noinspection PyProtectedMember self.__logger._log(level=self.__log_level, msg=self.__buffer.getvalue().strip(), ...
python
def flush(self): """ Flush the buffer, if applicable. """ if self.__buffer.tell() > 0: # Write the buffer to log # noinspection PyProtectedMember self.__logger._log(level=self.__log_level, msg=self.__buffer.getvalue().strip(), ...
[ "def", "flush", "(", "self", ")", ":", "if", "self", ".", "__buffer", ".", "tell", "(", ")", ">", "0", ":", "# Write the buffer to log", "# noinspection PyProtectedMember", "self", ".", "__logger", ".", "_log", "(", "level", "=", "self", ".", "__log_level", ...
Flush the buffer, if applicable.
[ "Flush", "the", "buffer", "if", "applicable", "." ]
7345a59e54ae59418a2c35ae7e7af5b2784fa1b5
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L474-L485
train
Flushes the buffer to the log if applicable.
tsnaomi/finnsyll
finnsyll/prev/v08.py
syllabify
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify syllabifications = list(syllabify(word)) for syll, rules in syllabifications: yield syll, rules n = ...
python
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify syllabifications = list(syllabify(word)) for syll, rules in syllabifications: yield syll, rules n = ...
[ "def", "syllabify", "(", "word", ")", ":", "compound", "=", "bool", "(", "re", ".", "search", "(", "r'(-| |=)'", ",", "word", ")", ")", "syllabify", "=", "_syllabify_compound", "if", "compound", "else", "_syllabify", "syllabifications", "=", "list", "(", "...
Syllabify the given word, whether simplex or complex.
[ "Syllabify", "the", "given", "word", "whether", "simplex", "or", "complex", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v08.py#L18-L31
train
Syllabify the given word whether simplex or complex.
tsnaomi/finnsyll
finnsyll/prev/v08.py
apply_T4
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ optionally contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = word.split('.') PARTS = [[] for part in range(len(WORD))] for i, v in enumerate(WORD): # i % 2 != 0 preven...
python
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ optionally contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = word.split('.') PARTS = [[] for part in range(len(WORD))] for i, v in enumerate(WORD): # i % 2 != 0 preven...
[ "def", "apply_T4", "(", "word", ")", ":", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "PARTS", "=", "[", "[", "]", "for", "part", "in", "range", "(", "len", "(", "WORD", ")", ")", "]", "for", "i", ",", "v", "in", "enumerate", "(", "WO...
An agglutination diphthong that ends in /u, y/ optionally contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].
[ "An", "agglutination", "diphthong", "that", "ends", "in", "/", "u", "y", "/", "optionally", "contains", "a", "syllable", "boundary", "when", "-", "C#", "or", "-", "CCV", "follow", "e", ".", "g", ".", "[", "lau", ".", "ka", ".", "us", "]", "[", "va"...
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v08.py#L189-L217
train
A generator function that applies T4 to a word.
QunarOPS/qg.core
qg/core/log.py
setup
def setup(product_name): """Setup logging.""" if CONF.log_config: _load_log_config(CONF.log_config) else: _setup_logging_from_conf() sys.excepthook = _create_logging_excepthook(product_name)
python
def setup(product_name): """Setup logging.""" if CONF.log_config: _load_log_config(CONF.log_config) else: _setup_logging_from_conf() sys.excepthook = _create_logging_excepthook(product_name)
[ "def", "setup", "(", "product_name", ")", ":", "if", "CONF", ".", "log_config", ":", "_load_log_config", "(", "CONF", ".", "log_config", ")", "else", ":", "_setup_logging_from_conf", "(", ")", "sys", ".", "excepthook", "=", "_create_logging_excepthook", "(", "...
Setup logging.
[ "Setup", "logging", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L351-L357
train
Setup logging.
QunarOPS/qg.core
qg/core/log.py
ContextFormatter.format
def format(self, record): """Uses contextstring if request_id is set, otherwise default.""" # NOTE(sdague): default the fancier formating params # to an empty string so we don't throw an exception if # they get used for key in ('instance', 'color'): if key not in reco...
python
def format(self, record): """Uses contextstring if request_id is set, otherwise default.""" # NOTE(sdague): default the fancier formating params # to an empty string so we don't throw an exception if # they get used for key in ('instance', 'color'): if key not in reco...
[ "def", "format", "(", "self", ",", "record", ")", ":", "# NOTE(sdague): default the fancier formating params", "# to an empty string so we don't throw an exception if", "# they get used", "for", "key", "in", "(", "'instance'", ",", "'color'", ")", ":", "if", "key", "not",...
Uses contextstring if request_id is set, otherwise default.
[ "Uses", "contextstring", "if", "request_id", "is", "set", "otherwise", "default", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L486-L507
train
Uses contextstring if request_id is set otherwise default.
QunarOPS/qg.core
qg/core/log.py
ContextFormatter.formatException
def formatException(self, exc_info, record=None): """Format exception output with CONF.logging_exception_prefix.""" if not record: return logging.Formatter.formatException(self, exc_info) stringbuffer = cStringIO.StringIO() traceback.print_exception(exc_info[0], exc_info[1],...
python
def formatException(self, exc_info, record=None): """Format exception output with CONF.logging_exception_prefix.""" if not record: return logging.Formatter.formatException(self, exc_info) stringbuffer = cStringIO.StringIO() traceback.print_exception(exc_info[0], exc_info[1],...
[ "def", "formatException", "(", "self", ",", "exc_info", ",", "record", "=", "None", ")", ":", "if", "not", "record", ":", "return", "logging", ".", "Formatter", ".", "formatException", "(", "self", ",", "exc_info", ")", "stringbuffer", "=", "cStringIO", "....
Format exception output with CONF.logging_exception_prefix.
[ "Format", "exception", "output", "with", "CONF", ".", "logging_exception_prefix", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L509-L528
train
Format exception output with CONF. logging_exception_prefix.
benoitkugler/abstractDataLibrary
pyDLib/GUI/app.py
abstractToolBar._set_boutons_interface
def _set_boutons_interface(self, buttons): """Display buttons given by the list of tuples (id,function,description,is_active)""" for id_action, f, d, is_active in buttons: icon = self.get_icon(id_action) action = self.addAction(QIcon(icon), d) action.setEnabled(is_act...
python
def _set_boutons_interface(self, buttons): """Display buttons given by the list of tuples (id,function,description,is_active)""" for id_action, f, d, is_active in buttons: icon = self.get_icon(id_action) action = self.addAction(QIcon(icon), d) action.setEnabled(is_act...
[ "def", "_set_boutons_interface", "(", "self", ",", "buttons", ")", ":", "for", "id_action", ",", "f", ",", "d", ",", "is_active", "in", "buttons", ":", "icon", "=", "self", ".", "get_icon", "(", "id_action", ")", "action", "=", "self", ".", "addAction", ...
Display buttons given by the list of tuples (id,function,description,is_active)
[ "Display", "buttons", "given", "by", "the", "list", "of", "tuples", "(", "id", "function", "description", "is_active", ")" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L93-L99
train
Display buttons given by the list of tuples id function description is_active
benoitkugler/abstractDataLibrary
pyDLib/GUI/app.py
abstractToolBar.set_interface
def set_interface(self, interface): """Add update toolbar callback to the interface""" self.interface = interface self.interface.callbacks.update_toolbar = self._update self._update()
python
def set_interface(self, interface): """Add update toolbar callback to the interface""" self.interface = interface self.interface.callbacks.update_toolbar = self._update self._update()
[ "def", "set_interface", "(", "self", ",", "interface", ")", ":", "self", ".", "interface", "=", "interface", "self", ".", "interface", ".", "callbacks", ".", "update_toolbar", "=", "self", ".", "_update", "self", ".", "_update", "(", ")" ]
Add update toolbar callback to the interface
[ "Add", "update", "toolbar", "callback", "to", "the", "interface" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L101-L105
train
Add update toolbar callback to the interface
benoitkugler/abstractDataLibrary
pyDLib/GUI/app.py
abstractToolBar._update
def _update(self): """Update the display of button after querying data from interface""" self.clear() self._set_boutons_communs() if self.interface: self.addSeparator() l_actions = self.interface.get_actions_toolbar() self._set_boutons_interface(l_acti...
python
def _update(self): """Update the display of button after querying data from interface""" self.clear() self._set_boutons_communs() if self.interface: self.addSeparator() l_actions = self.interface.get_actions_toolbar() self._set_boutons_interface(l_acti...
[ "def", "_update", "(", "self", ")", ":", "self", ".", "clear", "(", ")", "self", ".", "_set_boutons_communs", "(", ")", "if", "self", ".", "interface", ":", "self", ".", "addSeparator", "(", ")", "l_actions", "=", "self", ".", "interface", ".", "get_ac...
Update the display of button after querying data from interface
[ "Update", "the", "display", "of", "button", "after", "querying", "data", "from", "interface" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L107-L114
train
Update the display of button after querying data from interface
benoitkugler/abstractDataLibrary
pyDLib/GUI/app.py
Application.init_login
def init_login(self, from_local=False): """Display login screen. May ask for local data loading if from_local is True.""" if self.toolbar: self.removeToolBar(self.toolbar) widget_login = login.Loading(self.statusBar(), self.theory_main) self.centralWidget().addWidget(widget_l...
python
def init_login(self, from_local=False): """Display login screen. May ask for local data loading if from_local is True.""" if self.toolbar: self.removeToolBar(self.toolbar) widget_login = login.Loading(self.statusBar(), self.theory_main) self.centralWidget().addWidget(widget_l...
[ "def", "init_login", "(", "self", ",", "from_local", "=", "False", ")", ":", "if", "self", ".", "toolbar", ":", "self", ".", "removeToolBar", "(", "self", ".", "toolbar", ")", "widget_login", "=", "login", ".", "Loading", "(", "self", ".", "statusBar", ...
Display login screen. May ask for local data loading if from_local is True.
[ "Display", "login", "screen", ".", "May", "ask", "for", "local", "data", "loading", "if", "from_local", "is", "True", "." ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L160-L172
train
Display login screen. May ask for local data loading if from_local is True.
ProjetPP/PPP-libmodule-Python
ppp_libmodule/http.py
HttpRequestHandler.make_response
def make_response(self, status, content_type, response): """Shortcut for making a response to the client's request.""" headers = [('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'), ('Access-Control-Allow-Headers', 'Content-...
python
def make_response(self, status, content_type, response): """Shortcut for making a response to the client's request.""" headers = [('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'), ('Access-Control-Allow-Headers', 'Content-...
[ "def", "make_response", "(", "self", ",", "status", ",", "content_type", ",", "response", ")", ":", "headers", "=", "[", "(", "'Access-Control-Allow-Origin'", ",", "'*'", ")", ",", "(", "'Access-Control-Allow-Methods'", ",", "'GET, POST, OPTIONS'", ")", ",", "("...
Shortcut for making a response to the client's request.
[ "Shortcut", "for", "making", "a", "response", "to", "the", "client", "s", "request", "." ]
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L23-L32
train
Shortcut for making a response to the client s request.
ProjetPP/PPP-libmodule-Python
ppp_libmodule/http.py
HttpRequestHandler.process_request
def process_request(self, request): """Processes a request.""" try: request = Request.from_json(request.read().decode()) except ValueError: raise ClientError('Data is not valid JSON.') except KeyError: raise ClientError('Missing mandatory field in requ...
python
def process_request(self, request): """Processes a request.""" try: request = Request.from_json(request.read().decode()) except ValueError: raise ClientError('Data is not valid JSON.') except KeyError: raise ClientError('Missing mandatory field in requ...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "try", ":", "request", "=", "Request", ".", "from_json", "(", "request", ".", "read", "(", ")", ".", "decode", "(", ")", ")", "except", "ValueError", ":", "raise", "ClientError", "(", "'D...
Processes a request.
[ "Processes", "a", "request", "." ]
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L97-L116
train
Processes a request.
ProjetPP/PPP-libmodule-Python
ppp_libmodule/http.py
HttpRequestHandler.on_post
def on_post(self): """Extracts the request, feeds the module, and returns the response.""" request = self.environ['wsgi.input'] try: return self.process_request(request) except ClientError as exc: return self.on_client_error(exc) except BadGateway as exc: ...
python
def on_post(self): """Extracts the request, feeds the module, and returns the response.""" request = self.environ['wsgi.input'] try: return self.process_request(request) except ClientError as exc: return self.on_client_error(exc) except BadGateway as exc: ...
[ "def", "on_post", "(", "self", ")", ":", "request", "=", "self", ".", "environ", "[", "'wsgi.input'", "]", "try", ":", "return", "self", ".", "process_request", "(", "request", ")", "except", "ClientError", "as", "exc", ":", "return", "self", ".", "on_cl...
Extracts the request, feeds the module, and returns the response.
[ "Extracts", "the", "request", "feeds", "the", "module", "and", "returns", "the", "response", "." ]
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L118-L131
train
Extracts the request feeds the module and returns the response.
ProjetPP/PPP-libmodule-Python
ppp_libmodule/http.py
HttpRequestHandler.dispatch
def dispatch(self): """Handles dispatching of the request.""" method_name = 'on_' + self.environ['REQUEST_METHOD'].lower() method = getattr(self, method_name, None) if method: return method() else: return self.on_bad_method()
python
def dispatch(self): """Handles dispatching of the request.""" method_name = 'on_' + self.environ['REQUEST_METHOD'].lower() method = getattr(self, method_name, None) if method: return method() else: return self.on_bad_method()
[ "def", "dispatch", "(", "self", ")", ":", "method_name", "=", "'on_'", "+", "self", ".", "environ", "[", "'REQUEST_METHOD'", "]", ".", "lower", "(", ")", "method", "=", "getattr", "(", "self", ",", "method_name", ",", "None", ")", "if", "method", ":", ...
Handles dispatching of the request.
[ "Handles", "dispatching", "of", "the", "request", "." ]
8098ec3e3ac62f471ff93fb8ce29e36833a8d492
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L137-L144
train
Handles dispatching of the request.
saltant-org/saltant-py
saltant/models/user.py
User.sync
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.user.User`: This user instance after syncing. """ ...
python
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.user.User`: This user instance after syncing. """ ...
[ "def", "sync", "(", "self", ")", ":", "self", "=", "self", ".", "manager", ".", "get", "(", "username", "=", "self", ".", "username", ")", "return", "self" ]
Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.user.User`: This user instance after syncing.
[ "Sync", "this", "model", "with", "latest", "data", "on", "the", "saltant", "server", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/user.py#L35-L47
train
Syncs this user with latest data on the saltant server.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.serialised
def serialised( self ): """Tuple containing the contents of the Block.""" klass = self.__class__ return ((klass.__module__, klass.__name__), tuple( (name, field.serialise( self._field_data[name], parent=self ) ) for name, field in klass._fields.items()))
python
def serialised( self ): """Tuple containing the contents of the Block.""" klass = self.__class__ return ((klass.__module__, klass.__name__), tuple( (name, field.serialise( self._field_data[name], parent=self ) ) for name, field in klass._fields.items()))
[ "def", "serialised", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "return", "(", "(", "klass", ".", "__module__", ",", "klass", ".", "__name__", ")", ",", "tuple", "(", "(", "name", ",", "field", ".", "serialise", "(", "self", ".", ...
Tuple containing the contents of the Block.
[ "Tuple", "containing", "the", "contents", "of", "the", "Block", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L193-L196
train
Tuple containing the contents of the Block.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.clone_data
def clone_data( self, source ): """Clone data from another Block. source Block instance to copy from. """ klass = self.__class__ assert isinstance( source, klass ) for name in klass._fields: self._field_data[name] = getattr( source, name )
python
def clone_data( self, source ): """Clone data from another Block. source Block instance to copy from. """ klass = self.__class__ assert isinstance( source, klass ) for name in klass._fields: self._field_data[name] = getattr( source, name )
[ "def", "clone_data", "(", "self", ",", "source", ")", ":", "klass", "=", "self", ".", "__class__", "assert", "isinstance", "(", "source", ",", "klass", ")", "for", "name", "in", "klass", ".", "_fields", ":", "self", ".", "_field_data", "[", "name", "]"...
Clone data from another Block. source Block instance to copy from.
[ "Clone", "data", "from", "another", "Block", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L198-L208
train
Clone data from another Block instance to copy from.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.import_data
def import_data( self, raw_buffer ): """Import data from a byte array. raw_buffer Byte array to import from. """ klass = self.__class__ if raw_buffer: assert common.is_bytes( raw_buffer ) # raw_buffer = memoryview( raw_buffer ) self._f...
python
def import_data( self, raw_buffer ): """Import data from a byte array. raw_buffer Byte array to import from. """ klass = self.__class__ if raw_buffer: assert common.is_bytes( raw_buffer ) # raw_buffer = memoryview( raw_buffer ) self._f...
[ "def", "import_data", "(", "self", ",", "raw_buffer", ")", ":", "klass", "=", "self", ".", "__class__", "if", "raw_buffer", ":", "assert", "common", ".", "is_bytes", "(", "raw_buffer", ")", "# raw_buffer = memoryview( raw_buffer )", "self", ".", "_field...
Import data from a byte array. raw_buffer Byte array to import from.
[ "Import", "data", "from", "a", "byte", "array", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L210-L255
train
Import data from a byte array.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.export_data
def export_data( self ): """Export data to a byte array.""" klass = self.__class__ output = bytearray( b'\x00'*self.get_size() ) # prevalidate all data before export. # this is important to ensure that any dependent fields # are updated beforehand, e.g. a count referenc...
python
def export_data( self ): """Export data to a byte array.""" klass = self.__class__ output = bytearray( b'\x00'*self.get_size() ) # prevalidate all data before export. # this is important to ensure that any dependent fields # are updated beforehand, e.g. a count referenc...
[ "def", "export_data", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "output", "=", "bytearray", "(", "b'\\x00'", "*", "self", ".", "get_size", "(", ")", ")", "# prevalidate all data before export.", "# this is important to ensure that any dependent fi...
Export data to a byte array.
[ "Export", "data", "to", "a", "byte", "array", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L258-L282
train
Export data to a byte array.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.update_deps
def update_deps( self ): """Update dependencies on all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.update_deps_on_field( name ) return
python
def update_deps( self ): """Update dependencies on all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.update_deps_on_field( name ) return
[ "def", "update_deps", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "for", "name", "in", "klass", ".", "_fields", ":", "self", ".", "update_deps_on_field", "(", "name", ")", "return" ]
Update dependencies on all the fields on this Block instance.
[ "Update", "dependencies", "on", "all", "the", "fields", "on", "this", "Block", "instance", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L284-L290
train
Update dependencies on all the fields on this Block instance.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.validate
def validate( self ): """Validate all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.validate_field( name ) return
python
def validate( self ): """Validate all the fields on this Block instance.""" klass = self.__class__ for name in klass._fields: self.validate_field( name ) return
[ "def", "validate", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "for", "name", "in", "klass", ".", "_fields", ":", "self", ".", "validate_field", "(", "name", ")", "return" ]
Validate all the fields on this Block instance.
[ "Validate", "all", "the", "fields", "on", "this", "Block", "instance", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L292-L298
train
Validate all the fields on this Block instance.
moralrecordings/mrcrowbar
mrcrowbar/blocks.py
Block.get_size
def get_size( self ): """Get the projected size (in bytes) of the exported data from this Block instance.""" klass = self.__class__ size = 0 for name in klass._fields: size = max( size, klass._fields[name].get_end_offset( self._field_data[name], parent=self ) ) for ch...
python
def get_size( self ): """Get the projected size (in bytes) of the exported data from this Block instance.""" klass = self.__class__ size = 0 for name in klass._fields: size = max( size, klass._fields[name].get_end_offset( self._field_data[name], parent=self ) ) for ch...
[ "def", "get_size", "(", "self", ")", ":", "klass", "=", "self", ".", "__class__", "size", "=", "0", "for", "name", "in", "klass", ".", "_fields", ":", "size", "=", "max", "(", "size", ",", "klass", ".", "_fields", "[", "name", "]", ".", "get_end_of...
Get the projected size (in bytes) of the exported data from this Block instance.
[ "Get", "the", "projected", "size", "(", "in", "bytes", ")", "of", "the", "exported", "data", "from", "this", "Block", "instance", "." ]
b1ed882c4555552e7656b2d84aca543184577fa3
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L300-L308
train
Get the projected size of the exported data from this Block instance.
jorbas/GADDAG
gaddag/gaddag.py
GADDAG.save
def save(self, path, compressed=True, exist_ok=False): """ Save the GADDAG to file. Args: path: path to save the GADDAG to. compressed: compress the saved GADDAG using gzip. exist_ok: overwrite existing file at `path`. """ path = os.path.expan...
python
def save(self, path, compressed=True, exist_ok=False): """ Save the GADDAG to file. Args: path: path to save the GADDAG to. compressed: compress the saved GADDAG using gzip. exist_ok: overwrite existing file at `path`. """ path = os.path.expan...
[ "def", "save", "(", "self", ",", "path", ",", "compressed", "=", "True", ",", "exist_ok", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "expandvars", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", "if", "os", "."...
Save the GADDAG to file. Args: path: path to save the GADDAG to. compressed: compress the saved GADDAG using gzip. exist_ok: overwrite existing file at `path`.
[ "Save", "the", "GADDAG", "to", "file", "." ]
a0ede3def715c586e1f273d96e9fc0d537cd9561
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L70-L95
train
Save the GADDAG to a file.
jorbas/GADDAG
gaddag/gaddag.py
GADDAG.load
def load(self, path): """ Load a GADDAG from file, replacing the words currently in this GADDAG. Args: path: path to saved GADDAG to be loaded. """ path = os.path.expandvars(os.path.expanduser(path)) gdg = cgaddag.gdg_load(path.encode("ascii")) if no...
python
def load(self, path): """ Load a GADDAG from file, replacing the words currently in this GADDAG. Args: path: path to saved GADDAG to be loaded. """ path = os.path.expandvars(os.path.expanduser(path)) gdg = cgaddag.gdg_load(path.encode("ascii")) if no...
[ "def", "load", "(", "self", ",", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expandvars", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", "gdg", "=", "cgaddag", ".", "gdg_load", "(", "path", ".", "encode", "(", "\"as...
Load a GADDAG from file, replacing the words currently in this GADDAG. Args: path: path to saved GADDAG to be loaded.
[ "Load", "a", "GADDAG", "from", "file", "replacing", "the", "words", "currently", "in", "this", "GADDAG", "." ]
a0ede3def715c586e1f273d96e9fc0d537cd9561
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L97-L112
train
Load a GADDAG from file and replace the words currently in this GADDAG with the words currently in the GADDAG.
jorbas/GADDAG
gaddag/gaddag.py
GADDAG.starts_with
def starts_with(self, prefix): """ Find all words starting with a prefix. Args: prefix: A prefix to be searched for. Returns: A list of all words found. """ prefix = prefix.lower() found_words = [] res = cgaddag.gdg_starts_with(s...
python
def starts_with(self, prefix): """ Find all words starting with a prefix. Args: prefix: A prefix to be searched for. Returns: A list of all words found. """ prefix = prefix.lower() found_words = [] res = cgaddag.gdg_starts_with(s...
[ "def", "starts_with", "(", "self", ",", "prefix", ")", ":", "prefix", "=", "prefix", ".", "lower", "(", ")", "found_words", "=", "[", "]", "res", "=", "cgaddag", ".", "gdg_starts_with", "(", "self", ".", "gdg", ",", "prefix", ".", "encode", "(", "enc...
Find all words starting with a prefix. Args: prefix: A prefix to be searched for. Returns: A list of all words found.
[ "Find", "all", "words", "starting", "with", "a", "prefix", "." ]
a0ede3def715c586e1f273d96e9fc0d537cd9561
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L114-L136
train
Find all words starting with a prefix.
jorbas/GADDAG
gaddag/gaddag.py
GADDAG.contains
def contains(self, sub): """ Find all words containing a substring. Args: sub: A substring to be searched for. Returns: A list of all words found. """ sub = sub.lower() found_words = set() res = cgaddag.gdg_contains(self.gdg, sub...
python
def contains(self, sub): """ Find all words containing a substring. Args: sub: A substring to be searched for. Returns: A list of all words found. """ sub = sub.lower() found_words = set() res = cgaddag.gdg_contains(self.gdg, sub...
[ "def", "contains", "(", "self", ",", "sub", ")", ":", "sub", "=", "sub", ".", "lower", "(", ")", "found_words", "=", "set", "(", ")", "res", "=", "cgaddag", ".", "gdg_contains", "(", "self", ".", "gdg", ",", "sub", ".", "encode", "(", "encoding", ...
Find all words containing a substring. Args: sub: A substring to be searched for. Returns: A list of all words found.
[ "Find", "all", "words", "containing", "a", "substring", "." ]
a0ede3def715c586e1f273d96e9fc0d537cd9561
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L138-L160
train
Find all words containing a substring.
jorbas/GADDAG
gaddag/gaddag.py
GADDAG.ends_with
def ends_with(self, suffix): """ Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found. """ suffix = suffix.lower() found_words = [] res = cgaddag.gdg_ends_with(self.gd...
python
def ends_with(self, suffix): """ Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found. """ suffix = suffix.lower() found_words = [] res = cgaddag.gdg_ends_with(self.gd...
[ "def", "ends_with", "(", "self", ",", "suffix", ")", ":", "suffix", "=", "suffix", ".", "lower", "(", ")", "found_words", "=", "[", "]", "res", "=", "cgaddag", ".", "gdg_ends_with", "(", "self", ".", "gdg", ",", "suffix", ".", "encode", "(", "encodin...
Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found.
[ "Find", "all", "words", "ending", "with", "a", "suffix", "." ]
a0ede3def715c586e1f273d96e9fc0d537cd9561
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L162-L184
train
Find all words ending with a suffix.
jorbas/GADDAG
gaddag/gaddag.py
GADDAG.add_word
def add_word(self, word): """ Add a word to the GADDAG. Args: word: A word to be added to the GADDAG. """ word = word.lower() if not (word.isascii() and word.isalpha()): raise ValueError("Invalid character in word '{}'".format(word)) wor...
python
def add_word(self, word): """ Add a word to the GADDAG. Args: word: A word to be added to the GADDAG. """ word = word.lower() if not (word.isascii() and word.isalpha()): raise ValueError("Invalid character in word '{}'".format(word)) wor...
[ "def", "add_word", "(", "self", ",", "word", ")", ":", "word", "=", "word", ".", "lower", "(", ")", "if", "not", "(", "word", ".", "isascii", "(", ")", "and", "word", ".", "isalpha", "(", ")", ")", ":", "raise", "ValueError", "(", "\"Invalid charac...
Add a word to the GADDAG. Args: word: A word to be added to the GADDAG.
[ "Add", "a", "word", "to", "the", "GADDAG", "." ]
a0ede3def715c586e1f273d96e9fc0d537cd9561
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L186-L203
train
Adds a word to the GADDAG.
Clever/kayvee-python
kayvee/kayvee.py
formatLog
def formatLog(source="", level="", title="", data={}): """ Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of ...
python
def formatLog(source="", level="", title="", data={}): """ Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of ...
[ "def", "formatLog", "(", "source", "=", "\"\"", ",", "level", "=", "\"\"", ",", "title", "=", "\"\"", ",", "data", "=", "{", "}", ")", ":", "# consistently output empty string for unset params, because null values differ by language", "source", "=", "\"\"", "if", ...
Similar to format, but takes additional reserved params to promote logging best-practices :param level - severity of message - how bad is it? :param source - application context - where did it come from? :param title - brief description - what kind of event happened? :param data - additional information - what...
[ "Similar", "to", "format", "but", "takes", "additional", "reserved", "params", "to", "promote", "logging", "best", "-", "practices" ]
9d1cc96d592148bc3bd8f11f9e6ed03255985882
https://github.com/Clever/kayvee-python/blob/9d1cc96d592148bc3bd8f11f9e6ed03255985882/kayvee/kayvee.py#L7-L26
train
Format a log message.
saltant-org/saltant-py
saltant/models/container_task_type.py
ContainerTaskType.put
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ContainerTaskType`: A task type model instance representing the task type just updated. """ return self.manager.put( ...
python
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ContainerTaskType`: A task type model instance representing the task type just updated. """ return self.manager.put( ...
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "command_to_run", "=", "self", "....
Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ContainerTaskType`: A task type model instance representing the task type just updated.
[ "Updates", "this", "task", "type", "on", "the", "saltant", "server", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L101-L123
train
Updates this task type on the saltant server.
saltant-org/saltant-py
saltant/models/container_task_type.py
ContainerTaskTypeManager.create
def create( self, name, command_to_run, container_image, container_type, description="", logs_path="", results_path="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_...
python
def create( self, name, command_to_run, container_image, container_type, description="", logs_path="", results_path="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_...
[ "def", "create", "(", "self", ",", "name", ",", "command_to_run", ",", "container_image", ",", "container_type", ",", "description", "=", "\"\"", ",", "logs_path", "=", "\"\"", ",", "results_path", "=", "\"\"", ",", "environment_variables", "=", "None", ",", ...
Create a container task type. Args: name (str): The name of the task. command_to_run (str): The command to run to execute the task. container_image (str): The container name and tag. For example, ubuntu:14.04 for Docker; and docker://ubuntu:14:04 ...
[ "Create", "a", "container", "task", "type", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L142-L207
train
Creates a new container task type.
saltant-org/saltant-py
saltant/models/container_task_type.py
ContainerTaskTypeManager.put
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, logs_path, results_path, container_image, container_type, extra_data_to_put=None, ...
python
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, logs_path, results_path, container_image, container_type, extra_data_to_put=None, ...
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "command_to_run", ",", "environment_variables", ",", "required_arguments", ",", "required_arguments_default_values", ",", "logs_path", ",", "results_path", ",", "container_image", ",", "cont...
Updates a task type on the saltant server. Args: id (int): The ID of the task type. name (str): The name of the task type. description (str): The description of the task type. command_to_run (str): The command to run to execute the task. environment_v...
[ "Updates", "a", "task", "type", "on", "the", "saltant", "server", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L209-L273
train
Updates a task type on the saltant server.
MarcMeszaros/envitro
envitro/core.py
_strtobool
def _strtobool(val): """Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', '0' and ''. Raises ValueError if 'val' is anything else. """ val = val.lower() if val in ('y',...
python
def _strtobool(val): """Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', '0' and ''. Raises ValueError if 'val' is anything else. """ val = val.lower() if val in ('y',...
[ "def", "_strtobool", "(", "val", ")", ":", "val", "=", "val", ".", "lower", "(", ")", "if", "val", "in", "(", "'y'", ",", "'yes'", ",", "'t'", ",", "'true'", ",", "'on'", ",", "'1'", ")", ":", "return", "1", "elif", "val", "in", "(", "'n'", "...
Convert a string representation of truth to true (1) or false (0). True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', '0' and ''. Raises ValueError if 'val' is anything else.
[ "Convert", "a", "string", "representation", "of", "truth", "to", "true", "(", "1", ")", "or", "false", "(", "0", ")", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L18-L31
train
Convert a string representation of truth to true or false ( 0.
MarcMeszaros/envitro
envitro/core.py
_str_to_list
def _str_to_list(value, separator): """Convert a string to a list with sanitization.""" value_list = [item.strip() for item in value.split(separator)] value_list_sanitized = builtins.list(filter(None, value_list)) if len(value_list_sanitized) > 0: return value_list_sanitized else: ra...
python
def _str_to_list(value, separator): """Convert a string to a list with sanitization.""" value_list = [item.strip() for item in value.split(separator)] value_list_sanitized = builtins.list(filter(None, value_list)) if len(value_list_sanitized) > 0: return value_list_sanitized else: ra...
[ "def", "_str_to_list", "(", "value", ",", "separator", ")", ":", "value_list", "=", "[", "item", ".", "strip", "(", ")", "for", "item", "in", "value", ".", "split", "(", "separator", ")", "]", "value_list_sanitized", "=", "builtins", ".", "list", "(", ...
Convert a string to a list with sanitization.
[ "Convert", "a", "string", "to", "a", "list", "with", "sanitization", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L34-L41
train
Convert a string to a list with sanitization.
MarcMeszaros/envitro
envitro/core.py
write
def write(name, value): """Write a raw env value. A ``None`` value clears the environment variable. Args: name: The environment variable name value: The value to write """ if value is not None: environ[name] = builtins.str(value) elif environ.get(name): del envi...
python
def write(name, value): """Write a raw env value. A ``None`` value clears the environment variable. Args: name: The environment variable name value: The value to write """ if value is not None: environ[name] = builtins.str(value) elif environ.get(name): del envi...
[ "def", "write", "(", "name", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "environ", "[", "name", "]", "=", "builtins", ".", "str", "(", "value", ")", "elif", "environ", ".", "get", "(", "name", ")", ":", "del", "environ", "["...
Write a raw env value. A ``None`` value clears the environment variable. Args: name: The environment variable name value: The value to write
[ "Write", "a", "raw", "env", "value", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L53-L65
train
Writes a raw env value. A None value clears the environment variable.
MarcMeszaros/envitro
envitro/core.py
read
def read(name, default=None, allow_none=False, fallback=None): """Read the raw env value. Read the raw environment variable or use the default. If the value is not found and no default is set throw an exception. Args: name: The environment variable name default: The default value to us...
python
def read(name, default=None, allow_none=False, fallback=None): """Read the raw env value. Read the raw environment variable or use the default. If the value is not found and no default is set throw an exception. Args: name: The environment variable name default: The default value to us...
[ "def", "read", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "raw_value", "=", "environ", ".", "get", "(", "name", ")", "if", "raw_value", "is", "None", "and", "fallback", "is", "no...
Read the raw env value. Read the raw environment variable or use the default. If the value is not found and no default is set throw an exception. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the retur...
[ "Read", "the", "raw", "env", "value", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L73-L101
train
Reads the raw env value.
MarcMeszaros/envitro
envitro/core.py
str
def str(name, default=None, allow_none=False, fallback=None): """Get a string based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optio...
python
def str(name, default=None, allow_none=False, fallback=None): """Get a string based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optio...
[ "def", "str", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "=", "fallback", ")", "if", "value...
Get a string based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
[ "Get", "a", "string", "based", "environment", "value", "or", "the", "default", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L109-L121
train
Get a string based environment variable value or the default.
MarcMeszaros/envitro
envitro/core.py
bool
def bool(name, default=None, allow_none=False, fallback=None): """Get a boolean based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. opt...
python
def bool(name, default=None, allow_none=False, fallback=None): """Get a boolean based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. opt...
[ "def", "bool", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "=", "fallback", ")", "if", "isin...
Get a boolean based environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
[ "Get", "a", "boolean", "based", "environment", "value", "or", "the", "default", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L124-L141
train
Get a boolean based environment variable value or the default.
MarcMeszaros/envitro
envitro/core.py
int
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
python
def int(name, default=None, allow_none=False, fallback=None): """Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) ...
[ "def", "int", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "=", "fallback", ")", "if", "isins...
Get a string environment value or the default. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional)
[ "Get", "a", "string", "environment", "value", "or", "the", "default", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L144-L159
train
Get a string environment variable value or the default.
MarcMeszaros/envitro
envitro/core.py
list
def list(name, default=None, allow_none=False, fallback=None, separator=','): """Get a list of strings or the default. The individual list elements are whitespace-stripped. Args: name: The environment variable name default: The default value to use if no environment variable is found ...
python
def list(name, default=None, allow_none=False, fallback=None, separator=','): """Get a list of strings or the default. The individual list elements are whitespace-stripped. Args: name: The environment variable name default: The default value to use if no environment variable is found ...
[ "def", "list", "(", "name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ",", "fallback", "=", "None", ",", "separator", "=", "','", ")", ":", "value", "=", "read", "(", "name", ",", "default", ",", "allow_none", ",", "fallback", "="...
Get a list of strings or the default. The individual list elements are whitespace-stripped. Args: name: The environment variable name default: The default value to use if no environment variable is found allow_none: If the return value can be `None` (i.e. optional) separator: T...
[ "Get", "a", "list", "of", "strings", "or", "the", "default", "." ]
19e925cd152c08d4db8126542afed35188cafff4
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L180-L199
train
Get a list of strings or the default.
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/__init__.py
includeme
def includeme(config): """this function adds some configuration for the application""" config.add_route('references', '/references') _add_referencer(config.registry) config.add_view_deriver(protected_resources.protected_view) config.add_renderer('json_item', json_renderer) config.scan()
python
def includeme(config): """this function adds some configuration for the application""" config.add_route('references', '/references') _add_referencer(config.registry) config.add_view_deriver(protected_resources.protected_view) config.add_renderer('json_item', json_renderer) config.scan()
[ "def", "includeme", "(", "config", ")", ":", "config", ".", "add_route", "(", "'references'", ",", "'/references'", ")", "_add_referencer", "(", "config", ".", "registry", ")", "config", ".", "add_view_deriver", "(", "protected_resources", ".", "protected_view", ...
this function adds some configuration for the application
[ "this", "function", "adds", "some", "configuration", "for", "the", "application" ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L17-L23
train
this function adds some configuration for the application
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/__init__.py
_add_referencer
def _add_referencer(registry): """ Gets the Referencer from config and adds it to the registry. """ referencer = registry.queryUtility(IReferencer) if referencer is not None: return referencer ref = registry.settings['urireferencer.referencer'] url = registry.settings['urireferencer....
python
def _add_referencer(registry): """ Gets the Referencer from config and adds it to the registry. """ referencer = registry.queryUtility(IReferencer) if referencer is not None: return referencer ref = registry.settings['urireferencer.referencer'] url = registry.settings['urireferencer....
[ "def", "_add_referencer", "(", "registry", ")", ":", "referencer", "=", "registry", ".", "queryUtility", "(", "IReferencer", ")", "if", "referencer", "is", "not", "None", ":", "return", "referencer", "ref", "=", "registry", ".", "settings", "[", "'urireference...
Gets the Referencer from config and adds it to the registry.
[ "Gets", "the", "Referencer", "from", "config", "and", "adds", "it", "to", "the", "registry", "." ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L26-L37
train
Adds the Referencer to the registry.
OnroerendErfgoed/pyramid_urireferencer
pyramid_urireferencer/__init__.py
get_referencer
def get_referencer(registry): """ Get the referencer class :rtype: pyramid_urireferencer.referencer.AbstractReferencer """ # Argument might be a config or request regis = getattr(registry, 'registry', None) if regis is None: regis = registry return regis.queryUtility(IReferencer...
python
def get_referencer(registry): """ Get the referencer class :rtype: pyramid_urireferencer.referencer.AbstractReferencer """ # Argument might be a config or request regis = getattr(registry, 'registry', None) if regis is None: regis = registry return regis.queryUtility(IReferencer...
[ "def", "get_referencer", "(", "registry", ")", ":", "# Argument might be a config or request", "regis", "=", "getattr", "(", "registry", ",", "'registry'", ",", "None", ")", "if", "regis", "is", "None", ":", "regis", "=", "registry", "return", "regis", ".", "q...
Get the referencer class :rtype: pyramid_urireferencer.referencer.AbstractReferencer
[ "Get", "the", "referencer", "class" ]
c6ee4ba863e32ced304b9cf00f3f5b450757a29a
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L40-L50
train
Get the referencer class
pyBookshelf/bookshelf
bookshelf/api_v3/ec2.py
_connect_to_ec2
def _connect_to_ec2(region, credentials): """ :param region: The region of AWS to connect to. :param EC2Credentials credentials: The credentials to use to authenticate with EC2. :return: a connection object to AWS EC2 """ conn = boto.ec2.connect_to_region( region, aws_ac...
python
def _connect_to_ec2(region, credentials): """ :param region: The region of AWS to connect to. :param EC2Credentials credentials: The credentials to use to authenticate with EC2. :return: a connection object to AWS EC2 """ conn = boto.ec2.connect_to_region( region, aws_ac...
[ "def", "_connect_to_ec2", "(", "region", ",", "credentials", ")", ":", "conn", "=", "boto", ".", "ec2", ".", "connect_to_region", "(", "region", ",", "aws_access_key_id", "=", "credentials", ".", "access_key_id", ",", "aws_secret_access_key", "=", "credentials", ...
:param region: The region of AWS to connect to. :param EC2Credentials credentials: The credentials to use to authenticate with EC2. :return: a connection object to AWS EC2
[ ":", "param", "region", ":", "The", "region", "of", "AWS", "to", "connect", "to", ".", ":", "param", "EC2Credentials", "credentials", ":", "The", "credentials", "to", "use", "to", "authenticate", "with", "EC2", "." ]
a6770678e735de95b194f6e6989223970db5f654
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v3/ec2.py#L65-L82
train
Connect to AWS EC2
kappius/pyheaderfile
pyheaderfile/basefile.py
PyHeaderSheet.write
def write(self, *args, **kwargs): """ :param args: tuple(value, style), tuple(value, style) :param kwargs: header=tuple(value, style), header=tuple(value, style) :param args: value, value :param kwargs: header=value, header=value """ if args: kwargs =...
python
def write(self, *args, **kwargs): """ :param args: tuple(value, style), tuple(value, style) :param kwargs: header=tuple(value, style), header=tuple(value, style) :param args: value, value :param kwargs: header=value, header=value """ if args: kwargs =...
[ "def", "write", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", ":", "kwargs", "=", "dict", "(", "zip", "(", "self", ".", "header", ",", "args", ")", ")", "for", "header", "in", "kwargs", ":", "cell", "=", "kwarg...
:param args: tuple(value, style), tuple(value, style) :param kwargs: header=tuple(value, style), header=tuple(value, style) :param args: value, value :param kwargs: header=value, header=value
[ ":", "param", "args", ":", "tuple", "(", "value", "style", ")", "tuple", "(", "value", "style", ")", ":", "param", "kwargs", ":", "header", "=", "tuple", "(", "value", "style", ")", "header", "=", "tuple", "(", "value", "style", ")", ":", "param", ...
8d587dadae538adcec527fd8e74ad89ed5e2006a
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/basefile.py#L147-L162
train
Writes the contents of the record to the table.
benoitkugler/abstractDataLibrary
pyDLib/GUI/__init__.py
clear_layout
def clear_layout(layout: QLayout) -> None: """Clear the layout off all its components""" if layout is not None: while layout.count(): item = layout.takeAt(0) widget = item.widget() if widget is not None: widget.deleteLater() else: ...
python
def clear_layout(layout: QLayout) -> None: """Clear the layout off all its components""" if layout is not None: while layout.count(): item = layout.takeAt(0) widget = item.widget() if widget is not None: widget.deleteLater() else: ...
[ "def", "clear_layout", "(", "layout", ":", "QLayout", ")", "->", "None", ":", "if", "layout", "is", "not", "None", ":", "while", "layout", ".", "count", "(", ")", ":", "item", "=", "layout", ".", "takeAt", "(", "0", ")", "widget", "=", "item", ".",...
Clear the layout off all its components
[ "Clear", "the", "layout", "off", "all", "its", "components" ]
16be28e99837e40287a63803bbfdf67ac1806b7b
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/__init__.py#L128-L137
train
Clear the layout off all its components
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
_load_hangul_syllable_types
def _load_hangul_syllable_types(): """ Helper function for parsing the contents of "HangulSyllableType.txt" from the Unicode Character Database (UCD) and generating a lookup table for determining whether or not a given Hangul syllable is of type "L", "V", "T", "LV" or "LVT". For more info on the UCD, s...
python
def _load_hangul_syllable_types(): """ Helper function for parsing the contents of "HangulSyllableType.txt" from the Unicode Character Database (UCD) and generating a lookup table for determining whether or not a given Hangul syllable is of type "L", "V", "T", "LV" or "LVT". For more info on the UCD, s...
[ "def", "_load_hangul_syllable_types", "(", ")", ":", "filename", "=", "\"HangulSyllableType.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", ...
Helper function for parsing the contents of "HangulSyllableType.txt" from the Unicode Character Database (UCD) and generating a lookup table for determining whether or not a given Hangul syllable is of type "L", "V", "T", "LV" or "LVT". For more info on the UCD, see the following website: https://www.unicode.o...
[ "Helper", "function", "for", "parsing", "the", "contents", "of", "HangulSyllableType", ".", "txt", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", "for", "determining", "whether", "or", "not", "a...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L10-L29
train
Loads the Hangul syllable types from the Unicode Character Database.
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
_load_jamo_short_names
def _load_jamo_short_names(): """ Function for parsing the Jamo short names from the Unicode Character Database (UCD) and generating a lookup table For more info on how this is used, see the Unicode Standard, ch. 03, section 3.12, "Conjoining Jamo Behavior" and ch. 04, section 4.8, "Name". https://...
python
def _load_jamo_short_names(): """ Function for parsing the Jamo short names from the Unicode Character Database (UCD) and generating a lookup table For more info on how this is used, see the Unicode Standard, ch. 03, section 3.12, "Conjoining Jamo Behavior" and ch. 04, section 4.8, "Name". https://...
[ "def", "_load_jamo_short_names", "(", ")", ":", "filename", "=", "\"Jamo.txt\"", "current_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "with", "codecs", ".", "open", "(", "os", ".", "p...
Function for parsing the Jamo short names from the Unicode Character Database (UCD) and generating a lookup table For more info on how this is used, see the Unicode Standard, ch. 03, section 3.12, "Conjoining Jamo Behavior" and ch. 04, section 4.8, "Name". https://www.unicode.org/versions/latest/ch03.pdf ...
[ "Function", "for", "parsing", "the", "Jamo", "short", "names", "from", "the", "Unicode", "Character", "Database", "(", "UCD", ")", "and", "generating", "a", "lookup", "table", "For", "more", "info", "on", "how", "this", "is", "used", "see", "the", "Unicode...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L32-L51
train
Function for parsing the Jamo short names from the Unicode Character Database and generating a lookup table
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
_get_hangul_syllable_type
def _get_hangul_syllable_type(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property. For more information on the Hangul_Syllable_Type property see the Unicode Standard, ch. 03, section 3.12...
python
def _get_hangul_syllable_type(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property. For more information on the Hangul_Syllable_Type property see the Unicode Standard, ch. 03, section 3.12...
[ "def", "_get_hangul_syllable_type", "(", "hangul_syllable", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value 0x%0.4x does not represent a Hangul syllable!\"", "%", "hangul_syllable", ")", "if", "not", "_h...
Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property. For more information on the Hangul_Syllable_Type property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. https://www.unicode.org/ver...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "determining", "the", "correct", "value", "for", "its", "Hangul_Syllable_Type", "property", ".", "For", "more", "information", "on", "the", "Hangul_Sy...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L78-L93
train
Function for taking a Unicode scalar value representing a Hangul syllable and determining the correct value for its Hangul_Syllable_Type property.
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
_get_jamo_short_name
def _get_jamo_short_name(jamo): """ Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property. For more information on the Jamo_Short_Name property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. http...
python
def _get_jamo_short_name(jamo): """ Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property. For more information on the Jamo_Short_Name property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. http...
[ "def", "_get_jamo_short_name", "(", "jamo", ")", ":", "if", "not", "_is_jamo", "(", "jamo", ")", ":", "raise", "ValueError", "(", "\"Value 0x%0.4x passed in does not represent a Jamo!\"", "%", "jamo", ")", "if", "not", "_jamo_short_names", ":", "_load_jamo_short_names...
Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property. For more information on the Jamo_Short_Name property see the Unicode Standard, ch. 03, section 3.12, Conjoining Jamo Behavior. https://www.unicode.org/versions/latest/ch03.pdf...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Jamo", "and", "determining", "the", "correct", "value", "for", "its", "Jamo_Short_Name", "property", ".", "For", "more", "information", "on", "the", "Jamo_Short_Name", "property"...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L96-L111
train
Function for taking a Unicode scalar value representing a Jamo and determining the correct value for its Jamo_Short_Name property.
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
compose_hangul_syllable
def compose_hangul_syllable(jamo): """ Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable. If the values in the list or tuple passed in are not in the ranges of Jamo, a ValueError will be raised. The algorithm for doing the compositio...
python
def compose_hangul_syllable(jamo): """ Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable. If the values in the list or tuple passed in are not in the ranges of Jamo, a ValueError will be raised. The algorithm for doing the compositio...
[ "def", "compose_hangul_syllable", "(", "jamo", ")", ":", "fmt_str_invalid_sequence", "=", "\"{0} does not represent a valid sequence of Jamo!\"", "if", "len", "(", "jamo", ")", "==", "3", ":", "l_part", ",", "v_part", ",", "t_part", "=", "jamo", "if", "not", "(", ...
Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable. If the values in the list or tuple passed in are not in the ranges of Jamo, a ValueError will be raised. The algorithm for doing the composition is described in the Unicode Standard, ch. 03,...
[ "Function", "for", "taking", "a", "tuple", "or", "list", "of", "Unicode", "scalar", "values", "representing", "Jamo", "and", "composing", "it", "into", "a", "Hangul", "syllable", ".", "If", "the", "values", "in", "the", "list", "or", "tuple", "passed", "in...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L126-L167
train
Function for taking a tuple or list of Unicode scalar values representing Jamo and composing it into a Hangul syllable.
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
decompose_hangul_syllable
def decompose_hangul_syllable(hangul_syllable, fully_decompose=False): """ Function for taking a Unicode scalar value representing a Hangul syllable and decomposing it into a tuple representing the scalar values of the decomposed (canonical decomposition) Jamo. If the Unicode scalar value passed in is ...
python
def decompose_hangul_syllable(hangul_syllable, fully_decompose=False): """ Function for taking a Unicode scalar value representing a Hangul syllable and decomposing it into a tuple representing the scalar values of the decomposed (canonical decomposition) Jamo. If the Unicode scalar value passed in is ...
[ "def", "decompose_hangul_syllable", "(", "hangul_syllable", ",", "fully_decompose", "=", "False", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value passed in does not represent a Hangul syllable!\"", ")", ...
Function for taking a Unicode scalar value representing a Hangul syllable and decomposing it into a tuple representing the scalar values of the decomposed (canonical decomposition) Jamo. If the Unicode scalar value passed in is not in the range of Hangul syllable values (as defined in UnicodeData.txt), a Value...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "decomposing", "it", "into", "a", "tuple", "representing", "the", "scalar", "values", "of", "the", "decomposed", "(", "canonical", "decomposition", ...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L170-L212
train
Function for decomposing a Unicode scalar value representing a Hangul syllable into a tuple of Unicode scalar values l_part v_part t_part.
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
_get_hangul_syllable_name
def _get_hangul_syllable_name(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syll...
python
def _get_hangul_syllable_name(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syll...
[ "def", "_get_hangul_syllable_name", "(", "hangul_syllable", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value passed in does not represent a Hangul syllable!\"", ")", "jamo", "=", "decompose_hangul_syllable", ...
Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syllable: Unicode scalar value representing the Hangul syllable ...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "converting", "it", "to", "its", "syllable", "name", "as", "defined", "by", "the", "Unicode", "naming", "rule", "NR1", ".", "See", "the", "Unico...
c25c882cf9cb38c123df49fad365be67e5818928
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L215-L230
train
Function for converting a Unicode scalar value representing a Hangul syllable to its syllable name as transformed according to the Unicode naming rule NR1.
pymacaron/pymacaron-core
pymacaron_core/swagger/client.py
generate_client_callers
def generate_client_callers(spec, timeout, error_callback, local, app): """Return a dict mapping method names to anonymous functions that will call the server's endpoint of the corresponding name as described in the api defined by the swagger dict and bravado spec""" callers_dict = {} def mycallba...
python
def generate_client_callers(spec, timeout, error_callback, local, app): """Return a dict mapping method names to anonymous functions that will call the server's endpoint of the corresponding name as described in the api defined by the swagger dict and bravado spec""" callers_dict = {} def mycallba...
[ "def", "generate_client_callers", "(", "spec", ",", "timeout", ",", "error_callback", ",", "local", ",", "app", ")", ":", "callers_dict", "=", "{", "}", "def", "mycallback", "(", "endpoint", ")", ":", "if", "not", "endpoint", ".", "handler_client", ":", "r...
Return a dict mapping method names to anonymous functions that will call the server's endpoint of the corresponding name as described in the api defined by the swagger dict and bravado spec
[ "Return", "a", "dict", "mapping", "method", "names", "to", "anonymous", "functions", "that", "will", "call", "the", "server", "s", "endpoint", "of", "the", "corresponding", "name", "as", "described", "in", "the", "api", "defined", "by", "the", "swagger", "di...
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/client.py#L25-L40
train
Generate a dict mapping method names to anonymous functions that will call the server s endpoint of the corresponding name.
pymacaron/pymacaron-core
pymacaron_core/swagger/client.py
ClientCaller._call_retry
def _call_retry(self, force_retry): """Call request and retry up to max_attempts times (or none if self.max_attempts=1)""" last_exception = None for i in range(self.max_attempts): try: log.info("Calling %s %s" % (self.method, self.url)) response = self...
python
def _call_retry(self, force_retry): """Call request and retry up to max_attempts times (or none if self.max_attempts=1)""" last_exception = None for i in range(self.max_attempts): try: log.info("Calling %s %s" % (self.method, self.url)) response = self...
[ "def", "_call_retry", "(", "self", ",", "force_retry", ")", ":", "last_exception", "=", "None", "for", "i", "in", "range", "(", "self", ".", "max_attempts", ")", ":", "try", ":", "log", ".", "info", "(", "\"Calling %s %s\"", "%", "(", "self", ".", "met...
Call request and retry up to max_attempts times (or none if self.max_attempts=1)
[ "Call", "request", "and", "retry", "up", "to", "max_attempts", "times", "(", "or", "none", "if", "self", ".", "max_attempts", "=", "1", ")" ]
95070a39ed7065a84244ff5601fea4d54cc72b66
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/client.py#L270-L333
train
Call the requests_method method and retry up to max_attempts times.
tsnaomi/finnsyll
finnsyll/prev/v05.py
syllabify
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' word = split(word) # detect any non-delimited compounds compound = True if re.search(r'-| |\.', word) else False syllabify = _syllabify_compound if compound else _syllabify syll, rules = syllabify(word) yield syll...
python
def syllabify(word): '''Syllabify the given word, whether simplex or complex.''' word = split(word) # detect any non-delimited compounds compound = True if re.search(r'-| |\.', word) else False syllabify = _syllabify_compound if compound else _syllabify syll, rules = syllabify(word) yield syll...
[ "def", "syllabify", "(", "word", ")", ":", "word", "=", "split", "(", "word", ")", "# detect any non-delimited compounds", "compound", "=", "True", "if", "re", ".", "search", "(", "r'-| |\\.'", ",", "word", ")", "else", "False", "syllabify", "=", "_syllabify...
Syllabify the given word, whether simplex or complex.
[ "Syllabify", "the", "given", "word", "whether", "simplex", "or", "complex", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L64-L81
train
Syllabify the given word whether simplex or complex.
tsnaomi/finnsyll
finnsyll/prev/v05.py
_syllabify
def _syllabify(word, T4=True): '''Syllabify the given word.''' word = replace_umlauts(word) word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) word, T4...
python
def _syllabify(word, T4=True): '''Syllabify the given word.''' word = replace_umlauts(word) word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) word, T4...
[ "def", "_syllabify", "(", "word", ",", "T4", "=", "True", ")", ":", "word", "=", "replace_umlauts", "(", "word", ")", "word", ",", "rules", "=", "apply_T1", "(", "word", ")", "if", "re", ".", "search", "(", "r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*'", ","...
Syllabify the given word.
[ "Syllabify", "the", "given", "word", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L97-L119
train
Syllabify the given word.
tsnaomi/finnsyll
finnsyll/prev/v05.py
apply_T1
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' # split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n'] WORD = [w for w in re.split('([ieAyOauo]+)', word) if w] count = 0 for i, v in enumerate(WORD): if i == 0 and is_consonant(v[0]): ...
python
def apply_T1(word): '''There is a syllable boundary in front of every CV-sequence.''' # split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n'] WORD = [w for w in re.split('([ieAyOauo]+)', word) if w] count = 0 for i, v in enumerate(WORD): if i == 0 and is_consonant(v[0]): ...
[ "def", "apply_T1", "(", "word", ")", ":", "# split consonants and vowels: 'balloon' -> ['b', 'a', 'll', 'oo', 'n']", "WORD", "=", "[", "w", "for", "w", "in", "re", ".", "split", "(", "'([ieAyOauo]+)'", ",", "word", ")", "if", "w", "]", "count", "=", "0", "for"...
There is a syllable boundary in front of every CV-sequence.
[ "There", "is", "a", "syllable", "boundary", "in", "front", "of", "every", "CV", "-", "sequence", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L169-L203
train
This function applies T1 to every CV - sequence.
OLC-Bioinformatics/sipprverse
cgecore/alignment.py
extended_cigar
def extended_cigar(aligned_template, aligned_query): ''' Convert mutation annotations to extended cigar format https://github.com/lh3/minimap2#the-cs-optional-tag USAGE: >>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA' >>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA' >>> extended_cigar(tem...
python
def extended_cigar(aligned_template, aligned_query): ''' Convert mutation annotations to extended cigar format https://github.com/lh3/minimap2#the-cs-optional-tag USAGE: >>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA' >>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA' >>> extended_cigar(tem...
[ "def", "extended_cigar", "(", "aligned_template", ",", "aligned_query", ")", ":", "# - Go through each position in the alignment", "insertion", "=", "[", "]", "deletion", "=", "[", "]", "matches", "=", "[", "]", "cigar", "=", "[", "]", "for", "r_aa", ",", "q...
Convert mutation annotations to extended cigar format https://github.com/lh3/minimap2#the-cs-optional-tag USAGE: >>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA' >>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA' >>> extended_cigar(template, query) == ':6-ata:10+gtc:4*at:3' True
[ "Convert", "mutation", "annotations", "to", "extended", "cigar", "format", "https", ":", "//", "github", ".", "com", "/", "lh3", "/", "minimap2#the", "-", "cs", "-", "optional", "-", "tag", "USAGE", ":", ">>>", "template", "=", "CGATCGATAAATAGAGTAG", "---", ...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L14-L83
train
Convert the alignment of the given template and the given query into an extended cigar.
OLC-Bioinformatics/sipprverse
cgecore/alignment.py
cigar2query
def cigar2query(template, cigar): ''' Generate query sequence from the template and extended cigar annotation USAGE: >>> template = 'CGATCGATAAATAGAGTAGGAATAGCA' >>> cigar = ':6-ata:10+gtc:4*at:3' >>> cigar2query(template, cigar) == 'CGATCGAATAGAGTAGGTCGAATtGCA'.upper() True ''' ...
python
def cigar2query(template, cigar): ''' Generate query sequence from the template and extended cigar annotation USAGE: >>> template = 'CGATCGATAAATAGAGTAGGAATAGCA' >>> cigar = ':6-ata:10+gtc:4*at:3' >>> cigar2query(template, cigar) == 'CGATCGAATAGAGTAGGTCGAATtGCA'.upper() True ''' ...
[ "def", "cigar2query", "(", "template", ",", "cigar", ")", ":", "query", "=", "[", "]", "entries", "=", "[", "'+'", ",", "'-'", ",", "'*'", ",", "':'", "]", "number", "=", "list", "(", "map", "(", "str", ",", "range", "(", "10", ")", ")", ")", ...
Generate query sequence from the template and extended cigar annotation USAGE: >>> template = 'CGATCGATAAATAGAGTAGGAATAGCA' >>> cigar = ':6-ata:10+gtc:4*at:3' >>> cigar2query(template, cigar) == 'CGATCGAATAGAGTAGGTCGAATtGCA'.upper() True
[ "Generate", "query", "sequence", "from", "the", "template", "and", "extended", "cigar", "annotation", "USAGE", ":", ">>>", "template", "=", "CGATCGATAAATAGAGTAGGAATAGCA", ">>>", "cigar", "=", ":", "6", "-", "ata", ":", "10", "+", "gtc", ":", "4", "*", "at"...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L85-L128
train
Generates a query sequence from the template and extended cigar annotation.
OLC-Bioinformatics/sipprverse
cgecore/alignment.py
Blaster
def Blaster(inputfile, databases, db_path, out_path='.', min_cov=0.6, threshold=0.9, blast='blastn', cut_off=True): ''' BLAST wrapper method, that takes a simple input and produces a overview list of the hits to templates, and their alignments Usage >>> import os, subprocess, collections ...
python
def Blaster(inputfile, databases, db_path, out_path='.', min_cov=0.6, threshold=0.9, blast='blastn', cut_off=True): ''' BLAST wrapper method, that takes a simple input and produces a overview list of the hits to templates, and their alignments Usage >>> import os, subprocess, collections ...
[ "def", "Blaster", "(", "inputfile", ",", "databases", ",", "db_path", ",", "out_path", "=", "'.'", ",", "min_cov", "=", "0.6", ",", "threshold", "=", "0.9", ",", "blast", "=", "'blastn'", ",", "cut_off", "=", "True", ")", ":", "min_cov", "=", "100", ...
BLAST wrapper method, that takes a simple input and produces a overview list of the hits to templates, and their alignments Usage >>> import os, subprocess, collections >>> from Bio.Blast import NCBIXML >>> from Bio import SeqIO >>> from string import maketrans >>> inputfile = 't...
[ "BLAST", "wrapper", "method", "that", "takes", "a", "simple", "input", "and", "produces", "a", "overview", "list", "of", "the", "hits", "to", "templates", "and", "their", "alignments", "Usage", ">>>", "import", "os", "subprocess", "collections", ">>>", "from",...
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L130-L325
train
BLAST wrapper method that takes a simple input and produces a overview list of the hits to templates and their alignments.
OLC-Bioinformatics/sipprverse
cgecore/alignment.py
compare_results
def compare_results(save, best_hsp, tmp_results, tmp_gene_split): ''' Function for comparing hits and saving only the best hit ''' # Get data for comparison hit_id = best_hsp['hit_id'] new_start_query = best_hsp['query_start'] new_end_query = best_hsp['query_end'] new_start_sbjct = int(best_hsp['sbjct...
python
def compare_results(save, best_hsp, tmp_results, tmp_gene_split): ''' Function for comparing hits and saving only the best hit ''' # Get data for comparison hit_id = best_hsp['hit_id'] new_start_query = best_hsp['query_start'] new_end_query = best_hsp['query_end'] new_start_sbjct = int(best_hsp['sbjct...
[ "def", "compare_results", "(", "save", ",", "best_hsp", ",", "tmp_results", ",", "tmp_gene_split", ")", ":", "# Get data for comparison", "hit_id", "=", "best_hsp", "[", "'hit_id'", "]", "new_start_query", "=", "best_hsp", "[", "'query_start'", "]", "new_end_query",...
Function for comparing hits and saving only the best hit
[ "Function", "for", "comparing", "hits", "and", "saving", "only", "the", "best", "hit" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L332-L446
train
Function for comparing hits and saving only the best hit
OLC-Bioinformatics/sipprverse
cgecore/alignment.py
calculate_new_length
def calculate_new_length(gene_split, gene_results, hit): ''' Function for calcualting new length if the gene is split on several contigs ''' # Looping over splitted hits and calculate new length first = 1 for split in gene_split[hit['sbjct_header']]: new_start = int(gene_results[split]['sbjct_st...
python
def calculate_new_length(gene_split, gene_results, hit): ''' Function for calcualting new length if the gene is split on several contigs ''' # Looping over splitted hits and calculate new length first = 1 for split in gene_split[hit['sbjct_header']]: new_start = int(gene_results[split]['sbjct_st...
[ "def", "calculate_new_length", "(", "gene_split", ",", "gene_results", ",", "hit", ")", ":", "# Looping over splitted hits and calculate new length", "first", "=", "1", "for", "split", "in", "gene_split", "[", "hit", "[", "'sbjct_header'", "]", "]", ":", "new_start"...
Function for calcualting new length if the gene is split on several contigs
[ "Function", "for", "calcualting", "new", "length", "if", "the", "gene", "is", "split", "on", "several", "contigs" ]
d4f10cdf8e1a39dac0953db61c21c97efc6006de
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L448-L473
train
Function for calcualting new length if the gene is split on several contigs
JoelBender/modpypes
modpypes/app.py
stream_to_packet
def stream_to_packet(data): """ Chop a stream of data into MODBUS packets. :param data: stream of data :returns: a tuple of the data that is a packet with the remaining data, or ``None`` """ if len(data) < 6: return None # unpack the length pktlen = struct.unpack(">H", ...
python
def stream_to_packet(data): """ Chop a stream of data into MODBUS packets. :param data: stream of data :returns: a tuple of the data that is a packet with the remaining data, or ``None`` """ if len(data) < 6: return None # unpack the length pktlen = struct.unpack(">H", ...
[ "def", "stream_to_packet", "(", "data", ")", ":", "if", "len", "(", "data", ")", "<", "6", ":", "return", "None", "# unpack the length", "pktlen", "=", "struct", ".", "unpack", "(", "\">H\"", ",", "data", "[", "4", ":", "6", "]", ")", "[", "0", "]"...
Chop a stream of data into MODBUS packets. :param data: stream of data :returns: a tuple of the data that is a packet with the remaining data, or ``None``
[ "Chop", "a", "stream", "of", "data", "into", "MODBUS", "packets", "." ]
f6e33c48fdc70f873bc2823b1ac4111cafe2a700
https://github.com/JoelBender/modpypes/blob/f6e33c48fdc70f873bc2823b1ac4111cafe2a700/modpypes/app.py#L61-L77
train
Chop a stream of data into MODBUS packets.
QunarOPS/qg.core
qg/core/jsonutils.py
to_primitive
def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. ...
python
def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. ...
[ "def", "to_primitive", "(", "value", ",", "convert_instances", "=", "False", ",", "convert_datetime", "=", "True", ",", "level", "=", "0", ",", "max_depth", "=", "3", ")", ":", "# handle obvious types first - order of basic types determined by running", "# full tests on...
Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. To handle cyclical data structures we could track the actual objects visited in a set, but not all objects are...
[ "Convert", "a", "complex", "object", "into", "primitives", "." ]
d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/jsonutils.py#L63-L156
train
Convert a complex object into a primitive object.
tsnaomi/finnsyll
finnsyll/phonology.py
get_vowel
def get_vowel(syll): '''Return the firstmost vowel in 'syll'.''' return re.search(r'([ieaouäöy]{1})', syll, flags=FLAGS).group(1).upper()
python
def get_vowel(syll): '''Return the firstmost vowel in 'syll'.''' return re.search(r'([ieaouäöy]{1})', syll, flags=FLAGS).group(1).upper()
[ "def", "get_vowel", "(", "syll", ")", ":", "return", "re", ".", "search", "(", "r'([ieaouäöy]{1})', ", "s", "ll, ", "f", "ags=F", "L", "AGS).", "g", "r", "oup(1", ")", ".", "u", "p", "per()", "", "" ]
Return the firstmost vowel in 'syll'.
[ "Return", "the", "firstmost", "vowel", "in", "syll", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L88-L90
train
Return the first most vowel in syllll.
tsnaomi/finnsyll
finnsyll/phonology.py
is_light
def is_light(syll): '''Return True if 'syll' is light.''' return re.match(r'(^|[^ieaouäöy]+)[ieaouäöy]{1}$', syll, flags=FLAGS)
python
def is_light(syll): '''Return True if 'syll' is light.''' return re.match(r'(^|[^ieaouäöy]+)[ieaouäöy]{1}$', syll, flags=FLAGS)
[ "def", "is_light", "(", "syll", ")", ":", "return", "re", ".", "match", "(", "r'(^|[^ieaouäöy]+)[ieaouäöy]{1}$', sy", "l", ", fl", "a", "s=FLA", "G", "S)", "" ]
Return True if 'syll' is light.
[ "Return", "True", "if", "syll", "is", "light", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L98-L100
train
Return True if syllll is light.
tsnaomi/finnsyll
finnsyll/phonology.py
stress
def stress(syllabified_simplex_word): '''Assign primary and secondary stress to 'syllabified_simplex_word'.''' syllables = syllabified_simplex_word.split('.') stressed = '\'' + syllables[0] # primary stress try: n = 0 medial = syllables[1:-1] for i, syll in enumerate(medial): ...
python
def stress(syllabified_simplex_word): '''Assign primary and secondary stress to 'syllabified_simplex_word'.''' syllables = syllabified_simplex_word.split('.') stressed = '\'' + syllables[0] # primary stress try: n = 0 medial = syllables[1:-1] for i, syll in enumerate(medial): ...
[ "def", "stress", "(", "syllabified_simplex_word", ")", ":", "syllables", "=", "syllabified_simplex_word", ".", "split", "(", "'.'", ")", "stressed", "=", "'\\''", "+", "syllables", "[", "0", "]", "# primary stress", "try", ":", "n", "=", "0", "medial", "=", ...
Assign primary and secondary stress to 'syllabified_simplex_word'.
[ "Assign", "primary", "and", "secondary", "stress", "to", "syllabified_simplex_word", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L108-L141
train
Assign primary and secondary stress to syllabified_simplex_word.
tsnaomi/finnsyll
finnsyll/phonology.py
sonseq
def sonseq(word): '''Return True if 'word' does not violate sonority sequencing.''' parts = re.split(r'([ieaouäöy]+)', word, flags=re.I | re.U) onset, coda = parts[0], parts[-1] # simplex onset Finnish complex onset if len(onset) <= 1 or onset.lower() in ONSETS: # simplex coda ...
python
def sonseq(word): '''Return True if 'word' does not violate sonority sequencing.''' parts = re.split(r'([ieaouäöy]+)', word, flags=re.I | re.U) onset, coda = parts[0], parts[-1] # simplex onset Finnish complex onset if len(onset) <= 1 or onset.lower() in ONSETS: # simplex coda ...
[ "def", "sonseq", "(", "word", ")", ":", "parts", "=", "re", ".", "split", "(", "r'([ieaouäöy]+)', ", "w", "rd, ", "f", "ags=r", "e", ".I", " ", "|", "r", ".U", ")", "", "", "onset", ",", "coda", "=", "parts", "[", "0", "]", ",", "parts", "[", ...
Return True if 'word' does not violate sonority sequencing.
[ "Return", "True", "if", "word", "does", "not", "violate", "sonority", "sequencing", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L154-L164
train
Return True if word violates sonority sequencing.
tsnaomi/finnsyll
finnsyll/phonology.py
harmonic
def harmonic(word): '''Return True if the word's vowels agree in frontness/backness.''' depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1} vowels = filter(lambda ch: is_front(ch) or is_back(ch), word) depths = (depth[x.lower()] for x in vowels) return len(set(depths)) < 2
python
def harmonic(word): '''Return True if the word's vowels agree in frontness/backness.''' depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1} vowels = filter(lambda ch: is_front(ch) or is_back(ch), word) depths = (depth[x.lower()] for x in vowels) return len(set(depths)) < 2
[ "def", "harmonic", "(", "word", ")", ":", "depth", "=", "{", "'ä':", " ", ",", " ", "ö': ", "0", " ", "'", "': ", "0", " ", "'", "': ", "1", " ", "'", "': ", "1", " ", "'", "': ", "1", "", "", "vowels", "=", "filter", "(", "lambda", "ch", ...
Return True if the word's vowels agree in frontness/backness.
[ "Return", "True", "if", "the", "word", "s", "vowels", "agree", "in", "frontness", "/", "backness", "." ]
6a42740311688c946a636a3e2304866c7aa041b3
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L172-L178
train
Return True if the word s vowels agree in frontness or backness.
saltant-org/saltant-py
saltant/models/executable_task_type.py
ExecutableTaskType.put
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated. """ return self.manager.pu...
python
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated. """ return self.manager.pu...
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "command_to_run", "=", "self", "....
Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated.
[ "Updates", "this", "task", "type", "on", "the", "saltant", "server", "." ]
bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/executable_task_type.py#L84-L103
train
Updates this task type on the saltant server.