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
tsnaomi/finnsyll
finnsyll/phonology.py
sonseq
def sonseq(word): '''Return True if 'word' does not violate sonority sequencing.''' parts = re.split(r'([ieaouäöy]+)', word, flags=re.I | re.U) onset, coda = parts[0], parts[-1] # simplex onset Finnish complex onset if len(onset) <= 1 or onset.lower() in ONSETS: # simplex coda ...
python
def sonseq(word): '''Return True if 'word' does not violate sonority sequencing.''' parts = re.split(r'([ieaouäöy]+)', word, flags=re.I | re.U) onset, coda = parts[0], parts[-1] # simplex onset Finnish complex onset if len(onset) <= 1 or onset.lower() in ONSETS: # simplex coda ...
[ "def", "sonseq", "(", "word", ")", ":", "parts", "=", "re", ".", "split", "(", "r'([ieaouäöy]+)', ", "w", "rd, ", "f", "ags=r", "e", ".I", " ", "|", "r", ".U", ")", "", "", "onset", ",", "coda", "=", "parts", "[", "0", "]", ",", "parts", "[", ...
Return True if 'word' does not violate sonority sequencing.
[ "Return", "True", "if", "word", "does", "not", "violate", "sonority", "sequencing", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L154-L164
tsnaomi/finnsyll
finnsyll/phonology.py
harmonic
def harmonic(word): '''Return True if the word's vowels agree in frontness/backness.''' depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1} vowels = filter(lambda ch: is_front(ch) or is_back(ch), word) depths = (depth[x.lower()] for x in vowels) return len(set(depths)) < 2
python
def harmonic(word): '''Return True if the word's vowels agree in frontness/backness.''' depth = {'ä': 0, 'ö': 0, 'y': 0, 'a': 1, 'o': 1, 'u': 1} vowels = filter(lambda ch: is_front(ch) or is_back(ch), word) depths = (depth[x.lower()] for x in vowels) return len(set(depths)) < 2
[ "def", "harmonic", "(", "word", ")", ":", "depth", "=", "{", "'ä':", " ", ",", " ", "ö': ", "0", " ", "'", "': ", "0", " ", "'", "': ", "1", " ", "'", "': ", "1", " ", "'", "': ", "1", "", "", "vowels", "=", "filter", "(", "lambda", "ch", ...
Return True if the word's vowels agree in frontness/backness.
[ "Return", "True", "if", "the", "word", "s", "vowels", "agree", "in", "frontness", "/", "backness", "." ]
train
https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/phonology.py#L172-L178
saltant-org/saltant-py
saltant/models/executable_task_type.py
ExecutableTaskType.put
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated. """ return self.manager.pu...
python
def put(self): """Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated. """ return self.manager.pu...
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "command_to_run", "=", "self", "....
Updates this task type on the saltant server. Returns: :class:`saltant.models.container_task_type.ExecutableTaskType`: An executable task type model instance representing the task type just updated.
[ "Updates", "this", "task", "type", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/executable_task_type.py#L84-L103
saltant-org/saltant-py
saltant/models/executable_task_type.py
ExecutableTaskTypeManager.create
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, json_file_option=None, extra_data_to_post=None, ): """Create a container task type. ...
python
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, json_file_option=None, extra_data_to_post=None, ): """Create a container task type. ...
[ "def", "create", "(", "self", ",", "name", ",", "command_to_run", ",", "description", "=", "\"\"", ",", "environment_variables", "=", "None", ",", "required_arguments", "=", "None", ",", "required_arguments_default_values", "=", "None", ",", "json_file_option", "=...
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. description (str, optional): The description of the task type. environment_variables (list, optional): The environment ...
[ "Create", "a", "container", "task", "type", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/executable_task_type.py#L122-L172
saltant-org/saltant-py
saltant/models/executable_task_type.py
ExecutableTaskTypeManager.put
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, json_file_option, extra_data_to_put=None, ): """Updates a task type on the saltant server. ...
python
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, json_file_option, extra_data_to_put=None, ): """Updates a task type on the saltant server. ...
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "command_to_run", ",", "environment_variables", ",", "required_arguments", ",", "required_arguments_default_values", ",", "json_file_option", ",", "extra_data_to_put", "=", "None", ",", ")",...
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/executable_task_type.py#L174-L223
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.reporter
def reporter(self, analysistype='genesippr'): """ Creates a report of the genesippr results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Create a dictionary to link ...
python
def reporter(self, analysistype='genesippr'): """ Creates a report of the genesippr results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Create a dictionary to link ...
[ "def", "reporter", "(", "self", ",", "analysistype", "=", "'genesippr'", ")", ":", "logging", ".", "info", "(", "'Creating {} report'", ".", "format", "(", "analysistype", ")", ")", "# Create a dictionary to link all the genera with their genes", "genusgenes", "=", "d...
Creates a report of the genesippr results :param analysistype: The variable to use when accessing attributes in the metadata object
[ "Creates", "a", "report", "of", "the", "genesippr", "results", ":", "param", "analysistype", ":", "The", "variable", "to", "use", "when", "accessing", "attributes", "in", "the", "metadata", "object" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L24-L115
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.genusspecific
def genusspecific(self, analysistype='genesippr'): """ Creates simplified genus-specific reports. Instead of the % ID and the fold coverage, a simple +/- scheme is used for presence/absence :param analysistype: The variable to use when accessing attributes in the metadata object ...
python
def genusspecific(self, analysistype='genesippr'): """ Creates simplified genus-specific reports. Instead of the % ID and the fold coverage, a simple +/- scheme is used for presence/absence :param analysistype: The variable to use when accessing attributes in the metadata object ...
[ "def", "genusspecific", "(", "self", ",", "analysistype", "=", "'genesippr'", ")", ":", "# Dictionary to store all the output strings", "results", "=", "dict", "(", ")", "for", "genus", ",", "genelist", "in", "self", ".", "genedict", ".", "items", "(", ")", ":...
Creates simplified genus-specific reports. Instead of the % ID and the fold coverage, a simple +/- scheme is used for presence/absence :param analysistype: The variable to use when accessing attributes in the metadata object
[ "Creates", "simplified", "genus", "-", "specific", "reports", ".", "Instead", "of", "the", "%", "ID", "and", "the", "fold", "coverage", "a", "simple", "+", "/", "-", "scheme", "is", "used", "for", "presence", "/", "absence", ":", "param", "analysistype", ...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L117-L155
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.gdcsreporter
def gdcsreporter(self, analysistype='GDCS'): """ Creates a report of the GDCS results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Initialise list to store all the G...
python
def gdcsreporter(self, analysistype='GDCS'): """ Creates a report of the GDCS results :param analysistype: The variable to use when accessing attributes in the metadata object """ logging.info('Creating {} report'.format(analysistype)) # Initialise list to store all the G...
[ "def", "gdcsreporter", "(", "self", ",", "analysistype", "=", "'GDCS'", ")", ":", "logging", ".", "info", "(", "'Creating {} report'", ".", "format", "(", "analysistype", ")", ")", "# Initialise list to store all the GDCS genes, and genera in the analysis", "gdcs", "=",...
Creates a report of the GDCS results :param analysistype: The variable to use when accessing attributes in the metadata object
[ "Creates", "a", "report", "of", "the", "GDCS", "results", ":", "param", "analysistype", ":", "The", "variable", "to", "use", "when", "accessing", "attributes", "in", "the", "metadata", "object" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L157-L260
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.gdcs_fai
def gdcs_fai(sample, analysistype='GDCS'): """ GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following reverse baiting :param sample: sample object :param analysistype: current analysis being performed """ try: ...
python
def gdcs_fai(sample, analysistype='GDCS'): """ GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following reverse baiting :param sample: sample object :param analysistype: current analysis being performed """ try: ...
[ "def", "gdcs_fai", "(", "sample", ",", "analysistype", "=", "'GDCS'", ")", ":", "try", ":", "# Find the .fai file in the target path", "sample", "[", "analysistype", "]", ".", "faifile", "=", "glob", "(", "os", ".", "path", ".", "join", "(", "sample", "[", ...
GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following reverse baiting :param sample: sample object :param analysistype: current analysis being performed
[ "GDCS", "analyses", "need", "to", "use", "the", ".", "fai", "file", "supplied", "in", "the", "targets", "folder", "rather", "than", "the", "one", "created", "following", "reverse", "baiting", ":", "param", "sample", ":", "sample", "object", ":", "param", "...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L263-L289
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.sixteensreporter
def sixteensreporter(self, analysistype='sixteens_full'): """ Creates a report of the results :param analysistype: The variable to use when accessing attributes in the metadata object """ # Create the path in which the reports are stored make_path(self.reportpath) ...
python
def sixteensreporter(self, analysistype='sixteens_full'): """ Creates a report of the results :param analysistype: The variable to use when accessing attributes in the metadata object """ # Create the path in which the reports are stored make_path(self.reportpath) ...
[ "def", "sixteensreporter", "(", "self", ",", "analysistype", "=", "'sixteens_full'", ")", ":", "# Create the path in which the reports are stored", "make_path", "(", "self", ".", "reportpath", ")", "# Initialise the header and data strings", "header", "=", "'Strain,Gene,Perce...
Creates a report of the results :param analysistype: The variable to use when accessing attributes in the metadata object
[ "Creates", "a", "report", "of", "the", "results", ":", "param", "analysistype", ":", "The", "variable", "to", "use", "when", "accessing", "attributes", "in", "the", "metadata", "object" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L291-L326
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.confindr_reporter
def confindr_reporter(self, analysistype='confindr'): """ Creates a final report of all the ConFindr results """ # Initialise the data strings data = 'Strain,Genus,NumContamSNVs,ContamStatus,PercentContam,PercentContamSTD\n' with open(os.path.join(self.reportpath, analysi...
python
def confindr_reporter(self, analysistype='confindr'): """ Creates a final report of all the ConFindr results """ # Initialise the data strings data = 'Strain,Genus,NumContamSNVs,ContamStatus,PercentContam,PercentContamSTD\n' with open(os.path.join(self.reportpath, analysi...
[ "def", "confindr_reporter", "(", "self", ",", "analysistype", "=", "'confindr'", ")", ":", "# Initialise the data strings", "data", "=", "'Strain,Genus,NumContamSNVs,ContamStatus,PercentContam,PercentContamSTD\\n'", "with", "open", "(", "os", ".", "path", ".", "join", "("...
Creates a final report of all the ConFindr results
[ "Creates", "a", "final", "report", "of", "all", "the", "ConFindr", "results" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L328-L346
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
Reports.methodreporter
def methodreporter(self): """ Create final reports collating results from all the individual iterations through the method pipeline """ # Ensure that the analyses are set to complete self.analysescomplete = True # Reset the report path to original value self.repor...
python
def methodreporter(self): """ Create final reports collating results from all the individual iterations through the method pipeline """ # Ensure that the analyses are set to complete self.analysescomplete = True # Reset the report path to original value self.repor...
[ "def", "methodreporter", "(", "self", ")", ":", "# Ensure that the analyses are set to complete", "self", ".", "analysescomplete", "=", "True", "# Reset the report path to original value", "self", ".", "reportpath", "=", "os", ".", "path", ".", "join", "(", "self", "....
Create final reports collating results from all the individual iterations through the method pipeline
[ "Create", "final", "reports", "collating", "results", "from", "all", "the", "individual", "iterations", "through", "the", "method", "pipeline" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L348-L371
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
ReportImage.main
def main(self): """ Run the methods required to create the genesippr report summary image """ self.dataframe_setup() self.figure_populate(self.outputfolder, self.image_report, self.header_list, ...
python
def main(self): """ Run the methods required to create the genesippr report summary image """ self.dataframe_setup() self.figure_populate(self.outputfolder, self.image_report, self.header_list, ...
[ "def", "main", "(", "self", ")", ":", "self", ".", "dataframe_setup", "(", ")", "self", ".", "figure_populate", "(", "self", ".", "outputfolder", ",", "self", ".", "image_report", ",", "self", ".", "header_list", ",", "self", ".", "samples", ",", "'genes...
Run the methods required to create the genesippr report summary image
[ "Run", "the", "methods", "required", "to", "create", "the", "genesippr", "report", "summary", "image" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L417-L428
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
ReportImage.data_sanitise
def data_sanitise(self, inputstring, header=None): """ Format the data to be consistent with heatmaps :param inputstring: string containing data to be formatted :param header: class of the data - certain categories have specific formatting requirements :return: the formatted outp...
python
def data_sanitise(self, inputstring, header=None): """ Format the data to be consistent with heatmaps :param inputstring: string containing data to be formatted :param header: class of the data - certain categories have specific formatting requirements :return: the formatted outp...
[ "def", "data_sanitise", "(", "self", ",", "inputstring", ",", "header", "=", "None", ")", ":", "if", "str", "(", "inputstring", ")", "==", "'nan'", ":", "outputstring", "=", "0", "elif", "'%'", "in", "str", "(", "inputstring", ")", ":", "group", "=", ...
Format the data to be consistent with heatmaps :param inputstring: string containing data to be formatted :param header: class of the data - certain categories have specific formatting requirements :return: the formatted output string
[ "Format", "the", "data", "to", "be", "consistent", "with", "heatmaps", ":", "param", "inputstring", ":", "string", "containing", "data", "to", "be", "formatted", ":", "param", "header", ":", "class", "of", "the", "data", "-", "certain", "categories", "have",...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L430-L463
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
ReportImage.dataframe_setup
def dataframe_setup(self): """ Set-up a report to store the desired header: sanitized string combinations """ # Initialise a dictionary to store the sanitized headers and strings genesippr_dict = dict() # Try to open all the reports - use pandas to extract the results fro...
python
def dataframe_setup(self): """ Set-up a report to store the desired header: sanitized string combinations """ # Initialise a dictionary to store the sanitized headers and strings genesippr_dict = dict() # Try to open all the reports - use pandas to extract the results fro...
[ "def", "dataframe_setup", "(", "self", ")", ":", "# Initialise a dictionary to store the sanitized headers and strings", "genesippr_dict", "=", "dict", "(", ")", "# Try to open all the reports - use pandas to extract the results from any report that exists", "try", ":", "sippr_matrix",...
Set-up a report to store the desired header: sanitized string combinations
[ "Set", "-", "up", "a", "report", "to", "store", "the", "desired", "header", ":", "sanitized", "string", "combinations" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L465-L551
OLC-Bioinformatics/sipprverse
sipprverse_reporter/reports.py
ReportImage.figure_populate
def figure_populate(outputpath, csv, xlabels, ylabels, analysistype, description, fail=False): """ Create the report image from the summary report created in self.dataframesetup :param outputpath: Path in which the outputs are to be created :param csv: Name of the report file from which ...
python
def figure_populate(outputpath, csv, xlabels, ylabels, analysistype, description, fail=False): """ Create the report image from the summary report created in self.dataframesetup :param outputpath: Path in which the outputs are to be created :param csv: Name of the report file from which ...
[ "def", "figure_populate", "(", "outputpath", ",", "csv", ",", "xlabels", ",", "ylabels", ",", "analysistype", ",", "description", ",", "fail", "=", "False", ")", ":", "# Create a data frame from the summary report", "df", "=", "pd", ".", "read_csv", "(", "os", ...
Create the report image from the summary report created in self.dataframesetup :param outputpath: Path in which the outputs are to be created :param csv: Name of the report file from which data are to be extracted :param xlabels: List of all the labels to use on the x-axis :param ylabels...
[ "Create", "the", "report", "image", "from", "the", "summary", "report", "created", "in", "self", ".", "dataframesetup", ":", "param", "outputpath", ":", "Path", "in", "which", "the", "outputs", "are", "to", "be", "created", ":", "param", "csv", ":", "Name"...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sipprverse_reporter/reports.py#L554-L600
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
add_usr_local_bin_to_path
def add_usr_local_bin_to_path(log=False): """ adds /usr/local/bin to $PATH """ if log: bookshelf2.logging_helpers.log_green('inserts /usr/local/bin into PATH') with settings(hide('warnings', 'running', 'stdout', 'stderr'), capture=True): try: sudo('echo "export...
python
def add_usr_local_bin_to_path(log=False): """ adds /usr/local/bin to $PATH """ if log: bookshelf2.logging_helpers.log_green('inserts /usr/local/bin into PATH') with settings(hide('warnings', 'running', 'stdout', 'stderr'), capture=True): try: sudo('echo "export...
[ "def", "add_usr_local_bin_to_path", "(", "log", "=", "False", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_green", "(", "'inserts /usr/local/bin into PATH'", ")", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ...
adds /usr/local/bin to $PATH
[ "adds", "/", "usr", "/", "local", "/", "bin", "to", "$PATH" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L12-L24
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
dir_attribs
def dir_attribs(location, mode=None, owner=None, group=None, recursive=False, use_sudo=False): """ cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.""" args = '' if recursive: args = args + ' -R ' if...
python
def dir_attribs(location, mode=None, owner=None, group=None, recursive=False, use_sudo=False): """ cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.""" args = '' if recursive: args = args + ' -R ' if...
[ "def", "dir_attribs", "(", "location", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "recursive", "=", "False", ",", "use_sudo", "=", "False", ")", ":", "args", "=", "''", "if", "recursive", ":", "args", "=", ...
cuisine dir_attribs doesn't do sudo, so we implement our own Updates the mode/owner/group for the given remote directory.
[ "cuisine", "dir_attribs", "doesn", "t", "do", "sudo", "so", "we", "implement", "our", "own", "Updates", "the", "mode", "/", "owner", "/", "group", "for", "the", "given", "remote", "directory", "." ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L35-L58
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
dir_ensure
def dir_ensure(location, recursive=False, mode=None, owner=None, group=None, use_sudo=False): """ cuisine dir_ensure doesn't do sudo, so we implement our own Ensures that there is a remote directory at the given location, optionally updating its mode/owner/group. If we are not updating th...
python
def dir_ensure(location, recursive=False, mode=None, owner=None, group=None, use_sudo=False): """ cuisine dir_ensure doesn't do sudo, so we implement our own Ensures that there is a remote directory at the given location, optionally updating its mode/owner/group. If we are not updating th...
[ "def", "dir_ensure", "(", "location", ",", "recursive", "=", "False", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "use_sudo", "=", "False", ")", ":", "args", "=", "''", "if", "recursive", ":", "args", "=", "...
cuisine dir_ensure doesn't do sudo, so we implement our own Ensures that there is a remote directory at the given location, optionally updating its mode/owner/group. If we are not updating the owner/group then this can be done as a single ssh call, so use that method, otherwise set owner/group after cre...
[ "cuisine", "dir_ensure", "doesn", "t", "do", "sudo", "so", "we", "implement", "our", "own", "Ensures", "that", "there", "is", "a", "remote", "directory", "at", "the", "given", "location", "optionally", "updating", "its", "mode", "/", "owner", "/", "group", ...
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L61-L93
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
dir_exists
def dir_exists(location, use_sudo=False): """Tells if there is a remote directory at the given location.""" with settings(hide('running', 'stdout', 'stderr'), warn_only=True): if use_sudo: # convert return code 0 to True return not bool(sudo('test -d %s' % (location)).return_code...
python
def dir_exists(location, use_sudo=False): """Tells if there is a remote directory at the given location.""" with settings(hide('running', 'stdout', 'stderr'), warn_only=True): if use_sudo: # convert return code 0 to True return not bool(sudo('test -d %s' % (location)).return_code...
[ "def", "dir_exists", "(", "location", ",", "use_sudo", "=", "False", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ")", ":", "if", "use_sudo", ":", "# convert return code ...
Tells if there is a remote directory at the given location.
[ "Tells", "if", "there", "is", "a", "remote", "directory", "at", "the", "given", "location", "." ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L96-L103
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
disable_env_reset_on_sudo
def disable_env_reset_on_sudo(log=False): """ updates /etc/sudoers so that users from %wheel keep their environment when executing a sudo call """ if log: bookshelf2.logging_helpers.log_green('disabling env reset on sudo') file_append('/etc/sudoers', 'Defaults:%wheel !en...
python
def disable_env_reset_on_sudo(log=False): """ updates /etc/sudoers so that users from %wheel keep their environment when executing a sudo call """ if log: bookshelf2.logging_helpers.log_green('disabling env reset on sudo') file_append('/etc/sudoers', 'Defaults:%wheel !en...
[ "def", "disable_env_reset_on_sudo", "(", "log", "=", "False", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_green", "(", "'disabling env reset on sudo'", ")", "file_append", "(", "'/etc/sudoers'", ",", "'Defaults:%wheel !env_reset,!secure_p...
updates /etc/sudoers so that users from %wheel keep their environment when executing a sudo call
[ "updates", "/", "etc", "/", "sudoers", "so", "that", "users", "from", "%wheel", "keep", "their", "environment", "when", "executing", "a", "sudo", "call" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L106-L117
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
disable_requiretty_on_sudoers
def disable_requiretty_on_sudoers(log=False): """ allow sudo calls through ssh without a tty """ if log: bookshelf2.logging_helpers.log_green( 'disabling requiretty on sudo calls') comment_line('/etc/sudoers', '^Defaults.*requiretty', use_sudo=True) return True
python
def disable_requiretty_on_sudoers(log=False): """ allow sudo calls through ssh without a tty """ if log: bookshelf2.logging_helpers.log_green( 'disabling requiretty on sudo calls') comment_line('/etc/sudoers', '^Defaults.*requiretty', use_sudo=True) return True
[ "def", "disable_requiretty_on_sudoers", "(", "log", "=", "False", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_green", "(", "'disabling requiretty on sudo calls'", ")", "comment_line", "(", "'/etc/sudoers'", ",", "'^Defaults.*requiretty'",...
allow sudo calls through ssh without a tty
[ "allow", "sudo", "calls", "through", "ssh", "without", "a", "tty" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L120-L128
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
file_attribs
def file_attribs(location, mode=None, owner=None, group=None, use_sudo=False, recursive=True): """Updates the mode/owner/group for the remote file at the given location.""" return dir_attribs(location=location, ...
python
def file_attribs(location, mode=None, owner=None, group=None, use_sudo=False, recursive=True): """Updates the mode/owner/group for the remote file at the given location.""" return dir_attribs(location=location, ...
[ "def", "file_attribs", "(", "location", ",", "mode", "=", "None", ",", "owner", "=", "None", ",", "group", "=", "None", ",", "use_sudo", "=", "False", ",", "recursive", "=", "True", ")", ":", "return", "dir_attribs", "(", "location", "=", "location", "...
Updates the mode/owner/group for the remote file at the given location.
[ "Updates", "the", "mode", "/", "owner", "/", "group", "for", "the", "remote", "file", "at", "the", "given", "location", "." ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L182-L195
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
os_release
def os_release(): """ returns /etc/os-release in a dictionary """ with settings(hide('warnings', 'running', 'stderr'), warn_only=True, capture=True): release = {} data = run('cat /etc/os-release') for line in data.split('\n'): if not line: c...
python
def os_release(): """ returns /etc/os-release in a dictionary """ with settings(hide('warnings', 'running', 'stderr'), warn_only=True, capture=True): release = {} data = run('cat /etc/os-release') for line in data.split('\n'): if not line: c...
[ "def", "os_release", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "release", "=", "{", "}", "data", "=", "run", "(", ...
returns /etc/os-release in a dictionary
[ "returns", "/", "etc", "/", "os", "-", "release", "in", "a", "dictionary" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L198-L212
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
linux_distribution
def linux_distribution(): """ returns the linux distribution in lower case """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): data = os_release() return(data['ID'])
python
def linux_distribution(): """ returns the linux distribution in lower case """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): data = os_release() return(data['ID'])
[ "def", "linux_distribution", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "data", "=", "os_release", "(",...
returns the linux distribution in lower case
[ "returns", "the", "linux", "distribution", "in", "lower", "case" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L215-L220
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
lsb_release
def lsb_release(): """ returns /etc/lsb-release in a dictionary """ with settings(hide('warnings', 'running'), capture=True): _lsb_release = {} data = sudo('cat /etc/lsb-release') for line in data.split('\n'): if not line: continue parts = line.sp...
python
def lsb_release(): """ returns /etc/lsb-release in a dictionary """ with settings(hide('warnings', 'running'), capture=True): _lsb_release = {} data = sudo('cat /etc/lsb-release') for line in data.split('\n'): if not line: continue parts = line.sp...
[ "def", "lsb_release", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ")", ",", "capture", "=", "True", ")", ":", "_lsb_release", "=", "{", "}", "data", "=", "sudo", "(", "'cat /etc/lsb-release'", ")", "for", "line", ...
returns /etc/lsb-release in a dictionary
[ "returns", "/", "etc", "/", "lsb", "-", "release", "in", "a", "dictionary" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L223-L236
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
restart_service
def restart_service(service, log=False): """ restarts a service """ with settings(): if log: bookshelf2.logging_helpers.log_yellow( 'stoping service %s' % service) sudo('service %s stop' % service) if log: bookshelf2.logging_helpers.log_yellow( ...
python
def restart_service(service, log=False): """ restarts a service """ with settings(): if log: bookshelf2.logging_helpers.log_yellow( 'stoping service %s' % service) sudo('service %s stop' % service) if log: bookshelf2.logging_helpers.log_yellow( ...
[ "def", "restart_service", "(", "service", ",", "log", "=", "False", ")", ":", "with", "settings", "(", ")", ":", "if", "log", ":", "bookshelf2", ".", "logging_helpers", ".", "log_yellow", "(", "'stoping service %s'", "%", "service", ")", "sudo", "(", "'ser...
restarts a service
[ "restarts", "a", "service" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L246-L257
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
systemd
def systemd(service, start=True, enabled=True, unmask=False, restart=False): """ manipulates systemd services """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): if restart: sudo('systemctl restart %s' % service) else:...
python
def systemd(service, start=True, enabled=True, unmask=False, restart=False): """ manipulates systemd services """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): if restart: sudo('systemctl restart %s' % service) else:...
[ "def", "systemd", "(", "service", ",", "start", "=", "True", ",", "enabled", "=", "True", ",", "unmask", "=", "False", ",", "restart", "=", "False", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", ...
manipulates systemd services
[ "manipulates", "systemd", "services" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L260-L280
pyBookshelf/bookshelf
bookshelf/api_v2/os_helpers.py
install_os_updates
def install_os_updates(distribution, force=False): """ installs OS updates """ if ('centos' in distribution or 'rhel' in distribution or 'redhat' in distribution): bookshelf2.logging_helpers.log_green('installing OS updates') sudo("yum -y --quiet clean all") sudo(...
python
def install_os_updates(distribution, force=False): """ installs OS updates """ if ('centos' in distribution or 'rhel' in distribution or 'redhat' in distribution): bookshelf2.logging_helpers.log_green('installing OS updates') sudo("yum -y --quiet clean all") sudo(...
[ "def", "install_os_updates", "(", "distribution", ",", "force", "=", "False", ")", ":", "if", "(", "'centos'", "in", "distribution", "or", "'rhel'", "in", "distribution", "or", "'redhat'", "in", "distribution", ")", ":", "bookshelf2", ".", "logging_helpers", "...
installs OS updates
[ "installs", "OS", "updates" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/os_helpers.py#L319-L341
moralrecordings/mrcrowbar
mrcrowbar/statistics.py
Stats.ansi_format
def ansi_format( self, width=64, height=12 ): """Return a human readable ANSI-terminal printout of the stats. width Custom width for the graph (in characters). height Custom height for the graph (in characters). """ from mrcrowbar.ansi import format_bar_...
python
def ansi_format( self, width=64, height=12 ): """Return a human readable ANSI-terminal printout of the stats. width Custom width for the graph (in characters). height Custom height for the graph (in characters). """ from mrcrowbar.ansi import format_bar_...
[ "def", "ansi_format", "(", "self", ",", "width", "=", "64", ",", "height", "=", "12", ")", ":", "from", "mrcrowbar", ".", "ansi", "import", "format_bar_graph_iter", "if", "(", "256", "%", "width", ")", "!=", "0", ":", "raise", "ValueError", "(", "'Widt...
Return a human readable ANSI-terminal printout of the stats. width Custom width for the graph (in characters). height Custom height for the graph (in characters).
[ "Return", "a", "human", "readable", "ANSI", "-", "terminal", "printout", "of", "the", "stats", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/statistics.py#L34-L59
saltant-org/saltant-py
saltant/models/task_whitelist.py
TaskWhitelist.put
def put(self): """Updates this task whitelist on the saltant server. Returns: :class:`saltant.models.task_whitelist.TaskWhitelist`: A task whitelist model instance representing the task whitelist just updated. """ return self.manager.put( ...
python
def put(self): """Updates this task whitelist on the saltant server. Returns: :class:`saltant.models.task_whitelist.TaskWhitelist`: A task whitelist model instance representing the task whitelist just updated. """ return self.manager.put( ...
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "whitelisted_container_task_types", "...
Updates this task whitelist on the saltant server. Returns: :class:`saltant.models.task_whitelist.TaskWhitelist`: A task whitelist model instance representing the task whitelist just updated.
[ "Updates", "this", "task", "whitelist", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_whitelist.py#L96-L114
saltant-org/saltant-py
saltant/models/task_whitelist.py
TaskWhitelistManager.create
def create( self, name, description="", whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Create a task whitelist. Args: name (str): The name of the task whitelist. description (str, optional): A desc...
python
def create( self, name, description="", whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Create a task whitelist. Args: name (str): The name of the task whitelist. description (str, optional): A desc...
[ "def", "create", "(", "self", ",", "name", ",", "description", "=", "\"\"", ",", "whitelisted_container_task_types", "=", "None", ",", "whitelisted_executable_task_types", "=", "None", ",", ")", ":", "# Translate whitelists None to [] if necessary", "if", "whitelisted_c...
Create a task whitelist. Args: name (str): The name of the task whitelist. description (str, optional): A description of the task whitelist. whitelisted_container_task_types (list, optional): A list of whitelisted container task type IDs. whitelis...
[ "Create", "a", "task", "whitelist", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_whitelist.py#L163-L212
saltant-org/saltant-py
saltant/models/task_whitelist.py
TaskWhitelistManager.patch
def patch( self, id, name=None, description=None, whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Partially updates a task whitelist on the saltant server. Args: id (int): The ID of the task whitelist. ...
python
def patch( self, id, name=None, description=None, whitelisted_container_task_types=None, whitelisted_executable_task_types=None, ): """Partially updates a task whitelist on the saltant server. Args: id (int): The ID of the task whitelist. ...
[ "def", "patch", "(", "self", ",", "id", ",", "name", "=", "None", ",", "description", "=", "None", ",", "whitelisted_container_task_types", "=", "None", ",", "whitelisted_executable_task_types", "=", "None", ",", ")", ":", "# Update the object", "request_url", "...
Partially updates a task whitelist on the saltant server. Args: id (int): The ID of the task whitelist. name (str, optional): The name of the task whitelist. description (str, optional): A description of the task whitelist. whitelisted_container_task_types (list,...
[ "Partially", "updates", "a", "task", "whitelist", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_whitelist.py#L214-L270
moralrecordings/mrcrowbar
mrcrowbar/utils.py
enable_logging
def enable_logging( level='WARNING' ): """Enable sending logs to stderr. Useful for shell sessions. level Logging threshold, as defined in the logging module of the Python standard library. Defaults to 'WARNING'. """ log = logging.getLogger( 'mrcrowbar' ) log.setLevel( level ) o...
python
def enable_logging( level='WARNING' ): """Enable sending logs to stderr. Useful for shell sessions. level Logging threshold, as defined in the logging module of the Python standard library. Defaults to 'WARNING'. """ log = logging.getLogger( 'mrcrowbar' ) log.setLevel( level ) o...
[ "def", "enable_logging", "(", "level", "=", "'WARNING'", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "'mrcrowbar'", ")", "log", ".", "setLevel", "(", "level", ")", "out", "=", "logging", ".", "StreamHandler", "(", ")", "out", ".", "setLevel",...
Enable sending logs to stderr. Useful for shell sessions. level Logging threshold, as defined in the logging module of the Python standard library. Defaults to 'WARNING'.
[ "Enable", "sending", "logs", "to", "stderr", ".", "Useful", "for", "shell", "sessions", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L15-L28
moralrecordings/mrcrowbar
mrcrowbar/utils.py
find_all_iter
def find_all_iter( source, substring, start=None, end=None, overlap=False ): """Iterate through every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (d...
python
def find_all_iter( source, substring, start=None, end=None, overlap=False ): """Iterate through every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (d...
[ "def", "find_all_iter", "(", "source", ",", "substring", ",", "start", "=", "None", ",", "end", "=", "None", ",", "overlap", "=", "False", ")", ":", "data", "=", "source", "base", "=", "0", "if", "end", "is", "not", "None", ":", "data", "=", "data"...
Iterate through every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) overlap Whether to return overlapping matches (default: fa...
[ "Iterate", "through", "every", "location", "a", "substring", "can", "be", "found", "in", "a", "source", "string", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L51-L80
moralrecordings/mrcrowbar
mrcrowbar/utils.py
find_all
def find_all( source, substring, start=None, end=None, overlap=False ): """Return every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) ...
python
def find_all( source, substring, start=None, end=None, overlap=False ): """Return every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) ...
[ "def", "find_all", "(", "source", ",", "substring", ",", "start", "=", "None", ",", "end", "=", "None", ",", "overlap", "=", "False", ")", ":", "return", "[", "x", "for", "x", "in", "find_all_iter", "(", "source", ",", "substring", ",", "start", ",",...
Return every location a substring can be found in a source string. source The source string to search. start Start offset to read from (default: start) end End offset to stop reading at (default: end) overlap Whether to return overlapping matches (default: false)
[ "Return", "every", "location", "a", "substring", "can", "be", "found", "in", "a", "source", "string", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L83-L98
moralrecordings/mrcrowbar
mrcrowbar/utils.py
basic_diff
def basic_diff( source1, source2, start=None, end=None ): """Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start ...
python
def basic_diff( source1, source2, start=None, end=None ): """Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start ...
[ "def", "basic_diff", "(", "source1", ",", "source2", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "start", "=", "start", "if", "start", "is", "not", "None", "else", "0", "end", "=", "end", "if", "end", "is", "not", "None", "else", ...
Perform a basic diff between two equal-sized binary strings and return a list of (offset, size) tuples denoting the differences. source1 The first byte string source. source2 The second byte string source. start Start offset to read from (default: start) end End o...
[ "Perform", "a", "basic", "diff", "between", "two", "equal", "-", "sized", "binary", "strings", "and", "return", "a", "list", "of", "(", "offset", "size", ")", "tuples", "denoting", "the", "differences", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L101-L137
moralrecordings/mrcrowbar
mrcrowbar/utils.py
hexdump_iter
def hexdump_iter( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Return the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) e...
python
def hexdump_iter( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Return the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) e...
[ "def", "hexdump_iter", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "address_base", "=", "None", ")", ":", "a...
Return the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) ...
[ "Return", "the", "contents", "of", "a", "byte", "string", "in", "tabular", "hexadecimal", "/", "ASCII", "format", ".", "source", "The", "byte", "string", "to", "print", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L160-L200
moralrecordings/mrcrowbar
mrcrowbar/utils.py
hexdump
def hexdump( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Print the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end ...
python
def hexdump( source, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, address_base=None ): """Print the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end ...
[ "def", "hexdump", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "address_base", "=", "None", ")", ":", "for", ...
Print the contents of a byte string in tabular hexadecimal/ASCII format. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) ...
[ "Print", "the", "contents", "of", "a", "byte", "string", "in", "tabular", "hexadecimal", "/", "ASCII", "format", ".", "source", "The", "byte", "string", "to", "print", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L203-L233
moralrecordings/mrcrowbar
mrcrowbar/utils.py
hexdump_diff_iter
def hexdump_diff_iter( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 ...
python
def hexdump_diff_iter( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 ...
[ "def", "hexdump_diff_iter", "(", "source1", ",", "source2", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "before", "=", "2", ...
Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The second byte string source. start Start offset to read from (default: start) end End offset to stop reading at (default: end) le...
[ "Returns", "the", "differences", "between", "two", "byte", "strings", "in", "tabular", "hexadecimal", "/", "ASCII", "format", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L236-L324
moralrecordings/mrcrowbar
mrcrowbar/utils.py
hexdump_diff
def hexdump_diff( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The s...
python
def hexdump_diff( source1, source2, start=None, end=None, length=None, major_len=8, minor_len=4, colour=True, before=2, after=2, address_base=None ): """Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The s...
[ "def", "hexdump_diff", "(", "source1", ",", "source2", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "major_len", "=", "8", ",", "minor_len", "=", "4", ",", "colour", "=", "True", ",", "before", "=", "2", ",",...
Returns the differences between two byte strings in tabular hexadecimal/ASCII format. source1 The first byte string source. source2 The second byte string source. start Start offset to read from (default: start) end End offset to stop reading at (default: end) le...
[ "Returns", "the", "differences", "between", "two", "byte", "strings", "in", "tabular", "hexadecimal", "/", "ASCII", "format", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L327-L366
moralrecordings/mrcrowbar
mrcrowbar/utils.py
unpack_bits
def unpack_bits( byte ): """Expand a bitfield into a 64-bit int (8 bool bytes).""" longbits = byte & (0x00000000000000ff) longbits = (longbits | (longbits<<28)) & (0x0000000f0000000f) longbits = (longbits | (longbits<<14)) & (0x0003000300030003) longbits = (longbits | (longbits<<7)) & (0x01010101010...
python
def unpack_bits( byte ): """Expand a bitfield into a 64-bit int (8 bool bytes).""" longbits = byte & (0x00000000000000ff) longbits = (longbits | (longbits<<28)) & (0x0000000f0000000f) longbits = (longbits | (longbits<<14)) & (0x0003000300030003) longbits = (longbits | (longbits<<7)) & (0x01010101010...
[ "def", "unpack_bits", "(", "byte", ")", ":", "longbits", "=", "byte", "&", "(", "0x00000000000000ff", ")", "longbits", "=", "(", "longbits", "|", "(", "longbits", "<<", "28", ")", ")", "&", "(", "0x0000000f0000000f", ")", "longbits", "=", "(", "longbits"...
Expand a bitfield into a 64-bit int (8 bool bytes).
[ "Expand", "a", "bitfield", "into", "a", "64", "-", "bit", "int", "(", "8", "bool", "bytes", ")", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L376-L382
moralrecordings/mrcrowbar
mrcrowbar/utils.py
pack_bits
def pack_bits( longbits ): """Crunch a 64-bit int (8 bool bytes) into a bitfield.""" byte = longbits & (0x0101010101010101) byte = (byte | (byte>>7)) & (0x0003000300030003) byte = (byte | (byte>>14)) & (0x0000000f0000000f) byte = (byte | (byte>>28)) & (0x00000000000000ff) return byte
python
def pack_bits( longbits ): """Crunch a 64-bit int (8 bool bytes) into a bitfield.""" byte = longbits & (0x0101010101010101) byte = (byte | (byte>>7)) & (0x0003000300030003) byte = (byte | (byte>>14)) & (0x0000000f0000000f) byte = (byte | (byte>>28)) & (0x00000000000000ff) return byte
[ "def", "pack_bits", "(", "longbits", ")", ":", "byte", "=", "longbits", "&", "(", "0x0101010101010101", ")", "byte", "=", "(", "byte", "|", "(", "byte", ">>", "7", ")", ")", "&", "(", "0x0003000300030003", ")", "byte", "=", "(", "byte", "|", "(", "...
Crunch a 64-bit int (8 bool bytes) into a bitfield.
[ "Crunch", "a", "64", "-", "bit", "int", "(", "8", "bool", "bytes", ")", "into", "a", "bitfield", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L385-L391
moralrecordings/mrcrowbar
mrcrowbar/utils.py
pixdump_iter
def pixdump_iter( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Return the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading a...
python
def pixdump_iter( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Return the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading a...
[ "def", "pixdump_iter", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "width", "=", "64", ",", "height", "=", "None", ",", "palette", "=", "None", ")", ":", "assert", "is_bytes", "(", "source", "...
Return the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) width Wi...
[ "Return", "the", "contents", "of", "a", "byte", "string", "as", "a", "256", "colour", "image", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L394-L447
moralrecordings/mrcrowbar
mrcrowbar/utils.py
pixdump
def pixdump( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Print the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (def...
python
def pixdump( source, start=None, end=None, length=None, width=64, height=None, palette=None ): """Print the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (def...
[ "def", "pixdump", "(", "source", ",", "start", "=", "None", ",", "end", "=", "None", ",", "length", "=", "None", ",", "width", "=", "64", ",", "height", "=", "None", ",", "palette", "=", "None", ")", ":", "for", "line", "in", "pixdump_iter", "(", ...
Print the contents of a byte string as a 256 colour image. source The byte string to print. start Start offset to read from (default: start) end End offset to stop reading at (default: end) length Length to read in (optional replacement for end) width Wid...
[ "Print", "the", "contents", "of", "a", "byte", "string", "as", "a", "256", "colour", "image", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L450-L476
moralrecordings/mrcrowbar
mrcrowbar/utils.py
BitReader.set_offset
def set_offset( self, offset ): """Set the current read offset (in bytes) for the instance.""" assert offset in range( len( self.buffer ) ) self.pos = offset self._fill_buffer()
python
def set_offset( self, offset ): """Set the current read offset (in bytes) for the instance.""" assert offset in range( len( self.buffer ) ) self.pos = offset self._fill_buffer()
[ "def", "set_offset", "(", "self", ",", "offset", ")", ":", "assert", "offset", "in", "range", "(", "len", "(", "self", ".", "buffer", ")", ")", "self", ".", "pos", "=", "offset", "self", ".", "_fill_buffer", "(", ")" ]
Set the current read offset (in bytes) for the instance.
[ "Set", "the", "current", "read", "offset", "(", "in", "bytes", ")", "for", "the", "instance", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L538-L542
moralrecordings/mrcrowbar
mrcrowbar/utils.py
BitReader.get_bits
def get_bits( self, count ): """Get an integer containing the next [count] bits from the source.""" result = 0 for i in range( count ): if self.bits_remaining <= 0: self._fill_buffer() if self.bits_reverse: bit = (1 if (self.current_bits & ...
python
def get_bits( self, count ): """Get an integer containing the next [count] bits from the source.""" result = 0 for i in range( count ): if self.bits_remaining <= 0: self._fill_buffer() if self.bits_reverse: bit = (1 if (self.current_bits & ...
[ "def", "get_bits", "(", "self", ",", "count", ")", ":", "result", "=", "0", "for", "i", "in", "range", "(", "count", ")", ":", "if", "self", ".", "bits_remaining", "<=", "0", ":", "self", ".", "_fill_buffer", "(", ")", "if", "self", ".", "bits_reve...
Get an integer containing the next [count] bits from the source.
[ "Get", "an", "integer", "containing", "the", "next", "[", "count", "]", "bits", "from", "the", "source", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L545-L566
moralrecordings/mrcrowbar
mrcrowbar/utils.py
BitWriter.put_bits
def put_bits( self, value, count ): """Push bits into the target. value Integer containing bits to push, ordered from least-significant bit to most-significant bit. count Number of bits to push to the target. """ for _ in range( count ): ...
python
def put_bits( self, value, count ): """Push bits into the target. value Integer containing bits to push, ordered from least-significant bit to most-significant bit. count Number of bits to push to the target. """ for _ in range( count ): ...
[ "def", "put_bits", "(", "self", ",", "value", ",", "count", ")", ":", "for", "_", "in", "range", "(", "count", ")", ":", "# bits are retrieved from the source LSB first", "bit", "=", "(", "value", "&", "1", ")", "value", ">>=", "1", "# however, bits are put ...
Push bits into the target. value Integer containing bits to push, ordered from least-significant bit to most-significant bit. count Number of bits to push to the target.
[ "Push", "bits", "into", "the", "target", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L592-L627
moralrecordings/mrcrowbar
mrcrowbar/utils.py
BitWriter.get_buffer
def get_buffer( self ): """Return a byte string containing the target as currently written.""" last_byte = self.current_bits if (self.bits_remaining < 8) else None result = self.output if last_byte is not None: result = bytearray( result ) result.append( last_byt...
python
def get_buffer( self ): """Return a byte string containing the target as currently written.""" last_byte = self.current_bits if (self.bits_remaining < 8) else None result = self.output if last_byte is not None: result = bytearray( result ) result.append( last_byt...
[ "def", "get_buffer", "(", "self", ")", ":", "last_byte", "=", "self", ".", "current_bits", "if", "(", "self", ".", "bits_remaining", "<", "8", ")", "else", "None", "result", "=", "self", ".", "output", "if", "last_byte", "is", "not", "None", ":", "resu...
Return a byte string containing the target as currently written.
[ "Return", "a", "byte", "string", "containing", "the", "target", "as", "currently", "written", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/utils.py#L629-L641
Riffstation/Flask-Philo-SQLAlchemy
flask_philo_sqlalchemy/orm.py
BaseManager.get_for_update
def get_for_update(self, connection_name='DEFAULT', **kwargs): """ http://docs.sqlalchemy.org/en/latest/orm/query.html?highlight=update#sqlalchemy.orm.query.Query.with_for_update # noqa """ if not kwargs: raise InvalidQueryError( "Can not execute a query wit...
python
def get_for_update(self, connection_name='DEFAULT', **kwargs): """ http://docs.sqlalchemy.org/en/latest/orm/query.html?highlight=update#sqlalchemy.orm.query.Query.with_for_update # noqa """ if not kwargs: raise InvalidQueryError( "Can not execute a query wit...
[ "def", "get_for_update", "(", "self", ",", "connection_name", "=", "'DEFAULT'", ",", "*", "*", "kwargs", ")", ":", "if", "not", "kwargs", ":", "raise", "InvalidQueryError", "(", "\"Can not execute a query without parameters\"", ")", "obj", "=", "self", ".", "poo...
http://docs.sqlalchemy.org/en/latest/orm/query.html?highlight=update#sqlalchemy.orm.query.Query.with_for_update # noqa
[ "http", ":", "//", "docs", ".", "sqlalchemy", ".", "org", "/", "en", "/", "latest", "/", "orm", "/", "query", ".", "html?highlight", "=", "update#sqlalchemy", ".", "orm", ".", "query", ".", "Query", ".", "with_for_update", "#", "noqa" ]
train
https://github.com/Riffstation/Flask-Philo-SQLAlchemy/blob/71598bb603b8458a2cf9f7989f71d8f1c77fafb9/flask_philo_sqlalchemy/orm.py#L35-L49
tsnaomi/finnsyll
finnsyll/prev/v07.py
syllabify
def syllabify(word, compound=None): '''Syllabify the given word, whether simplex or complex.''' if compound is None: compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify syll, rules = syllabify(word) yield syll, rules n = 7 if '...
python
def syllabify(word, compound=None): '''Syllabify the given word, whether simplex or complex.''' if compound is None: compound = bool(re.search(r'(-| |=)', word)) syllabify = _syllabify_compound if compound else _syllabify syll, rules = syllabify(word) yield syll, rules n = 7 if '...
[ "def", "syllabify", "(", "word", ",", "compound", "=", "None", ")", ":", "if", "compound", "is", "None", ":", "compound", "=", "bool", "(", "re", ".", "search", "(", "r'(-| |=)'", ",", "word", ")", ")", "syllabify", "=", "_syllabify_compound", "if", "c...
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/v07.py#L17-L43
danishabdullah/algen
algen/compilers.py
ModelCompiler.convert_case
def convert_case(name): """Converts name from CamelCase to snake_case""" s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
python
def convert_case(name): """Converts name from CamelCase to snake_case""" s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
[ "def", "convert_case", "(", "name", ")", ":", "s1", "=", "re", ".", "sub", "(", "'(.)([A-Z][a-z]+)'", ",", "r'\\1_\\2'", ",", "name", ")", "return", "re", ".", "sub", "(", "'([a-z0-9])([A-Z])'", ",", "r'\\1_\\2'", ",", "s1", ")", ".", "lower", "(", ")"...
Converts name from CamelCase to snake_case
[ "Converts", "name", "from", "CamelCase", "to", "snake_case" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L35-L38
danishabdullah/algen
algen/compilers.py
ModelCompiler.table_name
def table_name(self): """Pluralises the class_name using utterly simple algo and returns as table_name""" if not self.class_name: raise ValueError else: tbl_name = ModelCompiler.convert_case(self.class_name) last_letter = tbl_name[-1] if last_letter in ("y...
python
def table_name(self): """Pluralises the class_name using utterly simple algo and returns as table_name""" if not self.class_name: raise ValueError else: tbl_name = ModelCompiler.convert_case(self.class_name) last_letter = tbl_name[-1] if last_letter in ("y...
[ "def", "table_name", "(", "self", ")", ":", "if", "not", "self", ".", "class_name", ":", "raise", "ValueError", "else", ":", "tbl_name", "=", "ModelCompiler", ".", "convert_case", "(", "self", ".", "class_name", ")", "last_letter", "=", "tbl_name", "[", "-...
Pluralises the class_name using utterly simple algo and returns as table_name
[ "Pluralises", "the", "class_name", "using", "utterly", "simple", "algo", "and", "returns", "as", "table_name" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L41-L53
danishabdullah/algen
algen/compilers.py
ModelCompiler.types
def types(self): """All the unique types found in user supplied model""" res = [] for column in self.column_definitions: tmp = column.get('type', None) res.append(ModelCompiler.get_column_type(tmp)) if tmp else False res = list(set(res)) return res
python
def types(self): """All the unique types found in user supplied model""" res = [] for column in self.column_definitions: tmp = column.get('type', None) res.append(ModelCompiler.get_column_type(tmp)) if tmp else False res = list(set(res)) return res
[ "def", "types", "(", "self", ")", ":", "res", "=", "[", "]", "for", "column", "in", "self", ".", "column_definitions", ":", "tmp", "=", "column", ".", "get", "(", "'type'", ",", "None", ")", "res", ".", "append", "(", "ModelCompiler", ".", "get_colum...
All the unique types found in user supplied model
[ "All", "the", "unique", "types", "found", "in", "user", "supplied", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L71-L78
danishabdullah/algen
algen/compilers.py
ModelCompiler.basic_types
def basic_types(self): """Returns non-postgres types referenced in user supplied model """ if not self.foreign_key_definitions: return self.standard_types else: tmp = self.standard_types tmp.append('ForeignKey') return tmp
python
def basic_types(self): """Returns non-postgres types referenced in user supplied model """ if not self.foreign_key_definitions: return self.standard_types else: tmp = self.standard_types tmp.append('ForeignKey') return tmp
[ "def", "basic_types", "(", "self", ")", ":", "if", "not", "self", ".", "foreign_key_definitions", ":", "return", "self", ".", "standard_types", "else", ":", "tmp", "=", "self", ".", "standard_types", "tmp", ".", "append", "(", "'ForeignKey'", ")", "return", ...
Returns non-postgres types referenced in user supplied model
[ "Returns", "non", "-", "postgres", "types", "referenced", "in", "user", "supplied", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L91-L98
danishabdullah/algen
algen/compilers.py
ModelCompiler.primary_keys
def primary_keys(self): """Returns the primary keys referenced in user supplied model""" res = [] for column in self.column_definitions: if 'primary_key' in column.keys(): tmp = column.get('primary_key', None) res.append(column['name']) if tmp else Fal...
python
def primary_keys(self): """Returns the primary keys referenced in user supplied model""" res = [] for column in self.column_definitions: if 'primary_key' in column.keys(): tmp = column.get('primary_key', None) res.append(column['name']) if tmp else Fal...
[ "def", "primary_keys", "(", "self", ")", ":", "res", "=", "[", "]", "for", "column", "in", "self", ".", "column_definitions", ":", "if", "'primary_key'", "in", "column", ".", "keys", "(", ")", ":", "tmp", "=", "column", ".", "get", "(", "'primary_key'"...
Returns the primary keys referenced in user supplied model
[ "Returns", "the", "primary", "keys", "referenced", "in", "user", "supplied", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L105-L112
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_named_imports
def compiled_named_imports(self): """Returns compiled named imports required for the model""" res = [] if self.postgres_types: res.append( ALCHEMY_TEMPLATES.named_import.safe_substitute( module='sqlalchemy.dialects.postgresql', ...
python
def compiled_named_imports(self): """Returns compiled named imports required for the model""" res = [] if self.postgres_types: res.append( ALCHEMY_TEMPLATES.named_import.safe_substitute( module='sqlalchemy.dialects.postgresql', ...
[ "def", "compiled_named_imports", "(", "self", ")", ":", "res", "=", "[", "]", "if", "self", ".", "postgres_types", ":", "res", ".", "append", "(", "ALCHEMY_TEMPLATES", ".", "named_import", ".", "safe_substitute", "(", "module", "=", "'sqlalchemy.dialects.postgre...
Returns compiled named imports required for the model
[ "Returns", "compiled", "named", "imports", "required", "for", "the", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L115-L128
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_orm_imports
def compiled_orm_imports(self): """Returns compiled named imports required for the model""" module = 'sqlalchemy.orm' labels = [] if self.relationship_definitions: labels.append("relationship") return ALCHEMY_TEMPLATES.named_import.safe_substitute(module=module, label...
python
def compiled_orm_imports(self): """Returns compiled named imports required for the model""" module = 'sqlalchemy.orm' labels = [] if self.relationship_definitions: labels.append("relationship") return ALCHEMY_TEMPLATES.named_import.safe_substitute(module=module, label...
[ "def", "compiled_orm_imports", "(", "self", ")", ":", "module", "=", "'sqlalchemy.orm'", "labels", "=", "[", "]", "if", "self", ".", "relationship_definitions", ":", "labels", ".", "append", "(", "\"relationship\"", ")", "return", "ALCHEMY_TEMPLATES", ".", "name...
Returns compiled named imports required for the model
[ "Returns", "compiled", "named", "imports", "required", "for", "the", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L131-L137
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_columns
def compiled_columns(self): """Returns compiled column definitions""" def get_column_args(column): tmp = [] for arg_name, arg_val in column.items(): if arg_name not in ('name', 'type'): if arg_name in ('server_default', 'server_onupdate'): ...
python
def compiled_columns(self): """Returns compiled column definitions""" def get_column_args(column): tmp = [] for arg_name, arg_val in column.items(): if arg_name not in ('name', 'type'): if arg_name in ('server_default', 'server_onupdate'): ...
[ "def", "compiled_columns", "(", "self", ")", ":", "def", "get_column_args", "(", "column", ")", ":", "tmp", "=", "[", "]", "for", "arg_name", ",", "arg_val", "in", "column", ".", "items", "(", ")", ":", "if", "arg_name", "not", "in", "(", "'name'", "...
Returns compiled column definitions
[ "Returns", "compiled", "column", "definitions" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L140-L168
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_foreign_keys
def compiled_foreign_keys(self): """Returns compiled foreign key definitions""" def get_column_args(column): tmp = [] for arg_name, arg_val in column.items(): if arg_name not in ('name', 'type', 'reference'): if arg_name in ('server_default', ...
python
def compiled_foreign_keys(self): """Returns compiled foreign key definitions""" def get_column_args(column): tmp = [] for arg_name, arg_val in column.items(): if arg_name not in ('name', 'type', 'reference'): if arg_name in ('server_default', ...
[ "def", "compiled_foreign_keys", "(", "self", ")", ":", "def", "get_column_args", "(", "column", ")", ":", "tmp", "=", "[", "]", "for", "arg_name", ",", "arg_val", "in", "column", ".", "items", "(", ")", ":", "if", "arg_name", "not", "in", "(", "'name'"...
Returns compiled foreign key definitions
[ "Returns", "compiled", "foreign", "key", "definitions" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L171-L206
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_relationships
def compiled_relationships(self): """Returns compiled relationship definitions""" def get_column_args(column): tmp = [] for arg_name, arg_val in column.items(): if arg_name not in ('name', 'type', 'reference', 'class'): if arg_name in ('back_p...
python
def compiled_relationships(self): """Returns compiled relationship definitions""" def get_column_args(column): tmp = [] for arg_name, arg_val in column.items(): if arg_name not in ('name', 'type', 'reference', 'class'): if arg_name in ('back_p...
[ "def", "compiled_relationships", "(", "self", ")", ":", "def", "get_column_args", "(", "column", ")", ":", "tmp", "=", "[", "]", "for", "arg_name", ",", "arg_val", "in", "column", ".", "items", "(", ")", ":", "if", "arg_name", "not", "in", "(", "'name'...
Returns compiled relationship definitions
[ "Returns", "compiled", "relationship", "definitions" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L209-L232
danishabdullah/algen
algen/compilers.py
ModelCompiler.columns
def columns(self): """Return names of all the addressable columns (including foreign keys) referenced in user supplied model""" res = [col['name'] for col in self.column_definitions] res.extend([col['name'] for col in self.foreign_key_definitions]) return res
python
def columns(self): """Return names of all the addressable columns (including foreign keys) referenced in user supplied model""" res = [col['name'] for col in self.column_definitions] res.extend([col['name'] for col in self.foreign_key_definitions]) return res
[ "def", "columns", "(", "self", ")", ":", "res", "=", "[", "col", "[", "'name'", "]", "for", "col", "in", "self", ".", "column_definitions", "]", "res", ".", "extend", "(", "[", "col", "[", "'name'", "]", "for", "col", "in", "self", ".", "foreign_ke...
Return names of all the addressable columns (including foreign keys) referenced in user supplied model
[ "Return", "names", "of", "all", "the", "addressable", "columns", "(", "including", "foreign", "keys", ")", "referenced", "in", "user", "supplied", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L235-L239
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_init_func
def compiled_init_func(self): """Returns compiled init function""" def get_column_assignment(column_name): return ALCHEMY_TEMPLATES.col_assignment.safe_substitute(col_name=column_name) def get_compiled_args(arg_name): return ALCHEMY_TEMPLATES.func_arg.safe_substitute(ar...
python
def compiled_init_func(self): """Returns compiled init function""" def get_column_assignment(column_name): return ALCHEMY_TEMPLATES.col_assignment.safe_substitute(col_name=column_name) def get_compiled_args(arg_name): return ALCHEMY_TEMPLATES.func_arg.safe_substitute(ar...
[ "def", "compiled_init_func", "(", "self", ")", ":", "def", "get_column_assignment", "(", "column_name", ")", ":", "return", "ALCHEMY_TEMPLATES", ".", "col_assignment", ".", "safe_substitute", "(", "col_name", "=", "column_name", ")", "def", "get_compiled_args", "(",...
Returns compiled init function
[ "Returns", "compiled", "init", "function" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L242-L255
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_update_func
def compiled_update_func(self): """Returns compiled update function""" def get_not_none_col_assignment(column_name): return ALCHEMY_TEMPLATES.not_none_col_assignment.safe_substitute(col_name=column_name) def get_compiled_args(arg_name): return ALCHEMY_TEMPLATES.func_arg...
python
def compiled_update_func(self): """Returns compiled update function""" def get_not_none_col_assignment(column_name): return ALCHEMY_TEMPLATES.not_none_col_assignment.safe_substitute(col_name=column_name) def get_compiled_args(arg_name): return ALCHEMY_TEMPLATES.func_arg...
[ "def", "compiled_update_func", "(", "self", ")", ":", "def", "get_not_none_col_assignment", "(", "column_name", ")", ":", "return", "ALCHEMY_TEMPLATES", ".", "not_none_col_assignment", ".", "safe_substitute", "(", "col_name", "=", "column_name", ")", "def", "get_compi...
Returns compiled update function
[ "Returns", "compiled", "update", "function" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L258-L273
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_hash_func
def compiled_hash_func(self): """Returns compiled hash function based on hash of stringified primary_keys. This isn't the most efficient way""" def get_primary_key_str(pkey_name): return "str(self.{})".format(pkey_name) hash_str = "+ ".join([get_primary_key_str(n) for n in ...
python
def compiled_hash_func(self): """Returns compiled hash function based on hash of stringified primary_keys. This isn't the most efficient way""" def get_primary_key_str(pkey_name): return "str(self.{})".format(pkey_name) hash_str = "+ ".join([get_primary_key_str(n) for n in ...
[ "def", "compiled_hash_func", "(", "self", ")", ":", "def", "get_primary_key_str", "(", "pkey_name", ")", ":", "return", "\"str(self.{})\"", ".", "format", "(", "pkey_name", ")", "hash_str", "=", "\"+ \"", ".", "join", "(", "[", "get_primary_key_str", "(", "n",...
Returns compiled hash function based on hash of stringified primary_keys. This isn't the most efficient way
[ "Returns", "compiled", "hash", "function", "based", "on", "hash", "of", "stringified", "primary_keys", ".", "This", "isn", "t", "the", "most", "efficient", "way" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L276-L284
danishabdullah/algen
algen/compilers.py
ModelCompiler.representation_function_compiler
def representation_function_compiler(self, func_name): """Generic function can be used to compile __repr__ or __unicode__ or __str__""" def get_col_accessor(col): return ALCHEMY_TEMPLATES.col_accessor.safe_substitute(col=col) def get_col_evaluator(col): return ALCHEMY_T...
python
def representation_function_compiler(self, func_name): """Generic function can be used to compile __repr__ or __unicode__ or __str__""" def get_col_accessor(col): return ALCHEMY_TEMPLATES.col_accessor.safe_substitute(col=col) def get_col_evaluator(col): return ALCHEMY_T...
[ "def", "representation_function_compiler", "(", "self", ",", "func_name", ")", ":", "def", "get_col_accessor", "(", "col", ")", ":", "return", "ALCHEMY_TEMPLATES", ".", "col_accessor", ".", "safe_substitute", "(", "col", "=", "col", ")", "def", "get_col_evaluator"...
Generic function can be used to compile __repr__ or __unicode__ or __str__
[ "Generic", "function", "can", "be", "used", "to", "compile", "__repr__", "or", "__unicode__", "or", "__str__" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L308-L323
danishabdullah/algen
algen/compilers.py
ModelCompiler.compiled_model
def compiled_model(self): """Returns compile ORM class for the user supplied model""" return ALCHEMY_TEMPLATES.model.safe_substitute(class_name=self.class_name, table_name=self.table_name, colum...
python
def compiled_model(self): """Returns compile ORM class for the user supplied model""" return ALCHEMY_TEMPLATES.model.safe_substitute(class_name=self.class_name, table_name=self.table_name, colum...
[ "def", "compiled_model", "(", "self", ")", ":", "return", "ALCHEMY_TEMPLATES", ".", "model", ".", "safe_substitute", "(", "class_name", "=", "self", ".", "class_name", ",", "table_name", "=", "self", ".", "table_name", ",", "column_definitions", "=", "self", "...
Returns compile ORM class for the user supplied model
[ "Returns", "compile", "ORM", "class", "for", "the", "user", "supplied", "model" ]
train
https://github.com/danishabdullah/algen/blob/642ba26d8721c588fce505ac67528070c1edc264/algen/compilers.py#L346-L370
saltant-org/saltant-py
saltant/models/task_queue.py
TaskQueue.put
def put(self): """Updates this task queue on the saltant server. Returns: :class:`saltant.models.task_queue.TaskQueue`: A task queue model instance representing the task queue just updated. """ return self.manager.put( id=self.id, ...
python
def put(self): """Updates this task queue on the saltant server. Returns: :class:`saltant.models.task_queue.TaskQueue`: A task queue model instance representing the task queue just updated. """ return self.manager.put( id=self.id, ...
[ "def", "put", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "put", "(", "id", "=", "self", ".", "id", ",", "name", "=", "self", ".", "name", ",", "description", "=", "self", ".", "description", ",", "private", "=", "self", ".", "p...
Updates this task queue on the saltant server. Returns: :class:`saltant.models.task_queue.TaskQueue`: A task queue model instance representing the task queue just updated.
[ "Updates", "this", "task", "queue", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_queue.py#L119-L137
saltant-org/saltant-py
saltant/models/task_queue.py
TaskQueueManager.get
def get(self, id=None, name=None): """Get a task queue. Either the id xor the name of the task type must be specified. Args: id (int, optional): The id of the task type to get. name (str, optional): The name of the task type to get. Returns: :class:...
python
def get(self, id=None, name=None): """Get a task queue. Either the id xor the name of the task type must be specified. Args: id (int, optional): The id of the task type to get. name (str, optional): The name of the task type to get. Returns: :class:...
[ "def", "get", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "# Validate arguments - use an xor", "if", "not", "(", "id", "is", "None", ")", "^", "(", "name", "is", "None", ")", ":", "raise", "ValueError", "(", "\"Either id or...
Get a task queue. Either the id xor the name of the task type must be specified. Args: id (int, optional): The id of the task type to get. name (str, optional): The name of the task type to get. Returns: :class:`saltant.models.task_queue.TaskQueue`: ...
[ "Get", "a", "task", "queue", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_queue.py#L156-L183
saltant-org/saltant-py
saltant/models/task_queue.py
TaskQueueManager.create
def create( self, name, description="", private=False, runs_executable_tasks=True, runs_docker_container_tasks=True, runs_singularity_container_tasks=True, active=True, whitelists=None, ): """Create a task queue. Args: ...
python
def create( self, name, description="", private=False, runs_executable_tasks=True, runs_docker_container_tasks=True, runs_singularity_container_tasks=True, active=True, whitelists=None, ): """Create a task queue. Args: ...
[ "def", "create", "(", "self", ",", "name", ",", "description", "=", "\"\"", ",", "private", "=", "False", ",", "runs_executable_tasks", "=", "True", ",", "runs_docker_container_tasks", "=", "True", ",", "runs_singularity_container_tasks", "=", "True", ",", "acti...
Create a task queue. Args: name (str): The name of the task queue. description (str, optional): A description of the task queue. private (bool, optional): A boolean specifying whether the queue is exclusive to its creator. Defaults to False. runs_...
[ "Create", "a", "task", "queue", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_queue.py#L185-L250
saltant-org/saltant-py
saltant/models/task_queue.py
TaskQueueManager.patch
def patch( self, id, name=None, description=None, private=None, runs_executable_tasks=None, runs_docker_container_tasks=None, runs_singularity_container_tasks=None, active=None, whitelists=None, ): """Partially updates a task qu...
python
def patch( self, id, name=None, description=None, private=None, runs_executable_tasks=None, runs_docker_container_tasks=None, runs_singularity_container_tasks=None, active=None, whitelists=None, ): """Partially updates a task qu...
[ "def", "patch", "(", "self", ",", "id", ",", "name", "=", "None", ",", "description", "=", "None", ",", "private", "=", "None", ",", "runs_executable_tasks", "=", "None", ",", "runs_docker_container_tasks", "=", "None", ",", "runs_singularity_container_tasks", ...
Partially updates a task queue on the saltant server. Args: id (int): The ID of the task queue. name (str, optional): The name of the task queue. description (str, optional): The description of the task queue. private (bool, optional): A Booleon s...
[ "Partially", "updates", "a", "task", "queue", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_queue.py#L252-L334
saltant-org/saltant-py
saltant/models/task_queue.py
TaskQueueManager.put
def put( self, id, name, description, private, runs_executable_tasks, runs_docker_container_tasks, runs_singularity_container_tasks, active, whitelists, ): """Updates a task queue on the saltant server. Args: ...
python
def put( self, id, name, description, private, runs_executable_tasks, runs_docker_container_tasks, runs_singularity_container_tasks, active, whitelists, ): """Updates a task queue on the saltant server. Args: ...
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "private", ",", "runs_executable_tasks", ",", "runs_docker_container_tasks", ",", "runs_singularity_container_tasks", ",", "active", ",", "whitelists", ",", ")", ":", "# Update the object", ...
Updates a task queue on the saltant server. Args: id (int): The ID of the task queue. name (str): The name of the task queue. description (str): The description of the task queue. private (bool): A Booleon signalling whether the queue can only be ...
[ "Updates", "a", "task", "queue", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/task_queue.py#L336-L397
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenSBait.main
def main(self): """ Run the required methods in the appropriate order """ self.targets() self.bait(k=49) self.reversebait(maskmiddle='t', k=19) self.subsample_reads()
python
def main(self): """ Run the required methods in the appropriate order """ self.targets() self.bait(k=49) self.reversebait(maskmiddle='t', k=19) self.subsample_reads()
[ "def", "main", "(", "self", ")", ":", "self", ".", "targets", "(", ")", "self", ".", "bait", "(", "k", "=", "49", ")", "self", ".", "reversebait", "(", "maskmiddle", "=", "'t'", ",", "k", "=", "19", ")", "self", ".", "subsample_reads", "(", ")" ]
Run the required methods in the appropriate order
[ "Run", "the", "required", "methods", "in", "the", "appropriate", "order" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L31-L38
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenSBait.targets
def targets(self): """ Create the GenObject for the analysis type, create the hash file for baiting (if necessary) """ for sample in self.runmetadata: if sample.general.bestassemblyfile != 'NA': setattr(sample, self.analysistype, GenObject()) s...
python
def targets(self): """ Create the GenObject for the analysis type, create the hash file for baiting (if necessary) """ for sample in self.runmetadata: if sample.general.bestassemblyfile != 'NA': setattr(sample, self.analysistype, GenObject()) s...
[ "def", "targets", "(", "self", ")", ":", "for", "sample", "in", "self", ".", "runmetadata", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":", "setattr", "(", "sample", ",", "self", ".", "analysistype", ",", "GenObject", "("...
Create the GenObject for the analysis type, create the hash file for baiting (if necessary)
[ "Create", "the", "GenObject", "for", "the", "analysis", "type", "create", "the", "hash", "file", "for", "baiting", "(", "if", "necessary", ")" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L40-L61
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenSSipper.targets
def targets(self): """ Using the data from the BLAST analyses, set the targets folder, and create the 'mapping file'. This is the genera-specific FASTA file that will be used for all the reference mapping; it replaces the 'bait file' in the code """ logging.info('Performi...
python
def targets(self): """ Using the data from the BLAST analyses, set the targets folder, and create the 'mapping file'. This is the genera-specific FASTA file that will be used for all the reference mapping; it replaces the 'bait file' in the code """ logging.info('Performi...
[ "def", "targets", "(", "self", ")", ":", "logging", ".", "info", "(", "'Performing analysis with {} targets folder'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "for", "sample", "in", "self", ".", "runmetadata", ":", "if", "sample", ".", "gen...
Using the data from the BLAST analyses, set the targets folder, and create the 'mapping file'. This is the genera-specific FASTA file that will be used for all the reference mapping; it replaces the 'bait file' in the code
[ "Using", "the", "data", "from", "the", "BLAST", "analyses", "set", "the", "targets", "folder", "and", "create", "the", "mapping", "file", ".", "This", "is", "the", "genera", "-", "specific", "FASTA", "file", "that", "will", "be", "used", "for", "all", "t...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L82-L106
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.runner
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) if not self.pipeline: # If the metadata has been passed from the method script, self.pipeline must still be false in order ...
python
def runner(self): """ Run the necessary methods in the correct order """ logging.info('Starting {} analysis pipeline'.format(self.analysistype)) if not self.pipeline: # If the metadata has been passed from the method script, self.pipeline must still be false in order ...
[ "def", "runner", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "if", "not", "self", ".", "pipeline", ":", "# If the metadata has been passed from the method script, s...
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/sixteenS/sixteens_full.py#L111-L151
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.subsample
def subsample(self): """ Subsample 1000 reads from the baited files """ # Create the threads for the analysis logging.info('Subsampling FASTQ reads') for _ in range(self.cpus): threads = Thread(target=self.subsamplethreads, args=()) threads.setDaem...
python
def subsample(self): """ Subsample 1000 reads from the baited files """ # Create the threads for the analysis logging.info('Subsampling FASTQ reads') for _ in range(self.cpus): threads = Thread(target=self.subsamplethreads, args=()) threads.setDaem...
[ "def", "subsample", "(", "self", ")", ":", "# Create the threads for the analysis", "logging", ".", "info", "(", "'Subsampling FASTQ reads'", ")", "for", "_", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "Thread", "(", "target", "=", "s...
Subsample 1000 reads from the baited files
[ "Subsample", "1000", "reads", "from", "the", "baited", "files" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L153-L175
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.fasta
def fasta(self): """ Convert the subsampled reads to FASTA format using reformat.sh """ logging.info('Converting FASTQ files to FASTA format') # Create the threads for the analysis for _ in range(self.cpus): threads = Thread(target=self.fastathreads, args=()) ...
python
def fasta(self): """ Convert the subsampled reads to FASTA format using reformat.sh """ logging.info('Converting FASTQ files to FASTA format') # Create the threads for the analysis for _ in range(self.cpus): threads = Thread(target=self.fastathreads, args=()) ...
[ "def", "fasta", "(", "self", ")", ":", "logging", ".", "info", "(", "'Converting FASTQ files to FASTA format'", ")", "# Create the threads for the analysis", "for", "_", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "Thread", "(", "target", ...
Convert the subsampled reads to FASTA format using reformat.sh
[ "Convert", "the", "subsampled", "reads", "to", "FASTA", "format", "using", "reformat", ".", "sh" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L194-L216
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.makeblastdb
def makeblastdb(self): """ Makes blast database files from targets as necessary """ # Iterate through the samples to set the bait file. for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': # Remove the file extension ...
python
def makeblastdb(self): """ Makes blast database files from targets as necessary """ # Iterate through the samples to set the bait file. for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': # Remove the file extension ...
[ "def", "makeblastdb", "(", "self", ")", ":", "# Iterate through the samples to set the bait file.", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":", "# Remove the file...
Makes blast database files from targets as necessary
[ "Makes", "blast", "database", "files", "from", "targets", "as", "necessary" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L235-L259
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.blast
def blast(self): """ Run BLAST analyses of the subsampled FASTQ reads against the NCBI 16S reference database """ logging.info('BLASTing FASTA files against {} database'.format(self.analysistype)) for _ in range(self.cpus): threads = Thread(target=self.blastthreads, a...
python
def blast(self): """ Run BLAST analyses of the subsampled FASTQ reads against the NCBI 16S reference database """ logging.info('BLASTing FASTA files against {} database'.format(self.analysistype)) for _ in range(self.cpus): threads = Thread(target=self.blastthreads, a...
[ "def", "blast", "(", "self", ")", ":", "logging", ".", "info", "(", "'BLASTing FASTA files against {} database'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "for", "_", "in", "range", "(", "self", ".", "cpus", ")", ":", "threads", "=", "T...
Run BLAST analyses of the subsampled FASTQ reads against the NCBI 16S reference database
[ "Run", "BLAST", "analyses", "of", "the", "subsampled", "FASTQ", "reads", "against", "the", "NCBI", "16S", "reference", "database" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L261-L289
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.blastparse
def blastparse(self): """ Parse the blast results, and store necessary data in dictionaries in sample object """ logging.info('Parsing BLAST results') # Load the NCBI 16S reference database as a dictionary for sample in self.runmetadata.samples: if sample.gene...
python
def blastparse(self): """ Parse the blast results, and store necessary data in dictionaries in sample object """ logging.info('Parsing BLAST results') # Load the NCBI 16S reference database as a dictionary for sample in self.runmetadata.samples: if sample.gene...
[ "def", "blastparse", "(", "self", ")", ":", "logging", ".", "info", "(", "'Parsing BLAST results'", ")", "# Load the NCBI 16S reference database as a dictionary", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", "general",...
Parse the blast results, and store necessary data in dictionaries in sample object
[ "Parse", "the", "blast", "results", "and", "store", "necessary", "data", "in", "dictionaries", "in", "sample", "object" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L304-L361
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
SixteenS.reporter
def reporter(self): """ Creates a report of the results """ # Create the path in which the reports are stored make_path(self.reportpath) logging.info('Creating {} report'.format(self.analysistype)) # Initialise the header and data strings header = 'Strain,...
python
def reporter(self): """ Creates a report of the results """ # Create the path in which the reports are stored make_path(self.reportpath) logging.info('Creating {} report'.format(self.analysistype)) # Initialise the header and data strings header = 'Strain,...
[ "def", "reporter", "(", "self", ")", ":", "# Create the path in which the reports are stored", "make_path", "(", "self", ".", "reportpath", ")", "logging", ".", "info", "(", "'Creating {} report'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "# Init...
Creates a report of the results
[ "Creates", "a", "report", "of", "the", "results" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L364-L413
QunarOPS/qg.core
qg/core/observer.py
Observable.add_listener
def add_listener(self, evt_name, fn): """添加观察者函数。 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 .. note:: 允许一个函数多次注册,多次注册意味着一次 :func:`fire_event` 多次调用。 """ self._listeners.setdefault(evt_name, []) listeners = self.__get_listeners(evt_name) lis...
python
def add_listener(self, evt_name, fn): """添加观察者函数。 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 .. note:: 允许一个函数多次注册,多次注册意味着一次 :func:`fire_event` 多次调用。 """ self._listeners.setdefault(evt_name, []) listeners = self.__get_listeners(evt_name) lis...
[ "def", "add_listener", "(", "self", ",", "evt_name", ",", "fn", ")", ":", "self", ".", "_listeners", ".", "setdefault", "(", "evt_name", ",", "[", "]", ")", "listeners", "=", "self", ".", "__get_listeners", "(", "evt_name", ")", "listeners", ".", "append...
添加观察者函数。 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 .. note:: 允许一个函数多次注册,多次注册意味着一次 :func:`fire_event` 多次调用。
[ "添加观察者函数。" ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/observer.py#L59-L70
QunarOPS/qg.core
qg/core/observer.py
Observable.remove_listener
def remove_listener(self, evt_name, fn, remove_all=False): """删除观察者函数。 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 :params remove_all: 是否删除fn在evt_name中的所有注册\n 如果为 `True`,则删除所有\n 如果为 `False`,则按注册先后顺序删除第一个\n .. note:: ...
python
def remove_listener(self, evt_name, fn, remove_all=False): """删除观察者函数。 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 :params remove_all: 是否删除fn在evt_name中的所有注册\n 如果为 `True`,则删除所有\n 如果为 `False`,则按注册先后顺序删除第一个\n .. note:: ...
[ "def", "remove_listener", "(", "self", ",", "evt_name", ",", "fn", ",", "remove_all", "=", "False", ")", ":", "listeners", "=", "self", ".", "__get_listeners", "(", "evt_name", ")", "if", "not", "self", ".", "has_listener", "(", "evt_name", ",", "fn", ")...
删除观察者函数。 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 :params remove_all: 是否删除fn在evt_name中的所有注册\n 如果为 `True`,则删除所有\n 如果为 `False`,则按注册先后顺序删除第一个\n .. note:: 允许一个函数多次注册,多次注册意味着一次时间多次调用。
[ "删除观察者函数。" ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/observer.py#L72-L92
QunarOPS/qg.core
qg/core/observer.py
Observable.has_listener
def has_listener(self, evt_name, fn): """指定listener是否存在 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 """ listeners = self.__get_listeners(evt_name) return fn in listeners
python
def has_listener(self, evt_name, fn): """指定listener是否存在 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数 """ listeners = self.__get_listeners(evt_name) return fn in listeners
[ "def", "has_listener", "(", "self", ",", "evt_name", ",", "fn", ")", ":", "listeners", "=", "self", ".", "__get_listeners", "(", "evt_name", ")", "return", "fn", "in", "listeners" ]
指定listener是否存在 :params evt_name: 事件名称 :params fn: 要注册的触发函数函数
[ "指定listener是否存在" ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/observer.py#L94-L101
QunarOPS/qg.core
qg/core/observer.py
Observable.fire_event
def fire_event(self, evt_name, *args, **kwargs): """触发事件 :params evt_name: 事件名称 :params args: 给事件接受者的参数 :params kwargs: 给事件接受者的参数 """ listeners = self.__get_listeners(evt_name) evt = self.generate_event(evt_name) for listener in listeners: lis...
python
def fire_event(self, evt_name, *args, **kwargs): """触发事件 :params evt_name: 事件名称 :params args: 给事件接受者的参数 :params kwargs: 给事件接受者的参数 """ listeners = self.__get_listeners(evt_name) evt = self.generate_event(evt_name) for listener in listeners: lis...
[ "def", "fire_event", "(", "self", ",", "evt_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "listeners", "=", "self", ".", "__get_listeners", "(", "evt_name", ")", "evt", "=", "self", ".", "generate_event", "(", "evt_name", ")", "for", "lis...
触发事件 :params evt_name: 事件名称 :params args: 给事件接受者的参数 :params kwargs: 给事件接受者的参数
[ "触发事件" ]
train
https://github.com/QunarOPS/qg.core/blob/d5d7e36ea140cfe73e1b1850e8c96960b02a1ed3/qg/core/observer.py#L118-L128
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
create_server_ec2
def create_server_ec2(connection, region, disk_name, disk_size, ami, key_pair, instance_type, tags={}, security_groups=None, ...
python
def create_server_ec2(connection, region, disk_name, disk_size, ami, key_pair, instance_type, tags={}, security_groups=None, ...
[ "def", "create_server_ec2", "(", "connection", ",", "region", ",", "disk_name", ",", "disk_size", ",", "ami", ",", "key_pair", ",", "instance_type", ",", "tags", "=", "{", "}", ",", "security_groups", "=", "None", ",", "delete_on_termination", "=", "True", "...
Creates EC2 Instance
[ "Creates", "EC2", "Instance" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L54-L115
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
destroy_ebs_volume
def destroy_ebs_volume(connection, region, volume_id, log=False): """ destroys an ebs volume """ if ebs_volume_exists(connection, region, volume_id): if log: log_yellow('destroying EBS volume ...') try: connection.delete_volume(volume_id) except: # ou...
python
def destroy_ebs_volume(connection, region, volume_id, log=False): """ destroys an ebs volume """ if ebs_volume_exists(connection, region, volume_id): if log: log_yellow('destroying EBS volume ...') try: connection.delete_volume(volume_id) except: # ou...
[ "def", "destroy_ebs_volume", "(", "connection", ",", "region", ",", "volume_id", ",", "log", "=", "False", ")", ":", "if", "ebs_volume_exists", "(", "connection", ",", "region", ",", "volume_id", ")", ":", "if", "log", ":", "log_yellow", "(", "'destroying EB...
destroys an ebs volume
[ "destroys", "an", "ebs", "volume" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L118-L133
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
destroy_ec2
def destroy_ec2(connection, region, instance_id, log=False): """ terminates the instance """ data = get_ec2_info(connection=connection, instance_id=instance_id, region=region) instance = connection.terminate_instances(instance_ids=[data['id']])[0] if log...
python
def destroy_ec2(connection, region, instance_id, log=False): """ terminates the instance """ data = get_ec2_info(connection=connection, instance_id=instance_id, region=region) instance = connection.terminate_instances(instance_ids=[data['id']])[0] if log...
[ "def", "destroy_ec2", "(", "connection", ",", "region", ",", "instance_id", ",", "log", "=", "False", ")", ":", "data", "=", "get_ec2_info", "(", "connection", "=", "connection", ",", "instance_id", "=", "instance_id", ",", "region", "=", "region", ")", "i...
terminates the instance
[ "terminates", "the", "instance" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L136-L153
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
down_ec2
def down_ec2(connection, instance_id, region, log=False): """ shutdown of an existing EC2 instance """ # get the instance_id from the state file, and stop the instance instance = connection.stop_instances(instance_ids=instance_id)[0] while instance.state != "stopped": if log: log_yel...
python
def down_ec2(connection, instance_id, region, log=False): """ shutdown of an existing EC2 instance """ # get the instance_id from the state file, and stop the instance instance = connection.stop_instances(instance_ids=instance_id)[0] while instance.state != "stopped": if log: log_yel...
[ "def", "down_ec2", "(", "connection", ",", "instance_id", ",", "region", ",", "log", "=", "False", ")", ":", "# get the instance_id from the state file, and stop the instance", "instance", "=", "connection", ".", "stop_instances", "(", "instance_ids", "=", "instance_id"...
shutdown of an existing EC2 instance
[ "shutdown", "of", "an", "existing", "EC2", "instance" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L156-L166
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
ebs_volume_exists
def ebs_volume_exists(connection, region, volume_id): """ finds out if a ebs volume exists """ for vol in connection.get_all_volumes(): if vol.id == volume_id: return True return False
python
def ebs_volume_exists(connection, region, volume_id): """ finds out if a ebs volume exists """ for vol in connection.get_all_volumes(): if vol.id == volume_id: return True return False
[ "def", "ebs_volume_exists", "(", "connection", ",", "region", ",", "volume_id", ")", ":", "for", "vol", "in", "connection", ".", "get_all_volumes", "(", ")", ":", "if", "vol", ".", "id", "==", "volume_id", ":", "return", "True", "return", "False" ]
finds out if a ebs volume exists
[ "finds", "out", "if", "a", "ebs", "volume", "exists" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L169-L174
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
get_ec2_info
def get_ec2_info(connection, instance_id, region, username=None): """ queries EC2 for details about a particular instance_id """ instance = connection.get_only_instances( filters={'instance_id': instance_id} )[0] data = instance.__dict_...
python
def get_ec2_info(connection, instance_id, region, username=None): """ queries EC2 for details about a particular instance_id """ instance = connection.get_only_instances( filters={'instance_id': instance_id} )[0] data = instance.__dict_...
[ "def", "get_ec2_info", "(", "connection", ",", "instance_id", ",", "region", ",", "username", "=", "None", ")", ":", "instance", "=", "connection", ".", "get_only_instances", "(", "filters", "=", "{", "'instance_id'", ":", "instance_id", "}", ")", "[", "0", ...
queries EC2 for details about a particular instance_id
[ "queries", "EC2", "for", "details", "about", "a", "particular", "instance_id" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L181-L202
pyBookshelf/bookshelf
bookshelf/api_v2/ec2.py
up_ec2
def up_ec2(connection, region, instance_id, wait_for_ssh_available=True, log=False, timeout=600): """ boots an existing ec2_instance """ # boot the ec2 instance instance = connection.start_instances(instance_ids=instance_id)[0] instance.update() ...
python
def up_ec2(connection, region, instance_id, wait_for_ssh_available=True, log=False, timeout=600): """ boots an existing ec2_instance """ # boot the ec2 instance instance = connection.start_instances(instance_ids=instance_id)[0] instance.update() ...
[ "def", "up_ec2", "(", "connection", ",", "region", ",", "instance_id", ",", "wait_for_ssh_available", "=", "True", ",", "log", "=", "False", ",", "timeout", "=", "600", ")", ":", "# boot the ec2 instance", "instance", "=", "connection", ".", "start_instances", ...
boots an existing ec2_instance
[ "boots", "an", "existing", "ec2_instance" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/ec2.py#L205-L226
tsnaomi/finnsyll
finnsyll/prev/v03.py
apply_T4
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = word.split('.') for i, v in enumerate(WORD): # i % 2 != 0 prevents this rule from applying to first, third, etc. ...
python
def apply_T4(word): '''An agglutination diphthong that ends in /u, y/ usually contains a syllable boundary when -C# or -CCV follow, e.g., [lau.ka.us], [va.ka.ut.taa].''' WORD = word.split('.') for i, v in enumerate(WORD): # i % 2 != 0 prevents this rule from applying to first, third, etc. ...
[ "def", "apply_T4", "(", "word", ")", ":", "WORD", "=", "word", ".", "split", "(", "'.'", ")", "for", "i", ",", "v", "in", "enumerate", "(", "WORD", ")", ":", "# i % 2 != 0 prevents this rule from applying to first, third, etc.", "# syllables, which receive stress (W...
An agglutination diphthong that ends in /u, y/ usually 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", "/", "usually", "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/v03.py#L137-L159
OLC-Bioinformatics/sipprverse
cgecore/utility.py
seqs_from_file
def seqs_from_file(filename, exit_on_err=False, return_qual=False): """Extract sequences from a file Name: seqs_from_file Author(s): Martin C F Thomsen Date: 18 Jul 2013 Description: Iterator which extract sequence data from the input file Args: filename: string which...
python
def seqs_from_file(filename, exit_on_err=False, return_qual=False): """Extract sequences from a file Name: seqs_from_file Author(s): Martin C F Thomsen Date: 18 Jul 2013 Description: Iterator which extract sequence data from the input file Args: filename: string which...
[ "def", "seqs_from_file", "(", "filename", ",", "exit_on_err", "=", "False", ",", "return_qual", "=", "False", ")", ":", "# VALIDATE INPUT", "if", "not", "isinstance", "(", "filename", ",", "str", ")", ":", "msg", "=", "'Filename has to be a string.'", "if", "e...
Extract sequences from a file Name: seqs_from_file Author(s): Martin C F Thomsen Date: 18 Jul 2013 Description: Iterator which extract sequence data from the input file Args: filename: string which contain a path to the input file Supported Formats: fasta, fastq...
[ "Extract", "sequences", "from", "a", "file", "Name", ":", "seqs_from_file", "Author", "(", "s", ")", ":", "Martin", "C", "F", "Thomsen", "Date", ":", "18", "Jul", "2013", "Description", ":", "Iterator", "which", "extract", "sequence", "data", "from", "the"...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/utility.py#L223-L318
OLC-Bioinformatics/sipprverse
cgecore/utility.py
open_
def open_(filename, mode=None, compresslevel=9): """Switch for both open() and gzip.open(). Determines if the file is normal or gzipped by looking at the file extension. The filename argument is required; mode defaults to 'rb' for gzip and 'r' for normal and compresslevel defaults to 9 for gzip. ...
python
def open_(filename, mode=None, compresslevel=9): """Switch for both open() and gzip.open(). Determines if the file is normal or gzipped by looking at the file extension. The filename argument is required; mode defaults to 'rb' for gzip and 'r' for normal and compresslevel defaults to 9 for gzip. ...
[ "def", "open_", "(", "filename", ",", "mode", "=", "None", ",", "compresslevel", "=", "9", ")", ":", "if", "filename", "[", "-", "3", ":", "]", "==", "'.gz'", ":", "if", "mode", "is", "None", ":", "mode", "=", "'rt'", "return", "closing", "(", "g...
Switch for both open() and gzip.open(). Determines if the file is normal or gzipped by looking at the file extension. The filename argument is required; mode defaults to 'rb' for gzip and 'r' for normal and compresslevel defaults to 9 for gzip. >>> import gzip >>> from contextlib import cl...
[ "Switch", "for", "both", "open", "()", "and", "gzip", ".", "open", "()", ".", "Determines", "if", "the", "file", "is", "normal", "or", "gzipped", "by", "looking", "at", "the", "file", "extension", ".", "The", "filename", "argument", "is", "required", ";"...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/utility.py#L321-L340
OLC-Bioinformatics/sipprverse
cgecore/utility.py
load_json
def load_json(json_object): ''' Load json from file or file name ''' content = None if isinstance(json_object, str) and os.path.exists(json_object): with open_(json_object) as f: try: content = json.load(f) except Exception as e: debug.log("Warning: Content of '%...
python
def load_json(json_object): ''' Load json from file or file name ''' content = None if isinstance(json_object, str) and os.path.exists(json_object): with open_(json_object) as f: try: content = json.load(f) except Exception as e: debug.log("Warning: Content of '%...
[ "def", "load_json", "(", "json_object", ")", ":", "content", "=", "None", "if", "isinstance", "(", "json_object", ",", "str", ")", "and", "os", ".", "path", ".", "exists", "(", "json_object", ")", ":", "with", "open_", "(", "json_object", ")", "as", "f...
Load json from file or file name
[ "Load", "json", "from", "file", "or", "file", "name" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/utility.py#L342-L358
OLC-Bioinformatics/sipprverse
cgecore/utility.py
sort2groups
def sort2groups(array, gpat=['_R1','_R2']): """ Sort an array of strings to groups by patterns """ groups = [REGroup(gp) for gp in gpat] unmatched = [] for item in array: matched = False for m in groups: if m.match(item): matched = True break if not matched...
python
def sort2groups(array, gpat=['_R1','_R2']): """ Sort an array of strings to groups by patterns """ groups = [REGroup(gp) for gp in gpat] unmatched = [] for item in array: matched = False for m in groups: if m.match(item): matched = True break if not matched...
[ "def", "sort2groups", "(", "array", ",", "gpat", "=", "[", "'_R1'", ",", "'_R2'", "]", ")", ":", "groups", "=", "[", "REGroup", "(", "gp", ")", "for", "gp", "in", "gpat", "]", "unmatched", "=", "[", "]", "for", "item", "in", "array", ":", "matche...
Sort an array of strings to groups by patterns
[ "Sort", "an", "array", "of", "strings", "to", "groups", "by", "patterns" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/utility.py#L360-L371
OLC-Bioinformatics/sipprverse
cgecore/utility.py
sort_and_distribute
def sort_and_distribute(array, splits=2): """ Sort an array of strings to groups by alphabetically continuous distribution """ if not isinstance(array, (list,tuple)): raise TypeError("array must be a list") if not isinstance(splits, int): raise TypeError("splits must be an integer") remaining = so...
python
def sort_and_distribute(array, splits=2): """ Sort an array of strings to groups by alphabetically continuous distribution """ if not isinstance(array, (list,tuple)): raise TypeError("array must be a list") if not isinstance(splits, int): raise TypeError("splits must be an integer") remaining = so...
[ "def", "sort_and_distribute", "(", "array", ",", "splits", "=", "2", ")", ":", "if", "not", "isinstance", "(", "array", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"array must be a list\"", ")", "if", "not", "isinstance", ...
Sort an array of strings to groups by alphabetically continuous distribution
[ "Sort", "an", "array", "of", "strings", "to", "groups", "by", "alphabetically", "continuous", "distribution" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/utility.py#L373-L388
OLC-Bioinformatics/sipprverse
cgecore/utility.py
mkpath
def mkpath(filepath, permissions=0o777): """ This function executes a mkdir command for filepath and with permissions (octal number with leading 0 or string only) # eg. mkpath("path/to/file", "0o775") """ # Converting string of octal to integer, if string is given. if isinstance(permissions, str): ...
python
def mkpath(filepath, permissions=0o777): """ This function executes a mkdir command for filepath and with permissions (octal number with leading 0 or string only) # eg. mkpath("path/to/file", "0o775") """ # Converting string of octal to integer, if string is given. if isinstance(permissions, str): ...
[ "def", "mkpath", "(", "filepath", ",", "permissions", "=", "0o777", ")", ":", "# Converting string of octal to integer, if string is given.", "if", "isinstance", "(", "permissions", ",", "str", ")", ":", "permissions", "=", "sum", "(", "[", "int", "(", "x", ")",...
This function executes a mkdir command for filepath and with permissions (octal number with leading 0 or string only) # eg. mkpath("path/to/file", "0o775")
[ "This", "function", "executes", "a", "mkdir", "command", "for", "filepath", "and", "with", "permissions", "(", "octal", "number", "with", "leading", "0", "or", "string", "only", ")", "#", "eg", ".", "mkpath", "(", "path", "/", "to", "/", "file", "0o775",...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/utility.py#L390-L405