partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | abstractInterInterfaces.has_autolog | Read auto-connection parameters and returns local password or None | pyDLib/Core/controller.py | def has_autolog(self, user_id):
"""
Read auto-connection parameters and returns local password or None
"""
try:
with open("local/init", "rb") as f:
s = f.read()
s = security.protege_data(s, False)
self.autolog = json.loads(s).ge... | def has_autolog(self, user_id):
"""
Read auto-connection parameters and returns local password or None
"""
try:
with open("local/init", "rb") as f:
s = f.read()
s = security.protege_data(s, False)
self.autolog = json.loads(s).ge... | [
"Read",
"auto",
"-",
"connection",
"parameters",
"and",
"returns",
"local",
"password",
"or",
"None"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L307-L320 | [
"def",
"has_autolog",
"(",
"self",
",",
"user_id",
")",
":",
"try",
":",
"with",
"open",
"(",
"\"local/init\"",
",",
"\"rb\"",
")",
"as",
"f",
":",
"s",
"=",
"f",
".",
"read",
"(",
")",
"s",
"=",
"security",
".",
"protege_data",
"(",
"s",
",",
"F... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractInterInterfaces.loggin | Check mdp and return True it's ok | pyDLib/Core/controller.py | def loggin(self, user_id, mdp, autolog):
"""Check mdp and return True it's ok"""
r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp)
if r():
# update auto-log params
self.autolog[user_id] = autolog and mdp or False
self.modules = self.users[user_id]["modu... | def loggin(self, user_id, mdp, autolog):
"""Check mdp and return True it's ok"""
r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp)
if r():
# update auto-log params
self.autolog[user_id] = autolog and mdp or False
self.modules = self.users[user_id]["modu... | [
"Check",
"mdp",
"and",
"return",
"True",
"it",
"s",
"ok"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L322-L339 | [
"def",
"loggin",
"(",
"self",
",",
"user_id",
",",
"mdp",
",",
"autolog",
")",
":",
"r",
"=",
"sql",
".",
"abstractRequetesSQL",
".",
"check_mdp_user",
"(",
"user_id",
",",
"mdp",
")",
"if",
"r",
"(",
")",
":",
"# update auto-log params",
"self",
".",
... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | Window.add_widget | Convenience function | pyDLib/GUI/fenetres.py | def add_widget(self, w):
"""Convenience function"""
if self.layout():
self.layout().addWidget(w)
else:
layout = QVBoxLayout(self)
layout.addWidget(w) | def add_widget(self, w):
"""Convenience function"""
if self.layout():
self.layout().addWidget(w)
else:
layout = QVBoxLayout(self)
layout.addWidget(w) | [
"Convenience",
"function"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fenetres.py#L114-L120 | [
"def",
"add_widget",
"(",
"self",
",",
"w",
")",
":",
"if",
"self",
".",
"layout",
"(",
")",
":",
"self",
".",
"layout",
"(",
")",
".",
"addWidget",
"(",
"w",
")",
"else",
":",
"layout",
"=",
"QVBoxLayout",
"(",
"self",
")",
"layout",
".",
"addWi... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | Window.add_layout | Convenience function | pyDLib/GUI/fenetres.py | def add_layout(self, l):
"""Convenience function"""
if self.layout():
self.layout().addLayout(l)
else:
layout = QVBoxLayout(self)
layout.addLayout(l) | def add_layout(self, l):
"""Convenience function"""
if self.layout():
self.layout().addLayout(l)
else:
layout = QVBoxLayout(self)
layout.addLayout(l) | [
"Convenience",
"function"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fenetres.py#L122-L128 | [
"def",
"add_layout",
"(",
"self",
",",
"l",
")",
":",
"if",
"self",
".",
"layout",
"(",
")",
":",
"self",
".",
"layout",
"(",
")",
".",
"addLayout",
"(",
"l",
")",
"else",
":",
"layout",
"=",
"QVBoxLayout",
"(",
"self",
")",
"layout",
".",
"addLa... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | mkpad | Find the length of the longest element of a list. Return that value + two. | columns/columns.py | def mkpad(items):
'''
Find the length of the longest element of a list. Return that value + two.
'''
pad = 0
stritems = [str(e) for e in items] # cast list to strings
for e in stritems:
index = stritems.index(e)
if len(stritems[index]) > pad:
pad = len(stritems[index... | def mkpad(items):
'''
Find the length of the longest element of a list. Return that value + two.
'''
pad = 0
stritems = [str(e) for e in items] # cast list to strings
for e in stritems:
index = stritems.index(e)
if len(stritems[index]) > pad:
pad = len(stritems[index... | [
"Find",
"the",
"length",
"of",
"the",
"longest",
"element",
"of",
"a",
"list",
".",
"Return",
"that",
"value",
"+",
"two",
"."
] | tslight/columns | python | https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L5-L16 | [
"def",
"mkpad",
"(",
"items",
")",
":",
"pad",
"=",
"0",
"stritems",
"=",
"[",
"str",
"(",
"e",
")",
"for",
"e",
"in",
"items",
"]",
"# cast list to strings",
"for",
"e",
"in",
"stritems",
":",
"index",
"=",
"stritems",
".",
"index",
"(",
"e",
")",... | 609ec92c00c9a6d452d4c6cc20551882997d4871 |
train | mkcols | Compute the size of our columns by first making them a divisible of our row
height and then splitting our list into smaller lists the size of the row
height. | columns/columns.py | def mkcols(l, rows):
'''
Compute the size of our columns by first making them a divisible of our row
height and then splitting our list into smaller lists the size of the row
height.
'''
cols = []
base = 0
while len(l) > rows and len(l) % rows != 0:
l.append("")
for i in rang... | def mkcols(l, rows):
'''
Compute the size of our columns by first making them a divisible of our row
height and then splitting our list into smaller lists the size of the row
height.
'''
cols = []
base = 0
while len(l) > rows and len(l) % rows != 0:
l.append("")
for i in rang... | [
"Compute",
"the",
"size",
"of",
"our",
"columns",
"by",
"first",
"making",
"them",
"a",
"divisible",
"of",
"our",
"row",
"height",
"and",
"then",
"splitting",
"our",
"list",
"into",
"smaller",
"lists",
"the",
"size",
"of",
"the",
"row",
"height",
"."
] | tslight/columns | python | https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L19-L32 | [
"def",
"mkcols",
"(",
"l",
",",
"rows",
")",
":",
"cols",
"=",
"[",
"]",
"base",
"=",
"0",
"while",
"len",
"(",
"l",
")",
">",
"rows",
"and",
"len",
"(",
"l",
")",
"%",
"rows",
"!=",
"0",
":",
"l",
".",
"append",
"(",
"\"\"",
")",
"for",
... | 609ec92c00c9a6d452d4c6cc20551882997d4871 |
train | mkrows | Compute the optimal number of rows based on our lists' largest element and
our terminal size in columns and rows.
Work out our maximum column number by dividing the width of the terminal by
our largest element.
While the length of our list is greater than the total number of elements we
can fit on... | columns/columns.py | def mkrows(l, pad, width, height):
'''
Compute the optimal number of rows based on our lists' largest element and
our terminal size in columns and rows.
Work out our maximum column number by dividing the width of the terminal by
our largest element.
While the length of our list is greater than... | def mkrows(l, pad, width, height):
'''
Compute the optimal number of rows based on our lists' largest element and
our terminal size in columns and rows.
Work out our maximum column number by dividing the width of the terminal by
our largest element.
While the length of our list is greater than... | [
"Compute",
"the",
"optimal",
"number",
"of",
"rows",
"based",
"on",
"our",
"lists",
"largest",
"element",
"and",
"our",
"terminal",
"size",
"in",
"columns",
"and",
"rows",
"."
] | tslight/columns | python | https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L35-L49 | [
"def",
"mkrows",
"(",
"l",
",",
"pad",
",",
"width",
",",
"height",
")",
":",
"maxcols",
"=",
"int",
"(",
"width",
"/",
"pad",
")",
"while",
"len",
"(",
"l",
")",
">",
"height",
"*",
"maxcols",
":",
"height",
"+=",
"1",
"return",
"height"
] | 609ec92c00c9a6d452d4c6cc20551882997d4871 |
train | prtcols | After computing the size of our rows and columns based on the terminal size
and length of the largest element, use zip to aggregate our column lists
into row lists and then iterate over the row lists and print them. | columns/columns.py | def prtcols(items, vpad=6):
'''
After computing the size of our rows and columns based on the terminal size
and length of the largest element, use zip to aggregate our column lists
into row lists and then iterate over the row lists and print them.
'''
from os import get_terminal_size
items =... | def prtcols(items, vpad=6):
'''
After computing the size of our rows and columns based on the terminal size
and length of the largest element, use zip to aggregate our column lists
into row lists and then iterate over the row lists and print them.
'''
from os import get_terminal_size
items =... | [
"After",
"computing",
"the",
"size",
"of",
"our",
"rows",
"and",
"columns",
"based",
"on",
"the",
"terminal",
"size",
"and",
"length",
"of",
"the",
"largest",
"element",
"use",
"zip",
"to",
"aggregate",
"our",
"column",
"lists",
"into",
"row",
"lists",
"an... | tslight/columns | python | https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L52-L68 | [
"def",
"prtcols",
"(",
"items",
",",
"vpad",
"=",
"6",
")",
":",
"from",
"os",
"import",
"get_terminal_size",
"items",
"=",
"list",
"(",
"items",
")",
"# copy list so we don't mutate it",
"width",
",",
"height",
"=",
"get_terminal_size",
"(",
")",
"height",
... | 609ec92c00c9a6d452d4c6cc20551882997d4871 |
train | cmd2list | Executes a command through the operating system and returns the output
as a list, or on error a string with the standard error.
EXAMPLE:
>>> from subprocess import Popen, PIPE
>>> CMDout2array('ls -l') | cgecore/cmdline.py | def cmd2list(cmd):
''' Executes a command through the operating system and returns the output
as a list, or on error a string with the standard error.
EXAMPLE:
>>> from subprocess import Popen, PIPE
>>> CMDout2array('ls -l')
'''
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
stdout, ... | def cmd2list(cmd):
''' Executes a command through the operating system and returns the output
as a list, or on error a string with the standard error.
EXAMPLE:
>>> from subprocess import Popen, PIPE
>>> CMDout2array('ls -l')
'''
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
stdout, ... | [
"Executes",
"a",
"command",
"through",
"the",
"operating",
"system",
"and",
"returns",
"the",
"output",
"as",
"a",
"list",
"or",
"on",
"error",
"a",
"string",
"with",
"the",
"standard",
"error",
".",
"EXAMPLE",
":",
">>>",
"from",
"subprocess",
"import",
"... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L532-L544 | [
"def",
"cmd2list",
"(",
"cmd",
")",
":",
"p",
"=",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"PIPE",
",",
"stderr",
"=",
"PIPE",
",",
"shell",
"=",
"True",
")",
"stdout",
",",
"stderr",
"=",
"p",
".",
"communicate",
"(",
")",
"if",
"p",
".",
"re... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | ProgramList.return_timer | Return a text formatted timer | cgecore/cmdline.py | def return_timer(self, name, status, timer):
''' Return a text formatted timer '''
timer_template = '%s %s %s : %s : %9s'
t = str(timedelta(0, timer)).split(',')[-1].strip().split(':')
#t = str(timedelta(0, timer)).split(':')
if len(t) == 4:
h, m, s = int(t[0])*24 + int(t[1]), i... | def return_timer(self, name, status, timer):
''' Return a text formatted timer '''
timer_template = '%s %s %s : %s : %9s'
t = str(timedelta(0, timer)).split(',')[-1].strip().split(':')
#t = str(timedelta(0, timer)).split(':')
if len(t) == 4:
h, m, s = int(t[0])*24 + int(t[1]), i... | [
"Return",
"a",
"text",
"formatted",
"timer"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L77-L92 | [
"def",
"return_timer",
"(",
"self",
",",
"name",
",",
"status",
",",
"timer",
")",
":",
"timer_template",
"=",
"'%s %s %s : %s : %9s'",
"t",
"=",
"str",
"(",
"timedelta",
"(",
"0",
",",
"timer",
")",
")",
".",
"split",
"(",
"','",
")",
"[",
"-",
"1... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | ProgramList.print_timers | PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS | cgecore/cmdline.py | def print_timers(self):
''' PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS '''
self.timer += time()
total_time = self.timer
tmp = '* %s *'
debug.log(
'',
'* '*29,
tmp%(' '*51),
tmp%('%s %s %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Ti... | def print_timers(self):
''' PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS '''
self.timer += time()
total_time = self.timer
tmp = '* %s *'
debug.log(
'',
'* '*29,
tmp%(' '*51),
tmp%('%s %s %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Ti... | [
"PRINT",
"EXECUTION",
"TIMES",
"FOR",
"THE",
"LIST",
"OF",
"PROGRAMS"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L93-L120 | [
"def",
"print_timers",
"(",
"self",
")",
":",
"self",
".",
"timer",
"+=",
"time",
"(",
")",
"total_time",
"=",
"self",
".",
"timer",
"tmp",
"=",
"'* %s *'",
"debug",
".",
"log",
"(",
"''",
",",
"'* '",
"*",
"29",
",",
"tmp",
"%",
"(",
"' '",
"*... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.get_cmd | This function combines and return the commanline call of the program. | cgecore/cmdline.py | def get_cmd(self):
""" This function combines and return the commanline call of the program.
"""
cmd = []
if self.path is not None:
if '/' in self.path and not os.path.exists(self.path):
debug.log('Error: path contains / but does not exist: %s'%self.path)
else:
... | def get_cmd(self):
""" This function combines and return the commanline call of the program.
"""
cmd = []
if self.path is not None:
if '/' in self.path and not os.path.exists(self.path):
debug.log('Error: path contains / but does not exist: %s'%self.path)
else:
... | [
"This",
"function",
"combines",
"and",
"return",
"the",
"commanline",
"call",
"of",
"the",
"program",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L186-L211 | [
"def",
"get_cmd",
"(",
"self",
")",
":",
"cmd",
"=",
"[",
"]",
"if",
"self",
".",
"path",
"is",
"not",
"None",
":",
"if",
"'/'",
"in",
"self",
".",
"path",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"path",
")",
":",
"d... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.append_args | This function appends the provided arguments to the program object. | cgecore/cmdline.py | def append_args(self, arg):
""" This function appends the provided arguments to the program object.
"""
debug.log("Adding Arguments: %s"%(arg))
if isinstance(arg, (int,float)): self.args.append(str(arg))
if isinstance(arg, str): self.args.append(arg)
if isinstance(arg, list):
... | def append_args(self, arg):
""" This function appends the provided arguments to the program object.
"""
debug.log("Adding Arguments: %s"%(arg))
if isinstance(arg, (int,float)): self.args.append(str(arg))
if isinstance(arg, str): self.args.append(arg)
if isinstance(arg, list):
... | [
"This",
"function",
"appends",
"the",
"provided",
"arguments",
"to",
"the",
"program",
"object",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L215-L225 | [
"def",
"append_args",
"(",
"self",
",",
"arg",
")",
":",
"debug",
".",
"log",
"(",
"\"Adding Arguments: %s\"",
"%",
"(",
"arg",
")",
")",
"if",
"isinstance",
"(",
"arg",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"self",
".",
"args",
".",
"appen... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.execute | This function Executes the program with set arguments. | cgecore/cmdline.py | def execute(self):
""" This function Executes the program with set arguments. """
prog_cmd = self.get_cmd().strip()
if prog_cmd == '':
self.status = 'Failure'
debug.log("Error: No program to execute for %s!"%self.name)
debug.log(("Could not combine path and arguments into cm... | def execute(self):
""" This function Executes the program with set arguments. """
prog_cmd = self.get_cmd().strip()
if prog_cmd == '':
self.status = 'Failure'
debug.log("Error: No program to execute for %s!"%self.name)
debug.log(("Could not combine path and arguments into cm... | [
"This",
"function",
"Executes",
"the",
"program",
"with",
"set",
"arguments",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L226-L305 | [
"def",
"execute",
"(",
"self",
")",
":",
"prog_cmd",
"=",
"self",
".",
"get_cmd",
"(",
")",
".",
"strip",
"(",
")",
"if",
"prog_cmd",
"==",
"''",
":",
"self",
".",
"status",
"=",
"'Failure'",
"debug",
".",
"log",
"(",
"\"Error: No program to execute for ... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.wait | This function will wait on a given pattern being shown on the last
line of a given outputfile.
OPTIONS
pattern - The string pattern to recognise when a program
finished properly.
interval - The amount of seconds to wait between checking the
... | cgecore/cmdline.py | def wait(self, pattern='Done', interval=None,
epatterns=['error','Error','STACK','Traceback']):
""" This function will wait on a given pattern being shown on the last
line of a given outputfile.
OPTIONS
pattern - The string pattern to recognise when a program
... | def wait(self, pattern='Done', interval=None,
epatterns=['error','Error','STACK','Traceback']):
""" This function will wait on a given pattern being shown on the last
line of a given outputfile.
OPTIONS
pattern - The string pattern to recognise when a program
... | [
"This",
"function",
"will",
"wait",
"on",
"a",
"given",
"pattern",
"being",
"shown",
"on",
"the",
"last",
"line",
"of",
"a",
"given",
"outputfile",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L306-L454 | [
"def",
"wait",
"(",
"self",
",",
"pattern",
"=",
"'Done'",
",",
"interval",
"=",
"None",
",",
"epatterns",
"=",
"[",
"'error'",
",",
"'Error'",
",",
"'STACK'",
",",
"'Traceback'",
"]",
")",
":",
"increasing_interval",
"=",
"False",
"if",
"interval",
"is"... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.print_stdout | This function will read the standard out of the program and print it | cgecore/cmdline.py | def print_stdout(self):
""" This function will read the standard out of the program and print it
"""
# First we check if the file we want to print does exists
if self.wdir != '':
stdout = "%s/%s"%(self.wdir, self.stdout)
else:
stdout = self.stdout
if os.path.exists(... | def print_stdout(self):
""" This function will read the standard out of the program and print it
"""
# First we check if the file we want to print does exists
if self.wdir != '':
stdout = "%s/%s"%(self.wdir, self.stdout)
else:
stdout = self.stdout
if os.path.exists(... | [
"This",
"function",
"will",
"read",
"the",
"standard",
"out",
"of",
"the",
"program",
"and",
"print",
"it"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L455-L467 | [
"def",
"print_stdout",
"(",
"self",
")",
":",
"# First we check if the file we want to print does exists",
"if",
"self",
".",
"wdir",
"!=",
"''",
":",
"stdout",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"wdir",
",",
"self",
".",
"stdout",
")",
"else",
":",
"s... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.find_out_var | This function will read the standard out of the program, catch
variables and return the values
EG. #varname=value | cgecore/cmdline.py | def find_out_var(self, varnames=[]):
""" This function will read the standard out of the program, catch
variables and return the values
EG. #varname=value
"""
if self.wdir != '':
stdout = "%s/%s"%(self.wdir, self.stdout)
else:
stdout = self.stdout
res... | def find_out_var(self, varnames=[]):
""" This function will read the standard out of the program, catch
variables and return the values
EG. #varname=value
"""
if self.wdir != '':
stdout = "%s/%s"%(self.wdir, self.stdout)
else:
stdout = self.stdout
res... | [
"This",
"function",
"will",
"read",
"the",
"standard",
"out",
"of",
"the",
"program",
"catch",
"variables",
"and",
"return",
"the",
"values"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L468-L490 | [
"def",
"find_out_var",
"(",
"self",
",",
"varnames",
"=",
"[",
"]",
")",
":",
"if",
"self",
".",
"wdir",
"!=",
"''",
":",
"stdout",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"wdir",
",",
"self",
".",
"stdout",
")",
"else",
":",
"stdout",
"=",
"sel... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.find_err_pattern | This function will read the standard error of the program and return
a matching pattern if found.
EG. prog_obj.FindErrPattern("Update of mySQL failed") | cgecore/cmdline.py | def find_err_pattern(self, pattern):
""" This function will read the standard error of the program and return
a matching pattern if found.
EG. prog_obj.FindErrPattern("Update of mySQL failed")
"""
if self.wdir != '':
stderr = "%s/%s"%(self.wdir, self.stderr)
else:
... | def find_err_pattern(self, pattern):
""" This function will read the standard error of the program and return
a matching pattern if found.
EG. prog_obj.FindErrPattern("Update of mySQL failed")
"""
if self.wdir != '':
stderr = "%s/%s"%(self.wdir, self.stderr)
else:
... | [
"This",
"function",
"will",
"read",
"the",
"standard",
"error",
"of",
"the",
"program",
"and",
"return",
"a",
"matching",
"pattern",
"if",
"found",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L491-L510 | [
"def",
"find_err_pattern",
"(",
"self",
",",
"pattern",
")",
":",
"if",
"self",
".",
"wdir",
"!=",
"''",
":",
"stderr",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"wdir",
",",
"self",
".",
"stderr",
")",
"else",
":",
"stderr",
"=",
"self",
".",
"stde... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Program.find_out_pattern | This function will read the standard error of the program and return
a matching pattern if found.
EG. prog_obj.FindErrPattern("Update of mySQL failed") | cgecore/cmdline.py | def find_out_pattern(self, pattern):
""" This function will read the standard error of the program and return
a matching pattern if found.
EG. prog_obj.FindErrPattern("Update of mySQL failed")
"""
if self.wdir != '':
stdout = "%s/%s"%(self.wdir, self.stdout)
else:
... | def find_out_pattern(self, pattern):
""" This function will read the standard error of the program and return
a matching pattern if found.
EG. prog_obj.FindErrPattern("Update of mySQL failed")
"""
if self.wdir != '':
stdout = "%s/%s"%(self.wdir, self.stdout)
else:
... | [
"This",
"function",
"will",
"read",
"the",
"standard",
"error",
"of",
"the",
"program",
"and",
"return",
"a",
"matching",
"pattern",
"if",
"found",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L511-L530 | [
"def",
"find_out_pattern",
"(",
"self",
",",
"pattern",
")",
":",
"if",
"self",
".",
"wdir",
"!=",
"''",
":",
"stdout",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"wdir",
",",
"self",
".",
"stdout",
")",
"else",
":",
"stdout",
"=",
"self",
".",
"stdo... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | decode_nfo | Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437
to Unicode. | mrcrowbar/lib/os/dos.py | def decode_nfo( buffer ):
"""Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437
to Unicode."""
assert utils.is_bytes( buffer )
return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] ) | def decode_nfo( buffer ):
"""Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437
to Unicode."""
assert utils.is_bytes( buffer )
return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] ) | [
"Decodes",
"a",
"byte",
"string",
"in",
"NFO",
"format",
"(",
"beloved",
"by",
"PC",
"scener",
"groups",
")",
"from",
"DOS",
"Code",
"Page",
"437",
"to",
"Unicode",
"."
] | moralrecordings/mrcrowbar | python | https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/os/dos.py#L10-L14 | [
"def",
"decode_nfo",
"(",
"buffer",
")",
":",
"assert",
"utils",
".",
"is_bytes",
"(",
"buffer",
")",
"return",
"'\\n'",
".",
"join",
"(",
"[",
"''",
".",
"join",
"(",
"[",
"CP437",
"[",
"y",
"]",
"for",
"y",
"in",
"x",
"]",
")",
"for",
"x",
"i... | b1ed882c4555552e7656b2d84aca543184577fa3 |
train | GeneSippr.runner | Run the necessary methods in the correct order | MLSTsippr/mlst.py | def runner(self):
"""
Run the necessary methods in the correct order
"""
if os.path.isfile(self.report):
self.report_parse()
else:
logging.info('Starting {} analysis pipeline'.format(self.analysistype))
# Create the objects to be used in the an... | def runner(self):
"""
Run the necessary methods in the correct order
"""
if os.path.isfile(self.report):
self.report_parse()
else:
logging.info('Starting {} analysis pipeline'.format(self.analysistype))
# Create the objects to be used in the an... | [
"Run",
"the",
"necessary",
"methods",
"in",
"the",
"correct",
"order"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L22-L44 | [
"def",
"runner",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"report",
")",
":",
"self",
".",
"report_parse",
"(",
")",
"else",
":",
"logging",
".",
"info",
"(",
"'Starting {} analysis pipeline'",
".",
"format",
"("... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | GeneSippr.reporter | Runs the necessary methods to parse raw read outputs | MLSTsippr/mlst.py | def reporter(self):
"""
Runs the necessary methods to parse raw read outputs
"""
logging.info('Preparing reports')
# Populate self.plusdict in order to reuse parsing code from an assembly-based method
for sample in self.runmetadata.samples:
self.plusdict[sampl... | def reporter(self):
"""
Runs the necessary methods to parse raw read outputs
"""
logging.info('Preparing reports')
# Populate self.plusdict in order to reuse parsing code from an assembly-based method
for sample in self.runmetadata.samples:
self.plusdict[sampl... | [
"Runs",
"the",
"necessary",
"methods",
"to",
"parse",
"raw",
"read",
"outputs"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L46-L82 | [
"def",
"reporter",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Preparing reports'",
")",
"# Populate self.plusdict in order to reuse parsing code from an assembly-based method",
"for",
"sample",
"in",
"self",
".",
"runmetadata",
".",
"samples",
":",
"self",
".... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | GeneSippr.profiler | Creates a dictionary from the profile scheme(s) | MLSTsippr/mlst.py | def profiler(self):
"""Creates a dictionary from the profile scheme(s)"""
logging.info('Loading profiles')
# Initialise variables
profiledata = defaultdict(make_dict)
reverse_profiledata = dict()
profileset = set()
# Find all the unique profiles to use with a set
... | def profiler(self):
"""Creates a dictionary from the profile scheme(s)"""
logging.info('Loading profiles')
# Initialise variables
profiledata = defaultdict(make_dict)
reverse_profiledata = dict()
profileset = set()
# Find all the unique profiles to use with a set
... | [
"Creates",
"a",
"dictionary",
"from",
"the",
"profile",
"scheme",
"(",
"s",
")"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L84-L150 | [
"def",
"profiler",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Loading profiles'",
")",
"# Initialise variables",
"profiledata",
"=",
"defaultdict",
"(",
"make_dict",
")",
"reverse_profiledata",
"=",
"dict",
"(",
")",
"profileset",
"=",
"set",
"(",
"... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | GeneSippr.sequencetyper | Determines the sequence type of each strain based on comparisons to sequence type profiles | MLSTsippr/mlst.py | def sequencetyper(self):
"""Determines the sequence type of each strain based on comparisons to sequence type profiles"""
logging.info('Performing sequence typing')
for sample in self.runmetadata.samples:
if sample.general.bestassemblyfile != 'NA':
if type(sample[self... | def sequencetyper(self):
"""Determines the sequence type of each strain based on comparisons to sequence type profiles"""
logging.info('Performing sequence typing')
for sample in self.runmetadata.samples:
if sample.general.bestassemblyfile != 'NA':
if type(sample[self... | [
"Determines",
"the",
"sequence",
"type",
"of",
"each",
"strain",
"based",
"on",
"comparisons",
"to",
"sequence",
"type",
"profiles"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L152-L337 | [
"def",
"sequencetyper",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Performing sequence typing'",
")",
"for",
"sample",
"in",
"self",
".",
"runmetadata",
".",
"samples",
":",
"if",
"sample",
".",
"general",
".",
"bestassemblyfile",
"!=",
"'NA'",
":... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | GeneSippr.mlstreporter | Parse the results into a report | MLSTsippr/mlst.py | def mlstreporter(self):
""" Parse the results into a report"""
logging.info('Writing reports')
# Initialise variables
header_row = str()
combinedrow = str()
combined_header_row = str()
reportdirset = set()
mlst_dict = dict()
# Populate a set of all... | def mlstreporter(self):
""" Parse the results into a report"""
logging.info('Writing reports')
# Initialise variables
header_row = str()
combinedrow = str()
combined_header_row = str()
reportdirset = set()
mlst_dict = dict()
# Populate a set of all... | [
"Parse",
"the",
"results",
"into",
"a",
"report"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L339-L517 | [
"def",
"mlstreporter",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Writing reports'",
")",
"# Initialise variables",
"header_row",
"=",
"str",
"(",
")",
"combinedrow",
"=",
"str",
"(",
")",
"combined_header_row",
"=",
"str",
"(",
")",
"reportdirset",... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | GeneSippr.report_parse | If the pipeline has previously been run on these data, instead of reading through the results, parse the
report instead | MLSTsippr/mlst.py | def report_parse(self):
"""
If the pipeline has previously been run on these data, instead of reading through the results, parse the
report instead
"""
# Initialise lists
report_strains = list()
genus_list = list()
if self.analysistype == 'mlst':
... | def report_parse(self):
"""
If the pipeline has previously been run on these data, instead of reading through the results, parse the
report instead
"""
# Initialise lists
report_strains = list()
genus_list = list()
if self.analysistype == 'mlst':
... | [
"If",
"the",
"pipeline",
"has",
"previously",
"been",
"run",
"on",
"these",
"data",
"instead",
"of",
"reading",
"through",
"the",
"results",
"parse",
"the",
"report",
"instead"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L519-L556 | [
"def",
"report_parse",
"(",
"self",
")",
":",
"# Initialise lists",
"report_strains",
"=",
"list",
"(",
")",
"genus_list",
"=",
"list",
"(",
")",
"if",
"self",
".",
"analysistype",
"==",
"'mlst'",
":",
"for",
"sample",
"in",
"self",
".",
"runmetadata",
"."... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | guess_type | Utility function to call classes based on filename extension.
Just usefull if you are reading the file and don't know file extension.
You can pass kwargs and these args are passed to class only if they are
used in class. | pyheaderfile/helpers.py | def guess_type(filename, **kwargs):
""" Utility function to call classes based on filename extension.
Just usefull if you are reading the file and don't know file extension.
You can pass kwargs and these args are passed to class only if they are
used in class.
"""
extension = os.path.splitext(f... | def guess_type(filename, **kwargs):
""" Utility function to call classes based on filename extension.
Just usefull if you are reading the file and don't know file extension.
You can pass kwargs and these args are passed to class only if they are
used in class.
"""
extension = os.path.splitext(f... | [
"Utility",
"function",
"to",
"call",
"classes",
"based",
"on",
"filename",
"extension",
".",
"Just",
"usefull",
"if",
"you",
"are",
"reading",
"the",
"file",
"and",
"don",
"t",
"know",
"file",
"extension",
".",
"You",
"can",
"pass",
"kwargs",
"and",
"these... | kappius/pyheaderfile | python | https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/helpers.py#L10-L31 | [
"def",
"guess_type",
"(",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"extension",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"case",
"=",
"{",
"'.xls'",
":",
"Xls",
",",
"'.xlsx'",
":",
"Xlsx",
",",
"'.csv'",
... | 8d587dadae538adcec527fd8e74ad89ed5e2006a |
train | get_gene_seqs | This function takes the database path and a gene name as inputs and
returns the gene sequence contained in the file given by the gene name | pointfinder/PointFinder.py | def get_gene_seqs(database_path, gene):
"""
This function takes the database path and a gene name as inputs and
returns the gene sequence contained in the file given by the gene name
"""
gene_path = database_path + "/" + gene + ".fsa"
gene_seq = ""
# Open fasta file
with open(gene_path)... | def get_gene_seqs(database_path, gene):
"""
This function takes the database path and a gene name as inputs and
returns the gene sequence contained in the file given by the gene name
"""
gene_path = database_path + "/" + gene + ".fsa"
gene_seq = ""
# Open fasta file
with open(gene_path)... | [
"This",
"function",
"takes",
"the",
"database",
"path",
"and",
"a",
"gene",
"name",
"as",
"inputs",
"and",
"returns",
"the",
"gene",
"sequence",
"contained",
"in",
"the",
"file",
"given",
"by",
"the",
"gene",
"name"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L10-L23 | [
"def",
"get_gene_seqs",
"(",
"database_path",
",",
"gene",
")",
":",
"gene_path",
"=",
"database_path",
"+",
"\"/\"",
"+",
"gene",
"+",
"\".fsa\"",
"gene_seq",
"=",
"\"\"",
"# Open fasta file",
"with",
"open",
"(",
"gene_path",
")",
"as",
"gene_file",
":",
"... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | get_db_mutations | This function opens the file resistenss-overview.txt, and reads the
content into a dict of dicts. The dict will contain information about
all known mutations given in the database. This dict is returned. | pointfinder/PointFinder.py | def get_db_mutations(mut_db_path, gene_list, res_stop_codons):
"""
This function opens the file resistenss-overview.txt, and reads the
content into a dict of dicts. The dict will contain information about
all known mutations given in the database. This dict is returned.
"""
# Open resistens-ove... | def get_db_mutations(mut_db_path, gene_list, res_stop_codons):
"""
This function opens the file resistenss-overview.txt, and reads the
content into a dict of dicts. The dict will contain information about
all known mutations given in the database. This dict is returned.
"""
# Open resistens-ove... | [
"This",
"function",
"opens",
"the",
"file",
"resistenss",
"-",
"overview",
".",
"txt",
"and",
"reads",
"the",
"content",
"into",
"a",
"dict",
"of",
"dicts",
".",
"The",
"dict",
"will",
"contain",
"information",
"about",
"all",
"known",
"mutations",
"given",
... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L25-L128 | [
"def",
"get_db_mutations",
"(",
"mut_db_path",
",",
"gene_list",
",",
"res_stop_codons",
")",
":",
"# Open resistens-overview.txt",
"try",
":",
"drugfile",
"=",
"open",
"(",
"mut_db_path",
",",
"\"r\"",
")",
"except",
":",
"sys",
".",
"exit",
"(",
"\"Wrong path:... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | KMA | This function is called when KMA is the method of choice. The
function calls kma externally and waits for it to finish.
The kma output files with the prefixes .res and .aln are parsed
throught to obtain the required alignment informations. The subject
and query sequences as well as the start and sto... | pointfinder/PointFinder.py | def KMA(inputfile_1, gene_list, kma_db, out_path, sample_name, min_cov, mapping_path):
"""
This function is called when KMA is the method of choice. The
function calls kma externally and waits for it to finish.
The kma output files with the prefixes .res and .aln are parsed
throught to obtain the... | def KMA(inputfile_1, gene_list, kma_db, out_path, sample_name, min_cov, mapping_path):
"""
This function is called when KMA is the method of choice. The
function calls kma externally and waits for it to finish.
The kma output files with the prefixes .res and .aln are parsed
throught to obtain the... | [
"This",
"function",
"is",
"called",
"when",
"KMA",
"is",
"the",
"method",
"of",
"choice",
".",
"The",
"function",
"calls",
"kma",
"externally",
"and",
"waits",
"for",
"it",
"to",
"finish",
".",
"The",
"kma",
"output",
"files",
"with",
"the",
"prefixes",
... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L130-L250 | [
"def",
"KMA",
"(",
"inputfile_1",
",",
"gene_list",
",",
"kma_db",
",",
"out_path",
",",
"sample_name",
",",
"min_cov",
",",
"mapping_path",
")",
":",
"# Get full path to input of output files",
"inputfile_1",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"inputf... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | find_best_sequence | This function takes the list hits_found as argument. This contains all
hits found for the blast search of one gene. A hit includes the subjct
sequence, the query, and the start and stop position of the allignment
corresponding to the subject sequence. This function finds the best
hit by concatinatin... | pointfinder/PointFinder.py | def find_best_sequence(hits_found, specie_path, gene, silent_N_flag):
"""
This function takes the list hits_found as argument. This contains all
hits found for the blast search of one gene. A hit includes the subjct
sequence, the query, and the start and stop position of the allignment
correspond... | def find_best_sequence(hits_found, specie_path, gene, silent_N_flag):
"""
This function takes the list hits_found as argument. This contains all
hits found for the blast search of one gene. A hit includes the subjct
sequence, the query, and the start and stop position of the allignment
correspond... | [
"This",
"function",
"takes",
"the",
"list",
"hits_found",
"as",
"argument",
".",
"This",
"contains",
"all",
"hits",
"found",
"for",
"the",
"blast",
"search",
"of",
"one",
"gene",
".",
"A",
"hit",
"includes",
"the",
"subjct",
"sequence",
"the",
"query",
"an... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L252-L367 | [
"def",
"find_best_sequence",
"(",
"hits_found",
",",
"specie_path",
",",
"gene",
",",
"silent_N_flag",
")",
":",
"# Get information from the fisrt hit found\t",
"all_start",
"=",
"hits_found",
"[",
"0",
"]",
"[",
"0",
"]",
"current_end",
"=",
"hits_found",
"[",
"0... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | find_mismatches | This function finds mis matches between two sequeces. Depending on the
the sequence type either the function find_codon_mismatches or
find_nucleotid_mismatches are called, if the sequences contains both
a promoter and a coding region both functions are called. The function
can also call it self if al... | pointfinder/PointFinder.py | def find_mismatches(gene, sbjct_start, sbjct_seq, qry_seq, alternative_overlaps = []):
"""
This function finds mis matches between two sequeces. Depending on the
the sequence type either the function find_codon_mismatches or
find_nucleotid_mismatches are called, if the sequences contains both
a pr... | def find_mismatches(gene, sbjct_start, sbjct_seq, qry_seq, alternative_overlaps = []):
"""
This function finds mis matches between two sequeces. Depending on the
the sequence type either the function find_codon_mismatches or
find_nucleotid_mismatches are called, if the sequences contains both
a pr... | [
"This",
"function",
"finds",
"mis",
"matches",
"between",
"two",
"sequeces",
".",
"Depending",
"on",
"the",
"the",
"sequence",
"type",
"either",
"the",
"function",
"find_codon_mismatches",
"or",
"find_nucleotid_mismatches",
"are",
"called",
"if",
"the",
"sequences",... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L370-L455 | [
"def",
"find_mismatches",
"(",
"gene",
",",
"sbjct_start",
",",
"sbjct_seq",
",",
"qry_seq",
",",
"alternative_overlaps",
"=",
"[",
"]",
")",
":",
"# Initiate the mis_matches list that will store all found mis matcehs",
"mis_matches",
"=",
"[",
"]",
"# Find mis matches in... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | find_nucleotid_mismatches | This function takes two alligned sequence (subject and query), and the
position on the subject where the alignment starts. The sequences are
compared one nucleotide at a time. If mis matches are found they are
saved. If a gap is found the function find_nuc_indel is called to find
the entire indel and... | pointfinder/PointFinder.py | def find_nucleotid_mismatches(sbjct_start, sbjct_seq, qry_seq, promoter = False):
"""
This function takes two alligned sequence (subject and query), and the
position on the subject where the alignment starts. The sequences are
compared one nucleotide at a time. If mis matches are found they are
... | def find_nucleotid_mismatches(sbjct_start, sbjct_seq, qry_seq, promoter = False):
"""
This function takes two alligned sequence (subject and query), and the
position on the subject where the alignment starts. The sequences are
compared one nucleotide at a time. If mis matches are found they are
... | [
"This",
"function",
"takes",
"two",
"alligned",
"sequence",
"(",
"subject",
"and",
"query",
")",
"and",
"the",
"position",
"on",
"the",
"subject",
"where",
"the",
"alignment",
"starts",
".",
"The",
"sequences",
"are",
"compared",
"one",
"nucleotide",
"at",
"... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L458-L549 | [
"def",
"find_nucleotid_mismatches",
"(",
"sbjct_start",
",",
"sbjct_seq",
",",
"qry_seq",
",",
"promoter",
"=",
"False",
")",
":",
"# Initiate the mis_matches list that will store all found mis matcehs",
"mis_matches",
"=",
"[",
"]",
"sbjct_start",
"=",
"abs",
"(",
"sbj... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | find_nuc_indel | This function finds the entire indel missing in from a gapped sequence
compared to the indel_seqeunce. It is assumes that the sequences start
with the first position of the gap. | pointfinder/PointFinder.py | def find_nuc_indel(gapped_seq, indel_seq):
"""
This function finds the entire indel missing in from a gapped sequence
compared to the indel_seqeunce. It is assumes that the sequences start
with the first position of the gap.
"""
ref_indel = indel_seq[0]
for j in range(1,len(gapped_seq)):
... | def find_nuc_indel(gapped_seq, indel_seq):
"""
This function finds the entire indel missing in from a gapped sequence
compared to the indel_seqeunce. It is assumes that the sequences start
with the first position of the gap.
"""
ref_indel = indel_seq[0]
for j in range(1,len(gapped_seq)):
... | [
"This",
"function",
"finds",
"the",
"entire",
"indel",
"missing",
"in",
"from",
"a",
"gapped",
"sequence",
"compared",
"to",
"the",
"indel_seqeunce",
".",
"It",
"is",
"assumes",
"that",
"the",
"sequences",
"start",
"with",
"the",
"first",
"position",
"of",
"... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L552-L564 | [
"def",
"find_nuc_indel",
"(",
"gapped_seq",
",",
"indel_seq",
")",
":",
"ref_indel",
"=",
"indel_seq",
"[",
"0",
"]",
"for",
"j",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"gapped_seq",
")",
")",
":",
"if",
"gapped_seq",
"[",
"j",
"]",
"==",
"\"-\"",... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | aa | This function converts a codon to an amino acid. If the codon is not
valid an error message is given, or else, the amino acid is returned. | pointfinder/PointFinder.py | def aa(codon):
"""
This function converts a codon to an amino acid. If the codon is not
valid an error message is given, or else, the amino acid is returned.
"""
codon = codon.upper()
aa = {"ATT": "I", "ATC": "I", "ATA": "I",
"CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L... | def aa(codon):
"""
This function converts a codon to an amino acid. If the codon is not
valid an error message is given, or else, the amino acid is returned.
"""
codon = codon.upper()
aa = {"ATT": "I", "ATC": "I", "ATA": "I",
"CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L... | [
"This",
"function",
"converts",
"a",
"codon",
"to",
"an",
"amino",
"acid",
".",
"If",
"the",
"codon",
"is",
"not",
"valid",
"an",
"error",
"message",
"is",
"given",
"or",
"else",
"the",
"amino",
"acid",
"is",
"returned",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L567-L600 | [
"def",
"aa",
"(",
"codon",
")",
":",
"codon",
"=",
"codon",
".",
"upper",
"(",
")",
"aa",
"=",
"{",
"\"ATT\"",
":",
"\"I\"",
",",
"\"ATC\"",
":",
"\"I\"",
",",
"\"ATA\"",
":",
"\"I\"",
",",
"\"CTT\"",
":",
"\"L\"",
",",
"\"CTC\"",
":",
"\"L\"",
"... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | get_codon | This function takes a sequece and a codon number and returns the codon
found in the sequence at that position | pointfinder/PointFinder.py | def get_codon(seq, codon_no, start_offset):
"""
This function takes a sequece and a codon number and returns the codon
found in the sequence at that position
"""
seq = seq.replace("-","")
codon_start_pos = int(codon_no - 1)*3 - start_offset
codon = seq[codon_start_pos:codon_start_pos + 3]
... | def get_codon(seq, codon_no, start_offset):
"""
This function takes a sequece and a codon number and returns the codon
found in the sequence at that position
"""
seq = seq.replace("-","")
codon_start_pos = int(codon_no - 1)*3 - start_offset
codon = seq[codon_start_pos:codon_start_pos + 3]
... | [
"This",
"function",
"takes",
"a",
"sequece",
"and",
"a",
"codon",
"number",
"and",
"returns",
"the",
"codon",
"found",
"in",
"the",
"sequence",
"at",
"that",
"position"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L603-L611 | [
"def",
"get_codon",
"(",
"seq",
",",
"codon_no",
",",
"start_offset",
")",
":",
"seq",
"=",
"seq",
".",
"replace",
"(",
"\"-\"",
",",
"\"\"",
")",
"codon_start_pos",
"=",
"int",
"(",
"codon_no",
"-",
"1",
")",
"*",
"3",
"-",
"start_offset",
"codon",
... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | name_insertion | This function is used to name a insertion mutation based on the HGVS
recommendation. | pointfinder/PointFinder.py | def name_insertion(sbjct_seq, codon_no, sbjct_nucs, aa_alt, start_offset):
"""
This function is used to name a insertion mutation based on the HGVS
recommendation.
"""
start_codon_no = codon_no - 1
if len(sbjct_nucs) == 3:
start_codon_no = codon_no
start_codon = get_codon(sbjct_seq... | def name_insertion(sbjct_seq, codon_no, sbjct_nucs, aa_alt, start_offset):
"""
This function is used to name a insertion mutation based on the HGVS
recommendation.
"""
start_codon_no = codon_no - 1
if len(sbjct_nucs) == 3:
start_codon_no = codon_no
start_codon = get_codon(sbjct_seq... | [
"This",
"function",
"is",
"used",
"to",
"name",
"a",
"insertion",
"mutation",
"based",
"on",
"the",
"HGVS",
"recommendation",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L614-L625 | [
"def",
"name_insertion",
"(",
"sbjct_seq",
",",
"codon_no",
",",
"sbjct_nucs",
",",
"aa_alt",
",",
"start_offset",
")",
":",
"start_codon_no",
"=",
"codon_no",
"-",
"1",
"if",
"len",
"(",
"sbjct_nucs",
")",
"==",
"3",
":",
"start_codon_no",
"=",
"codon_no",
... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | name_indel_mutation | This function serves to name the individual mutations dependently on
the type of the mutation. | pointfinder/PointFinder.py | def name_indel_mutation(sbjct_seq, indel, sbjct_rf_indel, qry_rf_indel, codon_no, mut, start_offset):
"""
This function serves to name the individual mutations dependently on
the type of the mutation.
"""
# Get the subject and query sequences without gaps
sbjct_nucs = sbjct_rf_indel.replace("-"... | def name_indel_mutation(sbjct_seq, indel, sbjct_rf_indel, qry_rf_indel, codon_no, mut, start_offset):
"""
This function serves to name the individual mutations dependently on
the type of the mutation.
"""
# Get the subject and query sequences without gaps
sbjct_nucs = sbjct_rf_indel.replace("-"... | [
"This",
"function",
"serves",
"to",
"name",
"the",
"individual",
"mutations",
"dependently",
"on",
"the",
"type",
"of",
"the",
"mutation",
"."
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L643-L696 | [
"def",
"name_indel_mutation",
"(",
"sbjct_seq",
",",
"indel",
",",
"sbjct_rf_indel",
",",
"qry_rf_indel",
",",
"codon_no",
",",
"mut",
",",
"start_offset",
")",
":",
"# Get the subject and query sequences without gaps",
"sbjct_nucs",
"=",
"sbjct_rf_indel",
".",
"replace... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | get_inframe_gap | This funtion takes a sequnece starting with a gap or the complementary
seqeuence to the gap, and the number of nucleotides that the seqeunce
should contain in order to maintain the correct reading frame. The
sequence is gone through and the number of non-gap characters are
counted. When the number ha... | pointfinder/PointFinder.py | def get_inframe_gap(seq, nucs_needed = 3):
"""
This funtion takes a sequnece starting with a gap or the complementary
seqeuence to the gap, and the number of nucleotides that the seqeunce
should contain in order to maintain the correct reading frame. The
sequence is gone through and the number of ... | def get_inframe_gap(seq, nucs_needed = 3):
"""
This funtion takes a sequnece starting with a gap or the complementary
seqeuence to the gap, and the number of nucleotides that the seqeunce
should contain in order to maintain the correct reading frame. The
sequence is gone through and the number of ... | [
"This",
"funtion",
"takes",
"a",
"sequnece",
"starting",
"with",
"a",
"gap",
"or",
"the",
"complementary",
"seqeuence",
"to",
"the",
"gap",
"and",
"the",
"number",
"of",
"nucleotides",
"that",
"the",
"seqeunce",
"should",
"contain",
"in",
"order",
"to",
"mai... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L699-L730 | [
"def",
"get_inframe_gap",
"(",
"seq",
",",
"nucs_needed",
"=",
"3",
")",
":",
"nuc_count",
"=",
"0",
"gap_indel",
"=",
"\"\"",
"nucs",
"=",
"\"\"",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"seq",
")",
")",
":",
"# Check if the character is not a gap",
... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | get_indels | This function uses regex to find inserts and deletions in sequences
given as arguments. A list of these indels are returned. The list
includes, type of mutations(ins/del), subject codon no of found
mutation, subject sequence position, insert/deletions nucleotide
sequence, and the affected qry codon n... | pointfinder/PointFinder.py | def get_indels(sbjct_seq, qry_seq, start_pos):
"""
This function uses regex to find inserts and deletions in sequences
given as arguments. A list of these indels are returned. The list
includes, type of mutations(ins/del), subject codon no of found
mutation, subject sequence position, insert/delet... | def get_indels(sbjct_seq, qry_seq, start_pos):
"""
This function uses regex to find inserts and deletions in sequences
given as arguments. A list of these indels are returned. The list
includes, type of mutations(ins/del), subject codon no of found
mutation, subject sequence position, insert/delet... | [
"This",
"function",
"uses",
"regex",
"to",
"find",
"inserts",
"and",
"deletions",
"in",
"sequences",
"given",
"as",
"arguments",
".",
"A",
"list",
"of",
"these",
"indels",
"are",
"returned",
".",
"The",
"list",
"includes",
"type",
"of",
"mutations",
"(",
"... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L733-L770 | [
"def",
"get_indels",
"(",
"sbjct_seq",
",",
"qry_seq",
",",
"start_pos",
")",
":",
"seqs",
"=",
"[",
"sbjct_seq",
",",
"qry_seq",
"]",
"indels",
"=",
"[",
"]",
"gap_obj",
"=",
"re",
".",
"compile",
"(",
"r\"-+\"",
")",
"for",
"i",
"in",
"range",
"(",... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | find_codon_mismatches | This function takes two alligned sequence (subject and query), and
the position on the subject where the alignment starts. The sequences
are compared codon by codon. If a mis matches is found it is saved in
'mis_matches'. If a gap is found the function get_inframe_gap is used
to find the indel sequen... | pointfinder/PointFinder.py | def find_codon_mismatches(sbjct_start, sbjct_seq, qry_seq):
"""
This function takes two alligned sequence (subject and query), and
the position on the subject where the alignment starts. The sequences
are compared codon by codon. If a mis matches is found it is saved in
'mis_matches'. If a gap is ... | def find_codon_mismatches(sbjct_start, sbjct_seq, qry_seq):
"""
This function takes two alligned sequence (subject and query), and
the position on the subject where the alignment starts. The sequences
are compared codon by codon. If a mis matches is found it is saved in
'mis_matches'. If a gap is ... | [
"This",
"function",
"takes",
"two",
"alligned",
"sequence",
"(",
"subject",
"and",
"query",
")",
"and",
"the",
"position",
"on",
"the",
"subject",
"where",
"the",
"alignment",
"starts",
".",
"The",
"sequences",
"are",
"compared",
"codon",
"by",
"codon",
".",... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L773-L931 | [
"def",
"find_codon_mismatches",
"(",
"sbjct_start",
",",
"sbjct_seq",
",",
"qry_seq",
")",
":",
"mis_matches",
"=",
"[",
"]",
"# Find start pos of first codon in frame, i_start",
"codon_offset",
"=",
"(",
"sbjct_start",
"-",
"1",
")",
"%",
"3",
"i_start",
"=",
"0"... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | write_output | This function takes a gene name a list of mis matches found betreewn subject and query of
this gene, the dictionary of known mutation in the point finder database, and the flag telling
weather the user wants unknown mutations to be reported.
All mis matches are looked up in the known mutation dict to se if... | pointfinder/PointFinder.py | def write_output(gene, gene_name, mis_matches, known_mutations, known_stop_codon, unknown_flag, GENES):
"""
This function takes a gene name a list of mis matches found betreewn subject and query of
this gene, the dictionary of known mutation in the point finder database, and the flag telling
weather th... | def write_output(gene, gene_name, mis_matches, known_mutations, known_stop_codon, unknown_flag, GENES):
"""
This function takes a gene name a list of mis matches found betreewn subject and query of
this gene, the dictionary of known mutation in the point finder database, and the flag telling
weather th... | [
"This",
"function",
"takes",
"a",
"gene",
"name",
"a",
"list",
"of",
"mis",
"matches",
"found",
"betreewn",
"subject",
"and",
"query",
"of",
"this",
"gene",
"the",
"dictionary",
"of",
"known",
"mutation",
"in",
"the",
"point",
"finder",
"database",
"and",
... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L933-L1046 | [
"def",
"write_output",
"(",
"gene",
",",
"gene_name",
",",
"mis_matches",
",",
"known_mutations",
",",
"known_stop_codon",
",",
"unknown_flag",
",",
"GENES",
")",
":",
"RNA",
"=",
"False",
"known_header",
"=",
"\"Mutation\\tNucleotide change\\tAmino acid change\\tResist... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | ApiPool.merge | Try merging all the bravado_core models across all loaded APIs. If
duplicates occur, use the same bravado-core model to represent each, so
bravado-core won't treat them as different models when passing them
from one PyMacaron client stub to an other or when returning them via the
PyMacar... | pymacaron_core/swagger/apipool.py | def merge(self):
"""Try merging all the bravado_core models across all loaded APIs. If
duplicates occur, use the same bravado-core model to represent each, so
bravado-core won't treat them as different models when passing them
from one PyMacaron client stub to an other or when returning ... | def merge(self):
"""Try merging all the bravado_core models across all loaded APIs. If
duplicates occur, use the same bravado-core model to represent each, so
bravado-core won't treat them as different models when passing them
from one PyMacaron client stub to an other or when returning ... | [
"Try",
"merging",
"all",
"the",
"bravado_core",
"models",
"across",
"all",
"loaded",
"APIs",
".",
"If",
"duplicates",
"occur",
"use",
"the",
"same",
"bravado",
"-",
"core",
"model",
"to",
"represent",
"each",
"so",
"bravado",
"-",
"core",
"won",
"t",
"trea... | pymacaron/pymacaron-core | python | https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/apipool.py#L65-L102 | [
"def",
"merge",
"(",
"self",
")",
":",
"# The sole purpose of this method is to trick isinstance to return true",
"# on model_values of the same kind but different apis/specs at:",
"# https://github.com/Yelp/bravado-core/blob/4840a6e374611bb917226157b5948ee263913abc/bravado_core/marshal.py#L160",
... | 95070a39ed7065a84244ff5601fea4d54cc72b66 |
train | ApiPool._cmp_models | Compare two models from different swagger APIs and tell if they are
equal (return 0), or not (return != 0) | pymacaron_core/swagger/apipool.py | def _cmp_models(self, m1, m2):
"""Compare two models from different swagger APIs and tell if they are
equal (return 0), or not (return != 0)"""
# Don't alter m1/m2 by mistake
m1 = copy.deepcopy(m1)
m2 = copy.deepcopy(m2)
# Remove keys added by bravado-core
def _... | def _cmp_models(self, m1, m2):
"""Compare two models from different swagger APIs and tell if they are
equal (return 0), or not (return != 0)"""
# Don't alter m1/m2 by mistake
m1 = copy.deepcopy(m1)
m2 = copy.deepcopy(m2)
# Remove keys added by bravado-core
def _... | [
"Compare",
"two",
"models",
"from",
"different",
"swagger",
"APIs",
"and",
"tell",
"if",
"they",
"are",
"equal",
"(",
"return",
"0",
")",
"or",
"not",
"(",
"return",
"!",
"=",
"0",
")"
] | pymacaron/pymacaron-core | python | https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/apipool.py#L105-L128 | [
"def",
"_cmp_models",
"(",
"self",
",",
"m1",
",",
"m2",
")",
":",
"# Don't alter m1/m2 by mistake",
"m1",
"=",
"copy",
".",
"deepcopy",
"(",
"m1",
")",
"m2",
"=",
"copy",
".",
"deepcopy",
"(",
"m2",
")",
"# Remove keys added by bravado-core",
"def",
"_clean... | 95070a39ed7065a84244ff5601fea4d54cc72b66 |
train | BaseTaskType.sync | Sync this model with latest data on the saltant server.
Note that in addition to returning the updated object, it also
updates the existing object.
Returns:
:class:`saltant.models.base_task_type.BaseTaskType`:
This task type instance after syncing. | saltant/models/base_task_type.py | def sync(self):
"""Sync this model with latest data on the saltant server.
Note that in addition to returning the updated object, it also
updates the existing object.
Returns:
:class:`saltant.models.base_task_type.BaseTaskType`:
This task type instance after... | def sync(self):
"""Sync this model with latest data on the saltant server.
Note that in addition to returning the updated object, it also
updates the existing object.
Returns:
:class:`saltant.models.base_task_type.BaseTaskType`:
This task type instance after... | [
"Sync",
"this",
"model",
"with",
"latest",
"data",
"on",
"the",
"saltant",
"server",
"."
] | saltant-org/saltant-py | python | https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L82-L94 | [
"def",
"sync",
"(",
"self",
")",
":",
"self",
"=",
"self",
".",
"manager",
".",
"get",
"(",
"id",
"=",
"self",
".",
"id",
")",
"return",
"self"
] | bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be |
train | BaseTaskTypeManager.create | Create a 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
variab... | saltant/models/base_task_type.py | def create(
self,
name,
command_to_run,
description="",
environment_variables=None,
required_arguments=None,
required_arguments_default_values=None,
extra_data_to_post=None,
):
"""Create a task type.
Args:
name (str): The n... | def create(
self,
name,
command_to_run,
description="",
environment_variables=None,
required_arguments=None,
required_arguments_default_values=None,
extra_data_to_post=None,
):
"""Create a task type.
Args:
name (str): The n... | [
"Create",
"a",
"task",
"type",
"."
] | saltant-org/saltant-py | python | https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L160-L229 | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"command_to_run",
",",
"description",
"=",
"\"\"",
",",
"environment_variables",
"=",
"None",
",",
"required_arguments",
"=",
"None",
",",
"required_arguments_default_values",
"=",
"None",
",",
"extra_data_to_post",
... | bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be |
train | BaseTaskTypeManager.put | 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... | saltant/models/base_task_type.py | def put(
self,
id,
name,
description,
command_to_run,
environment_variables,
required_arguments,
required_arguments_default_values,
extra_data_to_put=None,
):
"""Updates a task type on the saltant server.
Args:
id (... | def put(
self,
id,
name,
description,
command_to_run,
environment_variables,
required_arguments,
required_arguments_default_values,
extra_data_to_put=None,
):
"""Updates a task type on the saltant server.
Args:
id (... | [
"Updates",
"a",
"task",
"type",
"on",
"the",
"saltant",
"server",
"."
] | saltant-org/saltant-py | python | https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L231-L292 | [
"def",
"put",
"(",
"self",
",",
"id",
",",
"name",
",",
"description",
",",
"command_to_run",
",",
"environment_variables",
",",
"required_arguments",
",",
"required_arguments_default_values",
",",
"extra_data_to_put",
"=",
"None",
",",
")",
":",
"# Update the objec... | bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be |
train | BaseTaskTypeManager.response_data_to_model_instance | Convert response data to a task type model.
Args:
response_data (dict): The data from the request's response.
Returns:
:class:`saltant.models.base_task_type.BaseTaskType`:
A model instance representing the task type from the
reponse data. | saltant/models/base_task_type.py | def response_data_to_model_instance(self, response_data):
"""Convert response data to a task type model.
Args:
response_data (dict): The data from the request's response.
Returns:
:class:`saltant.models.base_task_type.BaseTaskType`:
A model instance repr... | def response_data_to_model_instance(self, response_data):
"""Convert response data to a task type model.
Args:
response_data (dict): The data from the request's response.
Returns:
:class:`saltant.models.base_task_type.BaseTaskType`:
A model instance repr... | [
"Convert",
"response",
"data",
"to",
"a",
"task",
"type",
"model",
"."
] | saltant-org/saltant-py | python | https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L294-L313 | [
"def",
"response_data_to_model_instance",
"(",
"self",
",",
"response_data",
")",
":",
"# Coerce datetime strings into datetime objects",
"response_data",
"[",
"\"datetime_created\"",
"]",
"=",
"dateutil",
".",
"parser",
".",
"parse",
"(",
"response_data",
"[",
"\"datetim... | bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be |
train | regression | Run regression testing - lint and then run all tests. | hitch/key.py | def regression():
"""
Run regression testing - lint and then run all tests.
"""
# HACK: Start using hitchbuildpy to get around this.
Command("touch", DIR.project.joinpath("pathquery", "__init__.py").abspath()).run()
storybook = _storybook({}).only_uninherited()
#storybook.with_params(**{"pyt... | def regression():
"""
Run regression testing - lint and then run all tests.
"""
# HACK: Start using hitchbuildpy to get around this.
Command("touch", DIR.project.joinpath("pathquery", "__init__.py").abspath()).run()
storybook = _storybook({}).only_uninherited()
#storybook.with_params(**{"pyt... | [
"Run",
"regression",
"testing",
"-",
"lint",
"and",
"then",
"run",
"all",
"tests",
"."
] | crdoconnor/pathquery | python | https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L291-L302 | [
"def",
"regression",
"(",
")",
":",
"# HACK: Start using hitchbuildpy to get around this.",
"Command",
"(",
"\"touch\"",
",",
"DIR",
".",
"project",
".",
"joinpath",
"(",
"\"pathquery\"",
",",
"\"__init__.py\"",
")",
".",
"abspath",
"(",
")",
")",
".",
"run",
"(... | 4905fef27fc666ea4511eb0eee5098f754bb52ed |
train | deploy | Deploy to pypi as specified version. | hitch/key.py | def deploy(version):
"""
Deploy to pypi as specified version.
"""
NAME = "pathquery"
git = Command("git").in_dir(DIR.project)
version_file = DIR.project.joinpath("VERSION")
old_version = version_file.bytes().decode('utf8')
if version_file.bytes().decode("utf8") != version:
DIR.pr... | def deploy(version):
"""
Deploy to pypi as specified version.
"""
NAME = "pathquery"
git = Command("git").in_dir(DIR.project)
version_file = DIR.project.joinpath("VERSION")
old_version = version_file.bytes().decode('utf8')
if version_file.bytes().decode("utf8") != version:
DIR.pr... | [
"Deploy",
"to",
"pypi",
"as",
"specified",
"version",
"."
] | crdoconnor/pathquery | python | https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L308-L341 | [
"def",
"deploy",
"(",
"version",
")",
":",
"NAME",
"=",
"\"pathquery\"",
"git",
"=",
"Command",
"(",
"\"git\"",
")",
".",
"in_dir",
"(",
"DIR",
".",
"project",
")",
"version_file",
"=",
"DIR",
".",
"project",
".",
"joinpath",
"(",
"\"VERSION\"",
")",
"... | 4905fef27fc666ea4511eb0eee5098f754bb52ed |
train | hvenvup | Install a new version of a package in the hitch venv. | hitch/key.py | def hvenvup(package, directory):
"""
Install a new version of a package in the hitch venv.
"""
pip = Command(DIR.gen.joinpath("hvenv", "bin", "pip"))
pip("uninstall", package, "-y").run()
pip("install", DIR.project.joinpath(directory).abspath()).run() | def hvenvup(package, directory):
"""
Install a new version of a package in the hitch venv.
"""
pip = Command(DIR.gen.joinpath("hvenv", "bin", "pip"))
pip("uninstall", package, "-y").run()
pip("install", DIR.project.joinpath(directory).abspath()).run() | [
"Install",
"a",
"new",
"version",
"of",
"a",
"package",
"in",
"the",
"hitch",
"venv",
"."
] | crdoconnor/pathquery | python | https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L352-L358 | [
"def",
"hvenvup",
"(",
"package",
",",
"directory",
")",
":",
"pip",
"=",
"Command",
"(",
"DIR",
".",
"gen",
".",
"joinpath",
"(",
"\"hvenv\"",
",",
"\"bin\"",
",",
"\"pip\"",
")",
")",
"pip",
"(",
"\"uninstall\"",
",",
"package",
",",
"\"-y\"",
")",
... | 4905fef27fc666ea4511eb0eee5098f754bb52ed |
train | Engine.set_up | Set up your applications and the test environment. | hitch/key.py | def set_up(self):
"""Set up your applications and the test environment."""
self.path.state = self.path.gen.joinpath("state")
if self.path.state.exists():
self.path.state.rmtree(ignore_errors=True)
self.path.state.mkdir()
if self.path.gen.joinpath("q").exists():
... | def set_up(self):
"""Set up your applications and the test environment."""
self.path.state = self.path.gen.joinpath("state")
if self.path.state.exists():
self.path.state.rmtree(ignore_errors=True)
self.path.state.mkdir()
if self.path.gen.joinpath("q").exists():
... | [
"Set",
"up",
"your",
"applications",
"and",
"the",
"test",
"environment",
"."
] | crdoconnor/pathquery | python | https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L38-L86 | [
"def",
"set_up",
"(",
"self",
")",
":",
"self",
".",
"path",
".",
"state",
"=",
"self",
".",
"path",
".",
"gen",
".",
"joinpath",
"(",
"\"state\"",
")",
"if",
"self",
".",
"path",
".",
"state",
".",
"exists",
"(",
")",
":",
"self",
".",
"path",
... | 4905fef27fc666ea4511eb0eee5098f754bb52ed |
train | Parser.is_valid | Validates single instance. Returns boolean value and store errors in self.errors | csvparser/parser.py | def is_valid(self):
"""
Validates single instance. Returns boolean value and store errors in self.errors
"""
self.errors = []
for field in self.get_all_field_names_declared_by_user():
getattr(type(self), field).is_valid(self, type(self), field)
field_erro... | def is_valid(self):
"""
Validates single instance. Returns boolean value and store errors in self.errors
"""
self.errors = []
for field in self.get_all_field_names_declared_by_user():
getattr(type(self), field).is_valid(self, type(self), field)
field_erro... | [
"Validates",
"single",
"instance",
".",
"Returns",
"boolean",
"value",
"and",
"store",
"errors",
"in",
"self",
".",
"errors"
] | beczkowb/csvparser | python | https://github.com/beczkowb/csvparser/blob/f9f9bd37e10e3c1c223d559194367b25900a822a/csvparser/parser.py#L41-L52 | [
"def",
"is_valid",
"(",
"self",
")",
":",
"self",
".",
"errors",
"=",
"[",
"]",
"for",
"field",
"in",
"self",
".",
"get_all_field_names_declared_by_user",
"(",
")",
":",
"getattr",
"(",
"type",
"(",
"self",
")",
",",
"field",
")",
".",
"is_valid",
"(",... | f9f9bd37e10e3c1c223d559194367b25900a822a |
train | Method.main | Run the analyses using the inputted values for forward and reverse read length. However, if not all strains
pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either
all strains are complete, or the sequencing run is finished | method.py | def main(self):
"""
Run the analyses using the inputted values for forward and reverse read length. However, if not all strains
pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either
all strains are complete, or the sequencing run ... | def main(self):
"""
Run the analyses using the inputted values for forward and reverse read length. However, if not all strains
pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either
all strains are complete, or the sequencing run ... | [
"Run",
"the",
"analyses",
"using",
"the",
"inputted",
"values",
"for",
"forward",
"and",
"reverse",
"read",
"length",
".",
"However",
"if",
"not",
"all",
"strains",
"pass",
"the",
"quality",
"thresholds",
"continue",
"to",
"periodically",
"run",
"the",
"analys... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L25-L44 | [
"def",
"main",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Starting {} analysis pipeline'",
".",
"format",
"(",
"self",
".",
"analysistype",
")",
")",
"self",
".",
"createobjects",
"(",
")",
"# Run the genesipping analyses",
"self",
".",
"methods",
"... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Method.methods | Run the typing methods | method.py | def methods(self):
"""
Run the typing methods
"""
self.contamination_detection()
ReportImage(self, 'confindr')
self.run_genesippr()
ReportImage(self, 'genesippr')
self.run_sixteens()
self.run_mash()
self.run_gdcs()
ReportImage(self,... | def methods(self):
"""
Run the typing methods
"""
self.contamination_detection()
ReportImage(self, 'confindr')
self.run_genesippr()
ReportImage(self, 'genesippr')
self.run_sixteens()
self.run_mash()
self.run_gdcs()
ReportImage(self,... | [
"Run",
"the",
"typing",
"methods"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L169-L180 | [
"def",
"methods",
"(",
"self",
")",
":",
"self",
".",
"contamination_detection",
"(",
")",
"ReportImage",
"(",
"self",
",",
"'confindr'",
")",
"self",
".",
"run_genesippr",
"(",
")",
"ReportImage",
"(",
"self",
",",
"'genesippr'",
")",
"self",
".",
"run_si... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Method.contamination_detection | Calculate the levels of contamination in the reads | method.py | def contamination_detection(self):
"""
Calculate the levels of contamination in the reads
"""
self.qualityobject = quality.Quality(self)
self.qualityobject.contamination_finder(input_path=self.sequencepath,
report_path=self.reportpa... | def contamination_detection(self):
"""
Calculate the levels of contamination in the reads
"""
self.qualityobject = quality.Quality(self)
self.qualityobject.contamination_finder(input_path=self.sequencepath,
report_path=self.reportpa... | [
"Calculate",
"the",
"levels",
"of",
"contamination",
"in",
"the",
"reads"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L182-L188 | [
"def",
"contamination_detection",
"(",
"self",
")",
":",
"self",
".",
"qualityobject",
"=",
"quality",
".",
"Quality",
"(",
"self",
")",
"self",
".",
"qualityobject",
".",
"contamination_finder",
"(",
"input_path",
"=",
"self",
".",
"sequencepath",
",",
"repor... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Method.run_genesippr | Run the genesippr analyses | method.py | def run_genesippr(self):
"""
Run the genesippr analyses
"""
GeneSippr(args=self,
pipelinecommit=self.commit,
startingtime=self.starttime,
scriptpath=self.homepath,
analysistype='genesippr',
cutoff=0... | def run_genesippr(self):
"""
Run the genesippr analyses
"""
GeneSippr(args=self,
pipelinecommit=self.commit,
startingtime=self.starttime,
scriptpath=self.homepath,
analysistype='genesippr',
cutoff=0... | [
"Run",
"the",
"genesippr",
"analyses"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L190-L201 | [
"def",
"run_genesippr",
"(",
"self",
")",
":",
"GeneSippr",
"(",
"args",
"=",
"self",
",",
"pipelinecommit",
"=",
"self",
".",
"commit",
",",
"startingtime",
"=",
"self",
".",
"starttime",
",",
"scriptpath",
"=",
"self",
".",
"homepath",
",",
"analysistype... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Method.run_sixteens | Run the 16S analyses using the filtered database | method.py | def run_sixteens(self):
"""
Run the 16S analyses using the filtered database
"""
SixteensFull(args=self,
pipelinecommit=self.commit,
startingtime=self.starttime,
scriptpath=self.homepath,
analysistype='si... | def run_sixteens(self):
"""
Run the 16S analyses using the filtered database
"""
SixteensFull(args=self,
pipelinecommit=self.commit,
startingtime=self.starttime,
scriptpath=self.homepath,
analysistype='si... | [
"Run",
"the",
"16S",
"analyses",
"using",
"the",
"filtered",
"database"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L203-L212 | [
"def",
"run_sixteens",
"(",
"self",
")",
":",
"SixteensFull",
"(",
"args",
"=",
"self",
",",
"pipelinecommit",
"=",
"self",
".",
"commit",
",",
"startingtime",
"=",
"self",
".",
"starttime",
",",
"scriptpath",
"=",
"self",
".",
"homepath",
",",
"analysisty... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Method.run_mash | Run MASH to determine the closest refseq genomes | method.py | def run_mash(self):
"""
Run MASH to determine the closest refseq genomes
"""
self.pipeline = True
mash.Mash(inputobject=self,
analysistype='mash') | def run_mash(self):
"""
Run MASH to determine the closest refseq genomes
"""
self.pipeline = True
mash.Mash(inputobject=self,
analysistype='mash') | [
"Run",
"MASH",
"to",
"determine",
"the",
"closest",
"refseq",
"genomes"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L214-L220 | [
"def",
"run_mash",
"(",
"self",
")",
":",
"self",
".",
"pipeline",
"=",
"True",
"mash",
".",
"Mash",
"(",
"inputobject",
"=",
"self",
",",
"analysistype",
"=",
"'mash'",
")"
] | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Method.complete | Determine if the analyses of the strains are complete e.g. there are no missing GDCS genes, and the
sample.general.bestassemblyfile != 'NA' | method.py | def complete(self):
"""
Determine if the analyses of the strains are complete e.g. there are no missing GDCS genes, and the
sample.general.bestassemblyfile != 'NA'
"""
# Boolean to store the completeness of the analyses
allcomplete = True
# Clear the list of samp... | def complete(self):
"""
Determine if the analyses of the strains are complete e.g. there are no missing GDCS genes, and the
sample.general.bestassemblyfile != 'NA'
"""
# Boolean to store the completeness of the analyses
allcomplete = True
# Clear the list of samp... | [
"Determine",
"if",
"the",
"analyses",
"of",
"the",
"strains",
"are",
"complete",
"e",
".",
"g",
".",
"there",
"are",
"no",
"missing",
"GDCS",
"genes",
"and",
"the",
"sample",
".",
"general",
".",
"bestassemblyfile",
"!",
"=",
"NA"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L228-L261 | [
"def",
"complete",
"(",
"self",
")",
":",
"# Boolean to store the completeness of the analyses",
"allcomplete",
"=",
"True",
"# Clear the list of samples that still require more sequence data",
"self",
".",
"incomplete",
"=",
"list",
"(",
")",
"for",
"sample",
"in",
"self",... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | protected_operation | Use this decorator to prevent an operation from being executed
when the related uri resource is still in use.
The parent_object must contain:
* a request
* with a registry.queryUtility(IReferencer)
:raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to
delete ... | pyramid_urireferencer/protected_resources.py | def protected_operation(fn):
"""
Use this decorator to prevent an operation from being executed
when the related uri resource is still in use.
The parent_object must contain:
* a request
* with a registry.queryUtility(IReferencer)
:raises pyramid.httpexceptions.HTTPConflict: Sign... | def protected_operation(fn):
"""
Use this decorator to prevent an operation from being executed
when the related uri resource is still in use.
The parent_object must contain:
* a request
* with a registry.queryUtility(IReferencer)
:raises pyramid.httpexceptions.HTTPConflict: Sign... | [
"Use",
"this",
"decorator",
"to",
"prevent",
"an",
"operation",
"from",
"being",
"executed",
"when",
"the",
"related",
"uri",
"resource",
"is",
"still",
"in",
"use",
".",
"The",
"parent_object",
"must",
"contain",
":",
"*",
"a",
"request",
"*",
"with",
"a"... | OnroerendErfgoed/pyramid_urireferencer | python | https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/protected_resources.py#L83-L103 | [
"def",
"protected_operation",
"(",
"fn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"advice",
"(",
"parent_object",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"response",
"=",
"_advice",
"(",
"parent_object",
".",
"request",... | c6ee4ba863e32ced304b9cf00f3f5b450757a29a |
train | protected_operation_with_request | Use this decorator to prevent an operation from being executed
when the related uri resource is still in use.
The request must contain a registry.queryUtility(IReferencer)
:raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to
delete a certain URI because it's still in use somewh... | pyramid_urireferencer/protected_resources.py | def protected_operation_with_request(fn):
"""
Use this decorator to prevent an operation from being executed
when the related uri resource is still in use.
The request must contain a registry.queryUtility(IReferencer)
:raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to
... | def protected_operation_with_request(fn):
"""
Use this decorator to prevent an operation from being executed
when the related uri resource is still in use.
The request must contain a registry.queryUtility(IReferencer)
:raises pyramid.httpexceptions.HTTPConflict: Signals that we don't want to
... | [
"Use",
"this",
"decorator",
"to",
"prevent",
"an",
"operation",
"from",
"being",
"executed",
"when",
"the",
"related",
"uri",
"resource",
"is",
"still",
"in",
"use",
".",
"The",
"request",
"must",
"contain",
"a",
"registry",
".",
"queryUtility",
"(",
"IRefer... | OnroerendErfgoed/pyramid_urireferencer | python | https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/protected_resources.py#L106-L125 | [
"def",
"protected_operation_with_request",
"(",
"fn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"wrapped",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"_advice",
"(",
"request",
")",
"if"... | c6ee4ba863e32ced304b9cf00f3f5b450757a29a |
train | protected_view | allows adding `protected=True` to a view_config` | pyramid_urireferencer/protected_resources.py | def protected_view(view, info):
"""allows adding `protected=True` to a view_config`"""
if info.options.get('protected'):
def wrapper_view(context, request):
response = _advice(request)
if response is not None:
return response
else:
ret... | def protected_view(view, info):
"""allows adding `protected=True` to a view_config`"""
if info.options.get('protected'):
def wrapper_view(context, request):
response = _advice(request)
if response is not None:
return response
else:
ret... | [
"allows",
"adding",
"protected",
"=",
"True",
"to",
"a",
"view_config"
] | OnroerendErfgoed/pyramid_urireferencer | python | https://github.com/OnroerendErfgoed/pyramid_urireferencer/blob/c6ee4ba863e32ced304b9cf00f3f5b450757a29a/pyramid_urireferencer/protected_resources.py#L128-L139 | [
"def",
"protected_view",
"(",
"view",
",",
"info",
")",
":",
"if",
"info",
".",
"options",
".",
"get",
"(",
"'protected'",
")",
":",
"def",
"wrapper_view",
"(",
"context",
",",
"request",
")",
":",
"response",
"=",
"_advice",
"(",
"request",
")",
"if",... | c6ee4ba863e32ced304b9cf00f3f5b450757a29a |
train | syncdb | Create tables if they don't exist | flask_philo_sqlalchemy/__init__.py | def syncdb(pool=None):
"""
Create tables if they don't exist
"""
from flask_philo_sqlalchemy.schema import Base # noqa
from flask_philo_sqlalchemy.orm import BaseModel # noqa
from flask_philo_sqlalchemy.connection import create_pool
if pool is None:
pool = create_pool()
for c... | def syncdb(pool=None):
"""
Create tables if they don't exist
"""
from flask_philo_sqlalchemy.schema import Base # noqa
from flask_philo_sqlalchemy.orm import BaseModel # noqa
from flask_philo_sqlalchemy.connection import create_pool
if pool is None:
pool = create_pool()
for c... | [
"Create",
"tables",
"if",
"they",
"don",
"t",
"exist"
] | Riffstation/Flask-Philo-SQLAlchemy | python | https://github.com/Riffstation/Flask-Philo-SQLAlchemy/blob/71598bb603b8458a2cf9f7989f71d8f1c77fafb9/flask_philo_sqlalchemy/__init__.py#L4-L16 | [
"def",
"syncdb",
"(",
"pool",
"=",
"None",
")",
":",
"from",
"flask_philo_sqlalchemy",
".",
"schema",
"import",
"Base",
"# noqa",
"from",
"flask_philo_sqlalchemy",
".",
"orm",
"import",
"BaseModel",
"# noqa",
"from",
"flask_philo_sqlalchemy",
".",
"connection",
"i... | 71598bb603b8458a2cf9f7989f71d8f1c77fafb9 |
train | checkInstalledPip | checks if a given package is installed on pip | hallie/modules/install.py | def checkInstalledPip(package, speak=True, speakSimilar=True):
"""checks if a given package is installed on pip"""
packages = sorted([i.key for i in pip.get_installed_distributions()])
installed = package in packages
similar = None
if not installed:
similar = [pkg for pkg in packages if pac... | def checkInstalledPip(package, speak=True, speakSimilar=True):
"""checks if a given package is installed on pip"""
packages = sorted([i.key for i in pip.get_installed_distributions()])
installed = package in packages
similar = None
if not installed:
similar = [pkg for pkg in packages if pac... | [
"checks",
"if",
"a",
"given",
"package",
"is",
"installed",
"on",
"pip"
] | mikemelch/hallie | python | https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/install.py#L25-L37 | [
"def",
"checkInstalledPip",
"(",
"package",
",",
"speak",
"=",
"True",
",",
"speakSimilar",
"=",
"True",
")",
":",
"packages",
"=",
"sorted",
"(",
"[",
"i",
".",
"key",
"for",
"i",
"in",
"pip",
".",
"get_installed_distributions",
"(",
")",
"]",
")",
"i... | a6dbb691145a85b776a1919e4c7930e0ae598437 |
train | checkInstalledBrew | checks if a given package is installed on homebrew | hallie/modules/install.py | def checkInstalledBrew(package, similar=True, speak=True, speakSimilar=True):
"""checks if a given package is installed on homebrew"""
packages = subprocess.check_output(['brew', 'list']).split()
installed = package in packages
similar = []
if not installed:
similar = [pkg for pkg in packag... | def checkInstalledBrew(package, similar=True, speak=True, speakSimilar=True):
"""checks if a given package is installed on homebrew"""
packages = subprocess.check_output(['brew', 'list']).split()
installed = package in packages
similar = []
if not installed:
similar = [pkg for pkg in packag... | [
"checks",
"if",
"a",
"given",
"package",
"is",
"installed",
"on",
"homebrew"
] | mikemelch/hallie | python | https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/install.py#L40-L51 | [
"def",
"checkInstalledBrew",
"(",
"package",
",",
"similar",
"=",
"True",
",",
"speak",
"=",
"True",
",",
"speakSimilar",
"=",
"True",
")",
":",
"packages",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'brew'",
",",
"'list'",
"]",
")",
".",
"split"... | a6dbb691145a85b776a1919e4c7930e0ae598437 |
train | init_module | Connnexion informations : remote_credences for remote acces OR local_path for local access | pyDLib/Core/sql.py | def init_module(remote_credences=None,local_path=None):
"""Connnexion informations : remote_credences for remote acces OR local_path for local access"""
if remote_credences is not None:
RemoteConnexion.HOST = remote_credences["DB"]["host"]
RemoteConnexion.USER = remote_credences["DB"]["user"]
... | def init_module(remote_credences=None,local_path=None):
"""Connnexion informations : remote_credences for remote acces OR local_path for local access"""
if remote_credences is not None:
RemoteConnexion.HOST = remote_credences["DB"]["host"]
RemoteConnexion.USER = remote_credences["DB"]["user"]
... | [
"Connnexion",
"informations",
":",
"remote_credences",
"for",
"remote",
"acces",
"OR",
"local_path",
"for",
"local",
"access"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L23-L40 | [
"def",
"init_module",
"(",
"remote_credences",
"=",
"None",
",",
"local_path",
"=",
"None",
")",
":",
"if",
"remote_credences",
"is",
"not",
"None",
":",
"RemoteConnexion",
".",
"HOST",
"=",
"remote_credences",
"[",
"\"DB\"",
"]",
"[",
"\"host\"",
"]",
"Remo... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | cree_local_DB | Create emmpt DB according to the given scheme : dict { table : [ (column_name, column_type), .. ]}
Usefull at installation of application (and for developement) | pyDLib/Core/sql.py | def cree_local_DB(scheme):
"""Create emmpt DB according to the given scheme : dict { table : [ (column_name, column_type), .. ]}
Usefull at installation of application (and for developement)
"""
conn = LocalConnexion()
req = ""
for table, fields in scheme.items():
req += f"DROP TABLE IF ... | def cree_local_DB(scheme):
"""Create emmpt DB according to the given scheme : dict { table : [ (column_name, column_type), .. ]}
Usefull at installation of application (and for developement)
"""
conn = LocalConnexion()
req = ""
for table, fields in scheme.items():
req += f"DROP TABLE IF ... | [
"Create",
"emmpt",
"DB",
"according",
"to",
"the",
"given",
"scheme",
":",
"dict",
"{",
"table",
":",
"[",
"(",
"column_name",
"column_type",
")",
"..",
"]",
"}",
"Usefull",
"at",
"installation",
"of",
"application",
"(",
"and",
"for",
"developement",
")"
... | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L209-L223 | [
"def",
"cree_local_DB",
"(",
"scheme",
")",
":",
"conn",
"=",
"LocalConnexion",
"(",
")",
"req",
"=",
"\"\"",
"for",
"table",
",",
"fields",
"in",
"scheme",
".",
"items",
"(",
")",
":",
"req",
"+=",
"f\"DROP TABLE IF EXISTS {table};\"",
"req_fields",
"=",
... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractConnexion.execute | Execute one or many requests
requete_SQL may be a tuple(requete,args) or a list of such tuples
Return the result or a list of results | pyDLib/Core/sql.py | def execute(self, requete_SQL):
"""Execute one or many requests
requete_SQL may be a tuple(requete,args) or a list of such tuples
Return the result or a list of results
"""
try:
cursor = self.cursor()
if isinstance(requete_SQL,tuple):
res =... | def execute(self, requete_SQL):
"""Execute one or many requests
requete_SQL may be a tuple(requete,args) or a list of such tuples
Return the result or a list of results
"""
try:
cursor = self.cursor()
if isinstance(requete_SQL,tuple):
res =... | [
"Execute",
"one",
"or",
"many",
"requests",
"requete_SQL",
"may",
"be",
"a",
"tuple",
"(",
"requete",
"args",
")",
"or",
"a",
"list",
"of",
"such",
"tuples",
"Return",
"the",
"result",
"or",
"a",
"list",
"of",
"results"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L117-L138 | [
"def",
"execute",
"(",
"self",
",",
"requete_SQL",
")",
":",
"try",
":",
"cursor",
"=",
"self",
".",
"cursor",
"(",
")",
"if",
"isinstance",
"(",
"requete_SQL",
",",
"tuple",
")",
":",
"res",
"=",
"self",
".",
"_execute_one",
"(",
"cursor",
",",
"*",... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractRequetesSQL.placeholders | Placeholders for fields names and value binds | pyDLib/Core/sql.py | def placeholders(cls,dic):
"""Placeholders for fields names and value binds"""
keys = [str(x) for x in dic]
entete = ",".join(keys)
placeholders = ",".join(cls.named_style.format(x) for x in keys)
entete = f"({entete})"
placeholders = f"({placeholders})"
return en... | def placeholders(cls,dic):
"""Placeholders for fields names and value binds"""
keys = [str(x) for x in dic]
entete = ",".join(keys)
placeholders = ",".join(cls.named_style.format(x) for x in keys)
entete = f"({entete})"
placeholders = f"({placeholders})"
return en... | [
"Placeholders",
"for",
"fields",
"names",
"and",
"value",
"binds"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L244-L251 | [
"def",
"placeholders",
"(",
"cls",
",",
"dic",
")",
":",
"keys",
"=",
"[",
"str",
"(",
"x",
")",
"for",
"x",
"in",
"dic",
"]",
"entete",
"=",
"\",\"",
".",
"join",
"(",
"keys",
")",
"placeholders",
"=",
"\",\"",
".",
"join",
"(",
"cls",
".",
"n... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractRequetesSQL.jsonise | Renvoie un dictionnaire dont les champs dont compatibles avec SQL
Utilise Json. Attention à None : il faut laisser None et non pas null | pyDLib/Core/sql.py | def jsonise(dic):
"""Renvoie un dictionnaire dont les champs dont compatibles avec SQL
Utilise Json. Attention à None : il faut laisser None et non pas null"""
d = {}
for k, v in dic.items():
if type(v) in abstractRequetesSQL.TYPES_PERMIS:
d[k] = v
... | def jsonise(dic):
"""Renvoie un dictionnaire dont les champs dont compatibles avec SQL
Utilise Json. Attention à None : il faut laisser None et non pas null"""
d = {}
for k, v in dic.items():
if type(v) in abstractRequetesSQL.TYPES_PERMIS:
d[k] = v
... | [
"Renvoie",
"un",
"dictionnaire",
"dont",
"les",
"champs",
"dont",
"compatibles",
"avec",
"SQL",
"Utilise",
"Json",
".",
"Attention",
"à",
"None",
":",
"il",
"faut",
"laisser",
"None",
"et",
"non",
"pas",
"null"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L259-L272 | [
"def",
"jsonise",
"(",
"dic",
")",
":",
"d",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"dic",
".",
"items",
"(",
")",
":",
"if",
"type",
"(",
"v",
")",
"in",
"abstractRequetesSQL",
".",
"TYPES_PERMIS",
":",
"d",
"[",
"k",
"]",
"=",
"v",
"els... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractRequetesSQL.insert | Insert row from datas
:param table: Safe table name
:param datas: List of dicts.
:param avoid_conflict: Allows ignoring error if already exists (do nothing then)
:return: | pyDLib/Core/sql.py | def insert(table, datas, avoid_conflict=False):
""" Insert row from datas
:param table: Safe table name
:param datas: List of dicts.
:param avoid_conflict: Allows ignoring error if already exists (do nothing then)
:return:
"""
if avoid_conflict:
debut... | def insert(table, datas, avoid_conflict=False):
""" Insert row from datas
:param table: Safe table name
:param datas: List of dicts.
:param avoid_conflict: Allows ignoring error if already exists (do nothing then)
:return:
"""
if avoid_conflict:
debut... | [
"Insert",
"row",
"from",
"datas"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L287-L300 | [
"def",
"insert",
"(",
"table",
",",
"datas",
",",
"avoid_conflict",
"=",
"False",
")",
":",
"if",
"avoid_conflict",
":",
"debut",
"=",
"\"\"\"INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING\"\"\"",
"else",
":",
"debut",
"=",
"\"\"\"INSERT I... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractRequetesSQL.update | Update row with Id from table. Set fields given by dic. | pyDLib/Core/sql.py | def update(cls,table, dic, Id):
""" Update row with Id from table. Set fields given by dic."""
if dic:
req = "UPDATE {table} SET {SET} WHERE id = " + cls.named_style.format('__id') + " RETURNING * "
r = abstractRequetesSQL.formate(req, SET=dic, table=table, args=dict(dic, __id=I... | def update(cls,table, dic, Id):
""" Update row with Id from table. Set fields given by dic."""
if dic:
req = "UPDATE {table} SET {SET} WHERE id = " + cls.named_style.format('__id') + " RETURNING * "
r = abstractRequetesSQL.formate(req, SET=dic, table=table, args=dict(dic, __id=I... | [
"Update",
"row",
"with",
"Id",
"from",
"table",
".",
"Set",
"fields",
"given",
"by",
"dic",
"."
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L303-L310 | [
"def",
"update",
"(",
"cls",
",",
"table",
",",
"dic",
",",
"Id",
")",
":",
"if",
"dic",
":",
"req",
"=",
"\"UPDATE {table} SET {SET} WHERE id = \"",
"+",
"cls",
".",
"named_style",
".",
"format",
"(",
"'__id'",
")",
"+",
"\" RETURNING * \"",
"r",
"=",
"... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractRequetesSQL.cree | Create ONE row from dic and returns the entry created | pyDLib/Core/sql.py | def cree(table, dic, avoid_conflict=False):
""" Create ONE row from dic and returns the entry created """
if avoid_conflict:
req = """ INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING RETURNING *"""
else:
req = """ INSERT INTO {table} {ENTET... | def cree(table, dic, avoid_conflict=False):
""" Create ONE row from dic and returns the entry created """
if avoid_conflict:
req = """ INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING RETURNING *"""
else:
req = """ INSERT INTO {table} {ENTET... | [
"Create",
"ONE",
"row",
"from",
"dic",
"and",
"returns",
"the",
"entry",
"created"
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L314-L321 | [
"def",
"cree",
"(",
"table",
",",
"dic",
",",
"avoid_conflict",
"=",
"False",
")",
":",
"if",
"avoid_conflict",
":",
"req",
"=",
"\"\"\" INSERT INTO {table} {ENTETE_INSERT} VALUES {BIND_INSERT} ON CONFLICT DO NOTHING RETURNING *\"\"\"",
"else",
":",
"req",
"=",
"\"\"\" IN... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | abstractRequetesSQL.supprime | Remove entries matchin given condition
kwargs is a dict of column name : value , with length ONE. | pyDLib/Core/sql.py | def supprime(cls,table, **kwargs):
""" Remove entries matchin given condition
kwargs is a dict of column name : value , with length ONE.
"""
assert len(kwargs) == 1
field, value = kwargs.popitem()
req = f"""DELETE FROM {table} WHERE {field} = """ + cls.mark_style
... | def supprime(cls,table, **kwargs):
""" Remove entries matchin given condition
kwargs is a dict of column name : value , with length ONE.
"""
assert len(kwargs) == 1
field, value = kwargs.popitem()
req = f"""DELETE FROM {table} WHERE {field} = """ + cls.mark_style
... | [
"Remove",
"entries",
"matchin",
"given",
"condition",
"kwargs",
"is",
"a",
"dict",
"of",
"column",
"name",
":",
"value",
"with",
"length",
"ONE",
"."
] | benoitkugler/abstractDataLibrary | python | https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/sql.py#L333-L341 | [
"def",
"supprime",
"(",
"cls",
",",
"table",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"len",
"(",
"kwargs",
")",
"==",
"1",
"field",
",",
"value",
"=",
"kwargs",
".",
"popitem",
"(",
")",
"req",
"=",
"f\"\"\"DELETE FROM {table} WHERE {field} = \"\"\"",... | 16be28e99837e40287a63803bbfdf67ac1806b7b |
train | ObjectDispatch.trace | Enumerate the children of the given object, as would be visible and utilized by dispatch. | web/dispatch/object/dispatch.py | def trace(self, context, obj):
"""Enumerate the children of the given object, as would be visible and utilized by dispatch."""
root = obj
if isroutine(obj):
yield Crumb(self, root, endpoint=True, handler=obj, options=opts(obj))
return
for name, attr in getmembers(obj if isclass(obj) else obj.__cl... | def trace(self, context, obj):
"""Enumerate the children of the given object, as would be visible and utilized by dispatch."""
root = obj
if isroutine(obj):
yield Crumb(self, root, endpoint=True, handler=obj, options=opts(obj))
return
for name, attr in getmembers(obj if isclass(obj) else obj.__cl... | [
"Enumerate",
"the",
"children",
"of",
"the",
"given",
"object",
"as",
"would",
"be",
"visible",
"and",
"utilized",
"by",
"dispatch",
"."
] | marrow/web.dispatch.object | python | https://github.com/marrow/web.dispatch.object/blob/98af461a404aae8ae58e2cbc2e0acdbf62a705bc/web/dispatch/object/dispatch.py#L23-L58 | [
"def",
"trace",
"(",
"self",
",",
"context",
",",
"obj",
")",
":",
"root",
"=",
"obj",
"if",
"isroutine",
"(",
"obj",
")",
":",
"yield",
"Crumb",
"(",
"self",
",",
"root",
",",
"endpoint",
"=",
"True",
",",
"handler",
"=",
"obj",
",",
"options",
... | 98af461a404aae8ae58e2cbc2e0acdbf62a705bc |
train | main | Main entry-point for calling layouts directly as a program. | layouts/__init__.py | def main(argv=None):
'''
Main entry-point for calling layouts directly as a program.
'''
# Prep argparse
ap = argparse.ArgumentParser(
description='Basic query options for Python HID-IO Layouts repository',
)
ap.add_argument('--list', action='store_true', help='List available layout ... | def main(argv=None):
'''
Main entry-point for calling layouts directly as a program.
'''
# Prep argparse
ap = argparse.ArgumentParser(
description='Basic query options for Python HID-IO Layouts repository',
)
ap.add_argument('--list', action='store_true', help='List available layout ... | [
"Main",
"entry",
"-",
"point",
"for",
"calling",
"layouts",
"directly",
"as",
"a",
"program",
"."
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L462-L487 | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"# Prep argparse",
"ap",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Basic query options for Python HID-IO Layouts repository'",
",",
")",
"ap",
".",
"add_argument",
"(",
"'--list'",
",",
"a... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layouts.retrieve_github_cache | Retrieves a cache of the layouts git repo from GitHub
@param github_path: Location of the git repo on GitHub (e.g. hid-io/layouts)
@param version: git reference for the version to download (e.g. master)
@param cache_dir: Directory to operate on external cache from
@param token: GitHub a... | layouts/__init__.py | def retrieve_github_cache(self, github_path, version, cache_dir, token):
'''
Retrieves a cache of the layouts git repo from GitHub
@param github_path: Location of the git repo on GitHub (e.g. hid-io/layouts)
@param version: git reference for the version to download (e.g. master)
... | def retrieve_github_cache(self, github_path, version, cache_dir, token):
'''
Retrieves a cache of the layouts git repo from GitHub
@param github_path: Location of the git repo on GitHub (e.g. hid-io/layouts)
@param version: git reference for the version to download (e.g. master)
... | [
"Retrieves",
"a",
"cache",
"of",
"the",
"layouts",
"git",
"repo",
"from",
"GitHub"
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L111-L170 | [
"def",
"retrieve_github_cache",
"(",
"self",
",",
"github_path",
",",
"version",
",",
"cache_dir",
",",
"token",
")",
":",
"# Check for environment variable Github token",
"token",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'GITHUB_APIKEY'",
",",
"None",
")",
... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layouts.get_layout | Returns the layout with the given name | layouts/__init__.py | def get_layout(self, name):
'''
Returns the layout with the given name
'''
layout_chain = []
# Retrieve initial layout file
try:
json_data = self.json_files[self.layout_names[name]]
except KeyError:
log.error('Could not find layout: %s', n... | def get_layout(self, name):
'''
Returns the layout with the given name
'''
layout_chain = []
# Retrieve initial layout file
try:
json_data = self.json_files[self.layout_names[name]]
except KeyError:
log.error('Could not find layout: %s', n... | [
"Returns",
"the",
"layout",
"with",
"the",
"given",
"name"
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L178-L215 | [
"def",
"get_layout",
"(",
"self",
",",
"name",
")",
":",
"layout_chain",
"=",
"[",
"]",
"# Retrieve initial layout file",
"try",
":",
"json_data",
"=",
"self",
".",
"json_files",
"[",
"self",
".",
"layout_names",
"[",
"name",
"]",
"]",
"except",
"KeyError",
... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layouts.dict_merge | Recursively merges two dicts
Overwrites any non-dictionary items
merge_to <- merge_in
Modifies merge_to dictionary
@param merge_to: Base dictionary to merge into
@param merge_in: Dictionary that may overwrite elements in merge_in | layouts/__init__.py | def dict_merge(self, merge_to, merge_in):
'''
Recursively merges two dicts
Overwrites any non-dictionary items
merge_to <- merge_in
Modifies merge_to dictionary
@param merge_to: Base dictionary to merge into
@param merge_in: Dictionary that may overwrite element... | def dict_merge(self, merge_to, merge_in):
'''
Recursively merges two dicts
Overwrites any non-dictionary items
merge_to <- merge_in
Modifies merge_to dictionary
@param merge_to: Base dictionary to merge into
@param merge_in: Dictionary that may overwrite element... | [
"Recursively",
"merges",
"two",
"dicts"
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L217-L246 | [
"def",
"dict_merge",
"(",
"self",
",",
"merge_to",
",",
"merge_in",
")",
":",
"for",
"key",
",",
"value",
"in",
"merge_in",
".",
"items",
"(",
")",
":",
"# Just add, if the key doesn't exist yet",
"# Or if set to None/Null",
"if",
"key",
"not",
"in",
"merge_to",... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layouts.squash_layouts | Returns a squashed layout
The first element takes precedence (i.e. left to right).
Dictionaries are recursively merged, overwrites only occur on non-dictionary entries.
[0,1]
0:
test: 'my data'
1:
test: 'stuff'
Result:
test: 'my data'
... | layouts/__init__.py | def squash_layouts(self, layouts):
'''
Returns a squashed layout
The first element takes precedence (i.e. left to right).
Dictionaries are recursively merged, overwrites only occur on non-dictionary entries.
[0,1]
0:
test: 'my data'
1:
test: 's... | def squash_layouts(self, layouts):
'''
Returns a squashed layout
The first element takes precedence (i.e. left to right).
Dictionaries are recursively merged, overwrites only occur on non-dictionary entries.
[0,1]
0:
test: 'my data'
1:
test: 's... | [
"Returns",
"a",
"squashed",
"layout"
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L248-L281 | [
"def",
"squash_layouts",
"(",
"self",
",",
"layouts",
")",
":",
"top_layout",
"=",
"layouts",
"[",
"0",
"]",
"json_data",
"=",
"{",
"}",
"# Generate a new container Layout",
"layout",
"=",
"Layout",
"(",
"top_layout",
".",
"name",
"(",
")",
",",
"json_data",... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layout.dict | Returns a JSON dict
@key_caps: Converts all dictionary keys to uppercase
@value_caps: Converts all dictionary values to uppercase
@return: JSON item (may be a variable, list or dictionary) | layouts/__init__.py | def dict(self, name, key_caps=False, value_caps=False):
'''
Returns a JSON dict
@key_caps: Converts all dictionary keys to uppercase
@value_caps: Converts all dictionary values to uppercase
@return: JSON item (may be a variable, list or dictionary)
'''
# Invalid... | def dict(self, name, key_caps=False, value_caps=False):
'''
Returns a JSON dict
@key_caps: Converts all dictionary keys to uppercase
@value_caps: Converts all dictionary values to uppercase
@return: JSON item (may be a variable, list or dictionary)
'''
# Invalid... | [
"Returns",
"a",
"JSON",
"dict"
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L347-L365 | [
"def",
"dict",
"(",
"self",
",",
"name",
",",
"key_caps",
"=",
"False",
",",
"value_caps",
"=",
"False",
")",
":",
"# Invalid Dictionary",
"if",
"not",
"isinstance",
"(",
"self",
".",
"json_data",
"[",
"name",
"]",
",",
"dict",
")",
":",
"raise",
"Inva... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layout.locale | Do a lookup for the locale code that is set for this layout.
NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0
@return: Tuple (<USB HID locale code>, <name>) | layouts/__init__.py | def locale(self):
'''
Do a lookup for the locale code that is set for this layout.
NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0
@return: Tuple (<USB HID locale code>, <name>)
'''
name = self.json_data['h... | def locale(self):
'''
Do a lookup for the locale code that is set for this layout.
NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0
@return: Tuple (<USB HID locale code>, <name>)
'''
name = self.json_data['h... | [
"Do",
"a",
"lookup",
"for",
"the",
"locale",
"code",
"that",
"is",
"set",
"for",
"this",
"layout",
"."
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L383-L397 | [
"def",
"locale",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"json_data",
"[",
"'hid_locale'",
"]",
"# Set to Undefined/0 if not set",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"\"Undefined\"",
"return",
"(",
"int",
"(",
"self",
".",
"json_data",
... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Layout.compose | Returns the sequence of combinations necessary to compose given text.
If the text expression is not possible with the given layout an ComposeException is thrown.
Iterate over the string, converting each character into a key sequence.
Between each character, an empty combo is inserted to handle... | layouts/__init__.py | def compose(self, text, minimal_clears=False, no_clears=False):
'''
Returns the sequence of combinations necessary to compose given text.
If the text expression is not possible with the given layout an ComposeException is thrown.
Iterate over the string, converting each character into ... | def compose(self, text, minimal_clears=False, no_clears=False):
'''
Returns the sequence of combinations necessary to compose given text.
If the text expression is not possible with the given layout an ComposeException is thrown.
Iterate over the string, converting each character into ... | [
"Returns",
"the",
"sequence",
"of",
"combinations",
"necessary",
"to",
"compose",
"given",
"text",
"."
] | hid-io/layouts-python | python | https://github.com/hid-io/layouts-python/blob/b347578bfb4198fd812ecd7a2d9c7e551a856280/layouts/__init__.py#L413-L456 | [
"def",
"compose",
"(",
"self",
",",
"text",
",",
"minimal_clears",
"=",
"False",
",",
"no_clears",
"=",
"False",
")",
":",
"sequence",
"=",
"[",
"]",
"clear",
"=",
"self",
".",
"json_data",
"[",
"'to_hid_keyboard'",
"]",
"[",
"'0x00'",
"]",
"# No Event",... | b347578bfb4198fd812ecd7a2d9c7e551a856280 |
train | Sipprverse.main | Run the necessary methods in the correct order | sippr.py | def main(self):
"""
Run the necessary methods in the correct order
"""
logging.info('Starting {at} analysis pipeline'.format(at=self.analysistype))
# Create the objects to be used in the analyses
objects = Objectprep(self)
objects.objectprep()
self.runmeta... | def main(self):
"""
Run the necessary methods in the correct order
"""
logging.info('Starting {at} analysis pipeline'.format(at=self.analysistype))
# Create the objects to be used in the analyses
objects = Objectprep(self)
objects.objectprep()
self.runmeta... | [
"Run",
"the",
"necessary",
"methods",
"in",
"the",
"correct",
"order"
] | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sippr.py#L26-L137 | [
"def",
"main",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Starting {at} analysis pipeline'",
".",
"format",
"(",
"at",
"=",
"self",
".",
"analysistype",
")",
")",
"# Create the objects to be used in the analyses",
"objects",
"=",
"Objectprep",
"(",
"sel... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | Sipprverse.genus_specific | For genus-specific targets, MLST and serotyping, determine if the closest refseq genus is known - i.e. if 16S
analyses have been performed. Perform the analyses if required | sippr.py | def genus_specific(self):
"""
For genus-specific targets, MLST and serotyping, determine if the closest refseq genus is known - i.e. if 16S
analyses have been performed. Perform the analyses if required
"""
# Initialise a variable to store whether the necessary analyses have alre... | def genus_specific(self):
"""
For genus-specific targets, MLST and serotyping, determine if the closest refseq genus is known - i.e. if 16S
analyses have been performed. Perform the analyses if required
"""
# Initialise a variable to store whether the necessary analyses have alre... | [
"For",
"genus",
"-",
"specific",
"targets",
"MLST",
"and",
"serotyping",
"determine",
"if",
"the",
"closest",
"refseq",
"genus",
"is",
"known",
"-",
"i",
".",
"e",
".",
"if",
"16S",
"analyses",
"have",
"been",
"performed",
".",
"Perform",
"the",
"analyses"... | OLC-Bioinformatics/sipprverse | python | https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sippr.py#L139-L157 | [
"def",
"genus_specific",
"(",
"self",
")",
":",
"# Initialise a variable to store whether the necessary analyses have already been performed",
"closestrefseqgenus",
"=",
"False",
"for",
"sample",
"in",
"self",
".",
"runmetadata",
".",
"samples",
":",
"if",
"sample",
".",
... | d4f10cdf8e1a39dac0953db61c21c97efc6006de |
train | pause | Tell iTunes to pause | hallie/modules/itunes.py | def pause():
"""Tell iTunes to pause"""
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(["osascript", "-e", PAUSE], stdout=subprocess.PIPE).communicate() | def pause():
"""Tell iTunes to pause"""
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(["osascript", "-e", PAUSE], stdout=subprocess.PIPE).communicate() | [
"Tell",
"iTunes",
"to",
"pause"
] | mikemelch/hallie | python | https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L169-L175 | [
"def",
"pause",
"(",
")",
":",
"if",
"not",
"settings",
".",
"platformCompatible",
"(",
")",
":",
"return",
"False",
"(",
"output",
",",
"error",
")",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"osascript\"",
",",
"\"-e\"",
",",
"PAUSE",
"]",
",",
... | a6dbb691145a85b776a1919e4c7930e0ae598437 |
train | resume | Tell iTunes to resume | hallie/modules/itunes.py | def resume():
"""Tell iTunes to resume"""
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(["osascript", "-e", RESUME], stdout=subprocess.PIPE).communicate() | def resume():
"""Tell iTunes to resume"""
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(["osascript", "-e", RESUME], stdout=subprocess.PIPE).communicate() | [
"Tell",
"iTunes",
"to",
"resume"
] | mikemelch/hallie | python | https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L177-L183 | [
"def",
"resume",
"(",
")",
":",
"if",
"not",
"settings",
".",
"platformCompatible",
"(",
")",
":",
"return",
"False",
"(",
"output",
",",
"error",
")",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"osascript\"",
",",
"\"-e\"",
",",
"RESUME",
"]",
",",
... | a6dbb691145a85b776a1919e4c7930e0ae598437 |
train | skip | Tell iTunes to skip a song | hallie/modules/itunes.py | def skip():
"""Tell iTunes to skip a song"""
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(["osascript", "-e", SKIP], stdout=subprocess.PIPE).communicate() | def skip():
"""Tell iTunes to skip a song"""
if not settings.platformCompatible():
return False
(output, error) = subprocess.Popen(["osascript", "-e", SKIP], stdout=subprocess.PIPE).communicate() | [
"Tell",
"iTunes",
"to",
"skip",
"a",
"song"
] | mikemelch/hallie | python | https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L186-L192 | [
"def",
"skip",
"(",
")",
":",
"if",
"not",
"settings",
".",
"platformCompatible",
"(",
")",
":",
"return",
"False",
"(",
"output",
",",
"error",
")",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"osascript\"",
",",
"\"-e\"",
",",
"SKIP",
"]",
",",
"s... | a6dbb691145a85b776a1919e4c7930e0ae598437 |
train | play | Tells iTunes to play a given song/artist/album - MACOSX ONLY | hallie/modules/itunes.py | def play(song, artist=None, album=None):
"""Tells iTunes to play a given song/artist/album - MACOSX ONLY"""
if not settings.platformCompatible():
return False
if song and not artist and not album:
(output, error) = subprocess.Popen(["osascript", "-e", DEFAULT_ITUNES_PLAY % (song, song, song)], stdout=subproces... | def play(song, artist=None, album=None):
"""Tells iTunes to play a given song/artist/album - MACOSX ONLY"""
if not settings.platformCompatible():
return False
if song and not artist and not album:
(output, error) = subprocess.Popen(["osascript", "-e", DEFAULT_ITUNES_PLAY % (song, song, song)], stdout=subproces... | [
"Tells",
"iTunes",
"to",
"play",
"a",
"given",
"song",
"/",
"artist",
"/",
"album",
"-",
"MACOSX",
"ONLY"
] | mikemelch/hallie | python | https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/itunes.py#L195-L234 | [
"def",
"play",
"(",
"song",
",",
"artist",
"=",
"None",
",",
"album",
"=",
"None",
")",
":",
"if",
"not",
"settings",
".",
"platformCompatible",
"(",
")",
":",
"return",
"False",
"if",
"song",
"and",
"not",
"artist",
"and",
"not",
"album",
":",
"(",
... | a6dbb691145a85b776a1919e4c7930e0ae598437 |
train | service_provider | This is a class decorator that declares a class to provide a set of services.
It is expected that the class has a no-arg constructor and will be instantiated
as a singleton. | servicelocator/lookup.py | def service_provider(*services):
"""
This is a class decorator that declares a class to provide a set of services.
It is expected that the class has a no-arg constructor and will be instantiated
as a singleton.
"""
def real_decorator(clazz):
instance = clazz()
for service in ser... | def service_provider(*services):
"""
This is a class decorator that declares a class to provide a set of services.
It is expected that the class has a no-arg constructor and will be instantiated
as a singleton.
"""
def real_decorator(clazz):
instance = clazz()
for service in ser... | [
"This",
"is",
"a",
"class",
"decorator",
"that",
"declares",
"a",
"class",
"to",
"provide",
"a",
"set",
"of",
"services",
".",
"It",
"is",
"expected",
"that",
"the",
"class",
"has",
"a",
"no",
"-",
"arg",
"constructor",
"and",
"will",
"be",
"instantiated... | innolitics/service-locator | python | https://github.com/innolitics/service-locator/blob/ddccac242587c800db3fde0abb9c1e9ed461369e/servicelocator/lookup.py#L26-L39 | [
"def",
"service_provider",
"(",
"*",
"services",
")",
":",
"def",
"real_decorator",
"(",
"clazz",
")",
":",
"instance",
"=",
"clazz",
"(",
")",
"for",
"service",
"in",
"services",
":",
"global_lookup",
".",
"add",
"(",
"service",
",",
"instance",
")",
"r... | ddccac242587c800db3fde0abb9c1e9ed461369e |
train | syllabify | Syllabify the given word, whether simplex or complex. | finnsyll/prev/v10.py | def syllabify(word):
'''Syllabify the given word, whether simplex or complex.'''
compound = bool(re.search(r'(-| |=)', word))
syllabify = _syllabify_compound if compound else _syllabify_simplex
syllabifications = list(syllabify(word))
for word, rules in rank(syllabifications):
# post-proces... | def syllabify(word):
'''Syllabify the given word, whether simplex or complex.'''
compound = bool(re.search(r'(-| |=)', word))
syllabify = _syllabify_compound if compound else _syllabify_simplex
syllabifications = list(syllabify(word))
for word, rules in rank(syllabifications):
# post-proces... | [
"Syllabify",
"the",
"given",
"word",
"whether",
"simplex",
"or",
"complex",
"."
] | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L33-L44 | [
"def",
"syllabify",
"(",
"word",
")",
":",
"compound",
"=",
"bool",
"(",
"re",
".",
"search",
"(",
"r'(-| |=)'",
",",
"word",
")",
")",
"syllabify",
"=",
"_syllabify_compound",
"if",
"compound",
"else",
"_syllabify_simplex",
"syllabifications",
"=",
"list",
... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | apply_T2 | There is a syllable boundary within a VV sequence of two nonidentical
vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa]. | finnsyll/prev/v10.py | def apply_T2(word):
'''There is a syllable boundary within a VV sequence of two nonidentical
vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].'''
WORD = word
offset = 0
for vv in vv_sequences(WORD):
seq = vv.group(2)
if not is_diphthong(seq) and not is_long(seq):
... | def apply_T2(word):
'''There is a syllable boundary within a VV sequence of two nonidentical
vowels that are not a genuine diphthong, e.g., [ta.e], [ko.et.taa].'''
WORD = word
offset = 0
for vv in vv_sequences(WORD):
seq = vv.group(2)
if not is_diphthong(seq) and not is_long(seq):
... | [
"There",
"is",
"a",
"syllable",
"boundary",
"within",
"a",
"VV",
"sequence",
"of",
"two",
"nonidentical",
"vowels",
"that",
"are",
"not",
"a",
"genuine",
"diphthong",
"e",
".",
"g",
".",
"[",
"ta",
".",
"e",
"]",
"[",
"ko",
".",
"et",
".",
"taa",
"... | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L179-L195 | [
"def",
"apply_T2",
"(",
"word",
")",
":",
"WORD",
"=",
"word",
"offset",
"=",
"0",
"for",
"vv",
"in",
"vv_sequences",
"(",
"WORD",
")",
":",
"seq",
"=",
"vv",
".",
"group",
"(",
"2",
")",
"if",
"not",
"is_diphthong",
"(",
"seq",
")",
"and",
"not"... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | apply_T5 | If a (V)VVV sequence contains a VV sequence that could be an /i/-final
diphthong, there is a syllable boundary between it and the third vowel,
e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an],
[säi.e], [oi.om.me]. | finnsyll/prev/v10.py | def apply_T5(word):
'''If a (V)VVV sequence contains a VV sequence that could be an /i/-final
diphthong, there is a syllable boundary between it and the third vowel,
e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an],
[säi.e], [oi.om.me].'''
WORD = word
offset = 0
for v... | def apply_T5(word):
'''If a (V)VVV sequence contains a VV sequence that could be an /i/-final
diphthong, there is a syllable boundary between it and the third vowel,
e.g., [raa.ois.sa], [huo.uim.me], [la.eis.sa], [sel.vi.äi.si], [tai.an],
[säi.e], [oi.om.me].'''
WORD = word
offset = 0
for v... | [
"If",
"a",
"(",
"V",
")",
"VVV",
"sequence",
"contains",
"a",
"VV",
"sequence",
"that",
"could",
"be",
"an",
"/",
"i",
"/",
"-",
"final",
"diphthong",
"there",
"is",
"a",
"syllable",
"boundary",
"between",
"it",
"and",
"the",
"third",
"vowel",
"e",
"... | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L230-L252 | [
"def",
"apply_T5",
"(",
"word",
")",
":",
"WORD",
"=",
"word",
"offset",
"=",
"0",
"for",
"vi",
"in",
"i_final_diphthong_vvv_sequences",
"(",
"WORD",
")",
":",
"s",
"=",
"max",
"(",
"vi",
".",
"start",
"(",
"1",
")",
",",
"vi",
".",
"start",
"(",
... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | apply_T6 | If a VVV-sequence contains a long vowel, there is a syllable boundary
between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an],
[mää.yt.te]. | finnsyll/prev/v10.py | def apply_T6(word):
'''If a VVV-sequence contains a long vowel, there is a syllable boundary
between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an],
[mää.yt.te].'''
WORD = word
offset = 0
for vvv in vvv_sequences(WORD):
seq = vvv.group(2)
j = 2 if is_long(seq[:2... | def apply_T6(word):
'''If a VVV-sequence contains a long vowel, there is a syllable boundary
between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an],
[mää.yt.te].'''
WORD = word
offset = 0
for vvv in vvv_sequences(WORD):
seq = vvv.group(2)
j = 2 if is_long(seq[:2... | [
"If",
"a",
"VVV",
"-",
"sequence",
"contains",
"a",
"long",
"vowel",
"there",
"is",
"a",
"syllable",
"boundary",
"between",
"it",
"and",
"the",
"third",
"vowel",
"e",
".",
"g",
".",
"[",
"kor",
".",
"ke",
".",
"aa",
"]",
"[",
"yh",
".",
"ti",
"."... | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L257-L275 | [
"def",
"apply_T6",
"(",
"word",
")",
":",
"WORD",
"=",
"word",
"offset",
"=",
"0",
"for",
"vvv",
"in",
"vvv_sequences",
"(",
"WORD",
")",
":",
"seq",
"=",
"vvv",
".",
"group",
"(",
"2",
")",
"j",
"=",
"2",
"if",
"is_long",
"(",
"seq",
"[",
":",... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | apply_T7 | If a VVV-sequence does not contain a potential /i/-final diphthong,
there is a syllable boundary between the second and third vowels, e.g.
[kau.an], [leu.an], [kiu.as]. | finnsyll/prev/v10.py | def apply_T7(word):
'''If a VVV-sequence does not contain a potential /i/-final diphthong,
there is a syllable boundary between the second and third vowels, e.g.
[kau.an], [leu.an], [kiu.as].'''
WORD = word
offset = 0
for vvv in vvv_sequences(WORD):
i = vvv.start(2) + 2 + offset
... | def apply_T7(word):
'''If a VVV-sequence does not contain a potential /i/-final diphthong,
there is a syllable boundary between the second and third vowels, e.g.
[kau.an], [leu.an], [kiu.as].'''
WORD = word
offset = 0
for vvv in vvv_sequences(WORD):
i = vvv.start(2) + 2 + offset
... | [
"If",
"a",
"VVV",
"-",
"sequence",
"does",
"not",
"contain",
"a",
"potential",
"/",
"i",
"/",
"-",
"final",
"diphthong",
"there",
"is",
"a",
"syllable",
"boundary",
"between",
"the",
"second",
"and",
"third",
"vowels",
"e",
".",
"g",
".",
"[",
"kau",
... | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L280-L294 | [
"def",
"apply_T7",
"(",
"word",
")",
":",
"WORD",
"=",
"word",
"offset",
"=",
"0",
"for",
"vvv",
"in",
"vvv_sequences",
"(",
"WORD",
")",
":",
"i",
"=",
"vvv",
".",
"start",
"(",
"2",
")",
"+",
"2",
"+",
"offset",
"WORD",
"=",
"WORD",
"[",
":",... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | apply_T8 | Split /ie/, /uo/, or /yö/ sequences in syllables that do not take
primary stress. | finnsyll/prev/v10.py | def apply_T8(word):
'''Split /ie/, /uo/, or /yö/ sequences in syllables that do not take
primary stress.'''
WORD = word
offset = 0
for vv in tail_diphthongs(WORD):
i = vv.start(1) + 1 + offset
WORD = WORD[:i] + '.' + WORD[i:]
offset += 1
RULE = ' T8' if word != WORD els... | def apply_T8(word):
'''Split /ie/, /uo/, or /yö/ sequences in syllables that do not take
primary stress.'''
WORD = word
offset = 0
for vv in tail_diphthongs(WORD):
i = vv.start(1) + 1 + offset
WORD = WORD[:i] + '.' + WORD[i:]
offset += 1
RULE = ' T8' if word != WORD els... | [
"Split",
"/",
"ie",
"/",
"/",
"uo",
"/",
"or",
"/",
"yö",
"/",
"sequences",
"in",
"syllables",
"that",
"do",
"not",
"take",
"primary",
"stress",
"."
] | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L299-L312 | [
"def",
"apply_T8",
"(",
"word",
")",
":",
"WORD",
"=",
"word",
"offset",
"=",
"0",
"for",
"vv",
"in",
"tail_diphthongs",
"(",
"WORD",
")",
":",
"i",
"=",
"vv",
".",
"start",
"(",
"1",
")",
"+",
"1",
"+",
"offset",
"WORD",
"=",
"WORD",
"[",
":",... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | wsp | Return the number of unstressed heavy syllables. | finnsyll/prev/v10.py | def wsp(word):
'''Return the number of unstressed heavy syllables.'''
HEAVY = r'[ieaAoO]{1}[\.]*(u|y)[^ieaAoO]+(\.|$)'
# # if the word is not monosyllabic, lop off the final syllable, which is
# # extrametrical
# if '.' in word:
# word = word[:word.rindex('.')]
# gather the indices of ... | def wsp(word):
'''Return the number of unstressed heavy syllables.'''
HEAVY = r'[ieaAoO]{1}[\.]*(u|y)[^ieaAoO]+(\.|$)'
# # if the word is not monosyllabic, lop off the final syllable, which is
# # extrametrical
# if '.' in word:
# word = word[:word.rindex('.')]
# gather the indices of ... | [
"Return",
"the",
"number",
"of",
"unstressed",
"heavy",
"syllables",
"."
] | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L382-L408 | [
"def",
"wsp",
"(",
"word",
")",
":",
"HEAVY",
"=",
"r'[ieaAoO]{1}[\\.]*(u|y)[^ieaAoO]+(\\.|$)'",
"# # if the word is not monosyllabic, lop off the final syllable, which is",
"# # extrametrical",
"# if '.' in word:",
"# word = word[:word.rindex('.')]",
"# gather the indices of syllable ... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | pk_prom | Return the number of stressed light syllables. | finnsyll/prev/v10.py | def pk_prom(word):
'''Return the number of stressed light syllables.'''
LIGHT = r'[ieaAoO]{1}[\.]*(u|y)(\.|$)'
# # if the word is not monosyllabic, lop off the final syllable, which is
# # extrametrical
# if '.' in word:
# word = word[:word.rindex('.')]
# gather the indices of syllable... | def pk_prom(word):
'''Return the number of stressed light syllables.'''
LIGHT = r'[ieaAoO]{1}[\.]*(u|y)(\.|$)'
# # if the word is not monosyllabic, lop off the final syllable, which is
# # extrametrical
# if '.' in word:
# word = word[:word.rindex('.')]
# gather the indices of syllable... | [
"Return",
"the",
"number",
"of",
"stressed",
"light",
"syllables",
"."
] | tsnaomi/finnsyll | python | https://github.com/tsnaomi/finnsyll/blob/6a42740311688c946a636a3e2304866c7aa041b3/finnsyll/prev/v10.py#L411-L437 | [
"def",
"pk_prom",
"(",
"word",
")",
":",
"LIGHT",
"=",
"r'[ieaAoO]{1}[\\.]*(u|y)(\\.|$)'",
"# # if the word is not monosyllabic, lop off the final syllable, which is",
"# # extrametrical",
"# if '.' in word:",
"# word = word[:word.rindex('.')]",
"# gather the indices of syllable bounda... | 6a42740311688c946a636a3e2304866c7aa041b3 |
train | pathquery.ext | Match files with an extension - e.g. 'js', 'txt' | pathquery/query.py | def ext(self, extension):
"""
Match files with an extension - e.g. 'js', 'txt'
"""
new_pathq = copy(self)
new_pathq._pattern.ext = extension
return new_pathq | def ext(self, extension):
"""
Match files with an extension - e.g. 'js', 'txt'
"""
new_pathq = copy(self)
new_pathq._pattern.ext = extension
return new_pathq | [
"Match",
"files",
"with",
"an",
"extension",
"-",
"e",
".",
"g",
".",
"js",
"txt"
] | crdoconnor/pathquery | python | https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/pathquery/query.py#L104-L110 | [
"def",
"ext",
"(",
"self",
",",
"extension",
")",
":",
"new_pathq",
"=",
"copy",
"(",
"self",
")",
"new_pathq",
".",
"_pattern",
".",
"ext",
"=",
"extension",
"return",
"new_pathq"
] | 4905fef27fc666ea4511eb0eee5098f754bb52ed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.