repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
moralrecordings/mrcrowbar
mrcrowbar/refs.py
property_set
def property_set( prop, instance, value, **kwargs ): """Wrapper for property writes which auto-deferences Refs. prop A Ref (which gets dereferenced and the target value set). instance The context object used to dereference the Ref. value The value to set the property to. ...
python
def property_set( prop, instance, value, **kwargs ): """Wrapper for property writes which auto-deferences Refs. prop A Ref (which gets dereferenced and the target value set). instance The context object used to dereference the Ref. value The value to set the property to. ...
[ "def", "property_set", "(", "prop", ",", "instance", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "prop", ",", "Ref", ")", ":", "return", "prop", ".", "set", "(", "instance", ",", "value", ",", "*", "*", "kwargs", ")", ...
Wrapper for property writes which auto-deferences Refs. prop A Ref (which gets dereferenced and the target value set). instance The context object used to dereference the Ref. value The value to set the property to. Throws AttributeError if prop is not a Ref.
[ "Wrapper", "for", "property", "writes", "which", "auto", "-", "deferences", "Refs", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L115-L132
moralrecordings/mrcrowbar
mrcrowbar/refs.py
view_property
def view_property( prop ): """Wrapper for attributes of a View class which auto-dereferences Refs. Equivalent to setting a property on the class with the getter wrapped with property_get(), and the setter wrapped with property_set(). prop A string containing the name of the class attribute...
python
def view_property( prop ): """Wrapper for attributes of a View class which auto-dereferences Refs. Equivalent to setting a property on the class with the getter wrapped with property_get(), and the setter wrapped with property_set(). prop A string containing the name of the class attribute...
[ "def", "view_property", "(", "prop", ")", ":", "def", "getter", "(", "self", ")", ":", "return", "property_get", "(", "getattr", "(", "self", ",", "prop", ")", ",", "self", ".", "parent", ")", "def", "setter", "(", "self", ",", "value", ")", ":", "...
Wrapper for attributes of a View class which auto-dereferences Refs. Equivalent to setting a property on the class with the getter wrapped with property_get(), and the setter wrapped with property_set(). prop A string containing the name of the class attribute to wrap.
[ "Wrapper", "for", "attributes", "of", "a", "View", "class", "which", "auto", "-", "dereferences", "Refs", ".", "Equivalent", "to", "setting", "a", "property", "on", "the", "class", "with", "the", "getter", "wrapped", "with", "property_get", "()", "and", "the...
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L135-L150
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L33-L42
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/refs.py#L44-L61
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", "." ]
train
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/shortcuts.py#L6-L16
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L19-L39
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L41-L64
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L66-L99
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", "...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L107-L213
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L215-L275
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",...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L278-L342
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...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L345-L403
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointsippr/pointsippr.py#L426-L467
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L33-L45
OLC-Bioinformatics/sipprverse
genesippr_validation.py
ReadPrep.sequence_prep
def sequence_prep(self): """ Create metadata objects for all PacBio assembly FASTA files in the sequencepath. Create individual subdirectories for each sample. Relative symlink the original FASTA file to the appropriate subdirectory """ # Create a sorted list of all the...
python
def sequence_prep(self): """ Create metadata objects for all PacBio assembly FASTA files in the sequencepath. Create individual subdirectories for each sample. Relative symlink the original FASTA file to the appropriate subdirectory """ # Create a sorted list of all the...
[ "def", "sequence_prep", "(", "self", ")", ":", "# Create a sorted list of all the FASTA files in the sequence path", "strains", "=", "sorted", "(", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "fastapath", ",", "'*.fa*'", ".", "format", "(", "s...
Create metadata objects for all PacBio assembly FASTA files in the sequencepath. Create individual subdirectories for each sample. Relative symlink the original FASTA file to the appropriate subdirectory
[ "Create", "metadata", "objects", "for", "all", "PacBio", "assembly", "FASTA", "files", "in", "the", "sequencepath", ".", "Create", "individual", "subdirectories", "for", "each", "sample", ".", "Relative", "symlink", "the", "original", "FASTA", "file", "to", "the...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L47-L89
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L92-L100
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L103-L120
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L122-L135
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...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L137-L295
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L297-L378
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L380-L470
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L472-L535
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", ...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L537-L584
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/genesippr_validation.py#L586-L620
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L87-L96
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L98-L111
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L113-L128
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L130-L145
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L147-L199
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L201-L241
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L244-L272
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L274-L333
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", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L474-L485
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v08.py#L18-L31
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"...
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v08.py#L189-L217
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", "." ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L351-L357
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", "." ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L486-L507
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", "." ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/log.py#L509-L528
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", ")" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L93-L99
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" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L101-L105
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" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L107-L114
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", "." ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/app.py#L160-L172
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", "." ]
train
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L23-L32
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", "." ]
train
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L97-L116
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", "." ]
train
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L118-L131
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", "." ]
train
https://github.com/ProjetPP/PPP-libmodule-Python/blob/8098ec3e3ac62f471ff93fb8ce29e36833a8d492/ppp_libmodule/http.py#L137-L144
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", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/user.py#L35-L47
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L193-L196
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L198-L208
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L210-L255
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L258-L282
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L284-L290
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L292-L298
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", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/blocks.py#L300-L308
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", "." ]
train
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L70-L95
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", "." ]
train
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L97-L112
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", "." ]
train
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L114-L136
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", "." ]
train
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L138-L160
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", "." ]
train
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L162-L184
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", "." ]
train
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L186-L203
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" ]
train
https://github.com/Clever/kayvee-python/blob/9d1cc96d592148bc3bd8f11f9e6ed03255985882/kayvee/kayvee.py#L7-L26
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", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L101-L123
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", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L142-L207
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", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/container_task_type.py#L209-L273
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", ")", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L18-L31
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L34-L41
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L53-L65
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L73-L101
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L109-L121
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L124-L141
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L144-L159
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", "." ]
train
https://github.com/MarcMeszaros/envitro/blob/19e925cd152c08d4db8126542afed35188cafff4/envitro/core.py#L180-L199
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" ]
train
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L17-L23
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", "." ]
train
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L26-L37
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" ]
train
https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/__init__.py#L40-L50
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", "." ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v3/ec2.py#L65-L82
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", ...
train
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/basefile.py#L147-L162
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" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/__init__.py#L128-L137
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...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L10-L29
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...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L32-L51
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...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L78-L93
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"...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L96-L111
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...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L126-L167
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", ...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L170-L212
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...
train
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L215-L230
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...
train
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/client.py#L25-L40
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", ")" ]
train
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/client.py#L270-L333
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L64-L81
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L97-L119
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v05.py#L169-L203
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", "---", ...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L14-L83
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"...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L85-L128
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",...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L130-L325
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L332-L446
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" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/alignment.py#L448-L473
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", "." ]
train
https://github.com/JoelBender/modpypes/blob/f6e33c48fdc70f873bc2823b1ac4111cafe2a700/modpypes/app.py#L61-L77
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", "." ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/jsonutils.py#L63-L156
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L88-L90
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L98-L100
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", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L108-L141