repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
trendels/rhino | rhino/response.py | Response.conditional_to | def conditional_to(self, request):
"""Return a response that is conditional to a given request.
Returns the Response object unchanged, or a new Response object
with a "304 Not Modified" status code.
"""
if not self.code == 200:
return self
request_headers = ... | python | def conditional_to(self, request):
"""Return a response that is conditional to a given request.
Returns the Response object unchanged, or a new Response object
with a "304 Not Modified" status code.
"""
if not self.code == 200:
return self
request_headers = ... | [
"def",
"conditional_to",
"(",
"self",
",",
"request",
")",
":",
"if",
"not",
"self",
".",
"code",
"==",
"200",
":",
"return",
"self",
"request_headers",
"=",
"request",
".",
"headers",
"response_headers",
"=",
"self",
".",
"headers",
"if_none_match",
"=",
... | Return a response that is conditional to a given request.
Returns the Response object unchanged, or a new Response object
with a "304 Not Modified" status code. | [
"Return",
"a",
"response",
"that",
"is",
"conditional",
"to",
"a",
"given",
"request",
"."
] | f1f0ef21b6080a2bd130b38b5bef163074c94aed | https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/response.py#L269-L311 | train | Return a new Response object that is conditional to a given request. |
jpivarski/pyminuit2 | setup.py | is_secretly_root | def is_secretly_root(lib):
"""
Detect an edge case where ROOT Minuit2 is detected as standalone
because $ROOTSYS/lib is in LD_LIBRARY_PATH, and suggest
appropriate countermeasures.
"""
from distutils import ccompiler
libdir = os.path.dirname(lib)
cc = ccompiler.new_compiler()
for roo... | python | def is_secretly_root(lib):
"""
Detect an edge case where ROOT Minuit2 is detected as standalone
because $ROOTSYS/lib is in LD_LIBRARY_PATH, and suggest
appropriate countermeasures.
"""
from distutils import ccompiler
libdir = os.path.dirname(lib)
cc = ccompiler.new_compiler()
for roo... | [
"def",
"is_secretly_root",
"(",
"lib",
")",
":",
"from",
"distutils",
"import",
"ccompiler",
"libdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"lib",
")",
"cc",
"=",
"ccompiler",
".",
"new_compiler",
"(",
")",
"for",
"rootlib",
"in",
"(",
"\"Core\""... | Detect an edge case where ROOT Minuit2 is detected as standalone
because $ROOTSYS/lib is in LD_LIBRARY_PATH, and suggest
appropriate countermeasures. | [
"Detect",
"an",
"edge",
"case",
"where",
"ROOT",
"Minuit2",
"is",
"detected",
"as",
"standalone",
"because",
"$ROOTSYS",
"/",
"lib",
"is",
"in",
"LD_LIBRARY_PATH",
"and",
"suggest",
"appropriate",
"countermeasures",
"."
] | bad2afcf91ad15a33616f37d311112d1ebab9e56 | https://github.com/jpivarski/pyminuit2/blob/bad2afcf91ad15a33616f37d311112d1ebab9e56/setup.py#L21-L38 | train | Detects if a ROOT Minuit2 is a standalone Minuit2 and returns True if it is a standalone Minuit2. |
assamite/creamas | creamas/examples/grid/ukko.py | _parse_ukko_report | def _parse_ukko_report(report):
'''Parse Ukko's report for available (non-reserved) nodes and their current
loads. The nodes that have load marked as '-' in report are not returned.
:returns: List of available ukko-nodes sorted in order of their current
load (nodes with least load are first).
'''
... | python | def _parse_ukko_report(report):
'''Parse Ukko's report for available (non-reserved) nodes and their current
loads. The nodes that have load marked as '-' in report are not returned.
:returns: List of available ukko-nodes sorted in order of their current
load (nodes with least load are first).
'''
... | [
"def",
"_parse_ukko_report",
"(",
"report",
")",
":",
"lines",
"=",
"report",
".",
"split",
"(",
"\"\\\\n\"",
")",
"cc",
"=",
"r'ukko[0-9]{3}.hpc.cs.helsinki.fi'",
"nodes",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"if",
"re",
".",
"match",
"(",
... | Parse Ukko's report for available (non-reserved) nodes and their current
loads. The nodes that have load marked as '-' in report are not returned.
:returns: List of available ukko-nodes sorted in order of their current
load (nodes with least load are first). | [
"Parse",
"Ukko",
"s",
"report",
"for",
"available",
"(",
"non",
"-",
"reserved",
")",
"nodes",
"and",
"their",
"current",
"loads",
".",
"The",
"nodes",
"that",
"have",
"load",
"marked",
"as",
"-",
"in",
"report",
"are",
"not",
"returned",
"."
] | 54dc3e31c97a3f938e58272f8ab80b6bcafeff58 | https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/ukko.py#L17-L38 | train | Parse Ukko s report for available ukko - nodes and their current
loads. |
assamite/creamas | creamas/examples/grid/ukko.py | _get_ukko_report | def _get_ukko_report():
'''Get Ukko's report from the fixed URL.
'''
with urllib.request.urlopen(URL_UKKO_REPORT) as response:
ret = str(response.read())
return ret | python | def _get_ukko_report():
'''Get Ukko's report from the fixed URL.
'''
with urllib.request.urlopen(URL_UKKO_REPORT) as response:
ret = str(response.read())
return ret | [
"def",
"_get_ukko_report",
"(",
")",
":",
"with",
"urllib",
".",
"request",
".",
"urlopen",
"(",
"URL_UKKO_REPORT",
")",
"as",
"response",
":",
"ret",
"=",
"str",
"(",
"response",
".",
"read",
"(",
")",
")",
"return",
"ret"
] | Get Ukko's report from the fixed URL. | [
"Get",
"Ukko",
"s",
"report",
"from",
"the",
"fixed",
"URL",
"."
] | 54dc3e31c97a3f938e58272f8ab80b6bcafeff58 | https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/ukko.py#L41-L46 | train | Get Ukko s report from the fixed URL. |
assamite/creamas | creamas/examples/grid/ukko.py | get_nodes | def get_nodes(n=8, exclude=[], loop=None):
'''Get Ukko nodes with the least amount of load.
May return less than *n* nodes if there are not as many nodes available,
the nodes are reserved or the nodes are on the exclude list.
:param int n: Number of Ukko nodes to return.
:param list exclude: Nodes... | python | def get_nodes(n=8, exclude=[], loop=None):
'''Get Ukko nodes with the least amount of load.
May return less than *n* nodes if there are not as many nodes available,
the nodes are reserved or the nodes are on the exclude list.
:param int n: Number of Ukko nodes to return.
:param list exclude: Nodes... | [
"def",
"get_nodes",
"(",
"n",
"=",
"8",
",",
"exclude",
"=",
"[",
"]",
",",
"loop",
"=",
"None",
")",
":",
"report",
"=",
"_get_ukko_report",
"(",
")",
"nodes",
"=",
"_parse_ukko_report",
"(",
"report",
")",
"ret",
"=",
"[",
"]",
"while",
"len",
"(... | Get Ukko nodes with the least amount of load.
May return less than *n* nodes if there are not as many nodes available,
the nodes are reserved or the nodes are on the exclude list.
:param int n: Number of Ukko nodes to return.
:param list exclude: Nodes to exclude from the returned list.
:param loo... | [
"Get",
"Ukko",
"nodes",
"with",
"the",
"least",
"amount",
"of",
"load",
"."
] | 54dc3e31c97a3f938e58272f8ab80b6bcafeff58 | https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/ukko.py#L60-L88 | train | Get Ukko nodes with the least amount of load. |
Apstra/aeon-venos | pylib/aeon/nxos/autoload/install_os.py | _install_os.md5sum | def md5sum(self):
"""
Check to see if the file exists on the device
:return:
"""
cmd = 'show file {dir}:{bin} md5sum'.format(
dir=self.DESTDIR, bin=self.image)
run = self.device.api.exec_opcmd
try:
got = run(cmd)
return got.get... | python | def md5sum(self):
"""
Check to see if the file exists on the device
:return:
"""
cmd = 'show file {dir}:{bin} md5sum'.format(
dir=self.DESTDIR, bin=self.image)
run = self.device.api.exec_opcmd
try:
got = run(cmd)
return got.get... | [
"def",
"md5sum",
"(",
"self",
")",
":",
"cmd",
"=",
"'show file {dir}:{bin} md5sum'",
".",
"format",
"(",
"dir",
"=",
"self",
".",
"DESTDIR",
",",
"bin",
"=",
"self",
".",
"image",
")",
"run",
"=",
"self",
".",
"device",
".",
"api",
".",
"exec_opcmd",
... | Check to see if the file exists on the device
:return: | [
"Check",
"to",
"see",
"if",
"the",
"file",
"exists",
"on",
"the",
"device",
":",
"return",
":"
] | 4d4f73d5904831ddc78c30922a8a226c90cf7d90 | https://github.com/Apstra/aeon-venos/blob/4d4f73d5904831ddc78c30922a8a226c90cf7d90/pylib/aeon/nxos/autoload/install_os.py#L24-L37 | train | Check to see if the file exists on the device and return the md5sum |
Apstra/aeon-venos | pylib/aeon/nxos/autoload/install_os.py | _install_os.copy_from | def copy_from(self, location, timeout=10 * 60):
"""
This method will fetch the image; the fetch will happen from the
device-side using the 'copy' command. Note that the NXAPI appears to
be single-threaded, so the code needs to wait until this operation has
completed before attem... | python | def copy_from(self, location, timeout=10 * 60):
"""
This method will fetch the image; the fetch will happen from the
device-side using the 'copy' command. Note that the NXAPI appears to
be single-threaded, so the code needs to wait until this operation has
completed before attem... | [
"def",
"copy_from",
"(",
"self",
",",
"location",
",",
"timeout",
"=",
"10",
"*",
"60",
")",
":",
"cmd",
"=",
"'copy {location} {dir}: vrf {vrf_name}'",
".",
"format",
"(",
"location",
"=",
"location",
",",
"dir",
"=",
"self",
".",
"DESTDIR",
",",
"vrf_nam... | This method will fetch the image; the fetch will happen from the
device-side using the 'copy' command. Note that the NXAPI appears to
be single-threaded, so the code needs to wait until this operation has
completed before attempting another API call. Therefore the :timeout:
value is se... | [
"This",
"method",
"will",
"fetch",
"the",
"image",
";",
"the",
"fetch",
"will",
"happen",
"from",
"the",
"device",
"-",
"side",
"using",
"the",
"copy",
"command",
".",
"Note",
"that",
"the",
"NXAPI",
"appears",
"to",
"be",
"single",
"-",
"threaded",
"so"... | 4d4f73d5904831ddc78c30922a8a226c90cf7d90 | https://github.com/Apstra/aeon-venos/blob/4d4f73d5904831ddc78c30922a8a226c90cf7d90/pylib/aeon/nxos/autoload/install_os.py#L56-L76 | train | This method will copy the image from the device - side to the specified location. |
Apstra/aeon-venos | pylib/aeon/nxos/autoload/install_os.py | _install_os.run | def run(self, timeout=10 * 60):
"""
This will invoke the command to install the image, and then
cause the device to reboot.
:param timeout: time/seconds to perform the install action
"""
cmd = 'install all nxos {dir}:{bin}'.format(
dir=self.DESTDIR, bin=self.... | python | def run(self, timeout=10 * 60):
"""
This will invoke the command to install the image, and then
cause the device to reboot.
:param timeout: time/seconds to perform the install action
"""
cmd = 'install all nxos {dir}:{bin}'.format(
dir=self.DESTDIR, bin=self.... | [
"def",
"run",
"(",
"self",
",",
"timeout",
"=",
"10",
"*",
"60",
")",
":",
"cmd",
"=",
"'install all nxos {dir}:{bin}'",
".",
"format",
"(",
"dir",
"=",
"self",
".",
"DESTDIR",
",",
"bin",
"=",
"self",
".",
"image",
")",
"# Don't prompt when upgrading",
... | This will invoke the command to install the image, and then
cause the device to reboot.
:param timeout: time/seconds to perform the install action | [
"This",
"will",
"invoke",
"the",
"command",
"to",
"install",
"the",
"image",
"and",
"then",
"cause",
"the",
"device",
"to",
"reboot",
".",
":",
"param",
"timeout",
":",
"time",
"/",
"seconds",
"to",
"perform",
"the",
"install",
"action"
] | 4d4f73d5904831ddc78c30922a8a226c90cf7d90 | https://github.com/Apstra/aeon-venos/blob/4d4f73d5904831ddc78c30922a8a226c90cf7d90/pylib/aeon/nxos/autoload/install_os.py#L78-L93 | train | This method will invoke the command to install the image and then install the image. |
tech-pi/doufo | src/python/doufo/list.py | List.extend | def extend(self, xs: Union['List[T]', typing.List[T]]) -> 'List[T]': # type: ignore
"""doufo.List.extend
Args:
`self`
`xs` (`Union['List[T]', typing.List[T]]`): Another List object or Typing.List
Returns:
extented `List` (`List[T]`)
"""
... | python | def extend(self, xs: Union['List[T]', typing.List[T]]) -> 'List[T]': # type: ignore
"""doufo.List.extend
Args:
`self`
`xs` (`Union['List[T]', typing.List[T]]`): Another List object or Typing.List
Returns:
extented `List` (`List[T]`)
"""
... | [
"def",
"extend",
"(",
"self",
",",
"xs",
":",
"Union",
"[",
"'List[T]'",
",",
"typing",
".",
"List",
"[",
"T",
"]",
"]",
")",
"->",
"'List[T]'",
":",
"# type: ignore",
"return",
"type",
"(",
"self",
")",
"(",
"self",
".",
"unbox",
"(",
")",
"+",
... | doufo.List.extend
Args:
`self`
`xs` (`Union['List[T]', typing.List[T]]`): Another List object or Typing.List
Returns:
extented `List` (`List[T]`) | [
"doufo",
".",
"List",
".",
"extend",
"Args",
":",
"self",
"xs",
"(",
"Union",
"[",
"List",
"[",
"T",
"]",
"typing",
".",
"List",
"[",
"T",
"]]",
")",
":",
"Another",
"List",
"object",
"or",
"Typing",
".",
"List",
"Returns",
":",
"extented",
"List",... | 3d375fef30670597768a6eef809b75b4b1b5a3fd | https://github.com/tech-pi/doufo/blob/3d375fef30670597768a6eef809b75b4b1b5a3fd/src/python/doufo/list.py#L64-L72 | train | A wrapper for the above method to extend a list with another list. |
tech-pi/doufo | src/python/doufo/list.py | List.fmap | def fmap(self, f: Callable[[T], B]) -> 'List[B]':
"""doufo.List.fmap: map `List`
Args:
`self`:
`f` (`Callable[[T], B]`): any callable funtion
Returns:
return (`List[B]`): A `List` of objected from `f`.
Raises:
"""
return Lis... | python | def fmap(self, f: Callable[[T], B]) -> 'List[B]':
"""doufo.List.fmap: map `List`
Args:
`self`:
`f` (`Callable[[T], B]`): any callable funtion
Returns:
return (`List[B]`): A `List` of objected from `f`.
Raises:
"""
return Lis... | [
"def",
"fmap",
"(",
"self",
",",
"f",
":",
"Callable",
"[",
"[",
"T",
"]",
",",
"B",
"]",
")",
"->",
"'List[B]'",
":",
"return",
"List",
"(",
"[",
"f",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"unbox",
"(",
")",
"]",
")"
] | doufo.List.fmap: map `List`
Args:
`self`:
`f` (`Callable[[T], B]`): any callable funtion
Returns:
return (`List[B]`): A `List` of objected from `f`.
Raises: | [
"doufo",
".",
"List",
".",
"fmap",
":",
"map",
"List",
"Args",
":",
"self",
":",
"f",
"(",
"Callable",
"[[",
"T",
"]",
"B",
"]",
")",
":",
"any",
"callable",
"funtion",
"Returns",
":",
"return",
"(",
"List",
"[",
"B",
"]",
")",
":",
"A",
"List"... | 3d375fef30670597768a6eef809b75b4b1b5a3fd | https://github.com/tech-pi/doufo/blob/3d375fef30670597768a6eef809b75b4b1b5a3fd/src/python/doufo/list.py#L84-L93 | train | Returns a new list where each element in self is mapped to f. |
tech-pi/doufo | src/python/doufo/list.py | List.zip | def zip(self, xs: 'List[B]') -> 'List[Tuple[T, B]]':
"""doufo.List.zip: zip with another `List` object ot `tuple List` object
Args:
`self`:
`xs` (`List[B]`): anther `List` object
Returns:
return (`type`):description
Raises:
If the... | python | def zip(self, xs: 'List[B]') -> 'List[Tuple[T, B]]':
"""doufo.List.zip: zip with another `List` object ot `tuple List` object
Args:
`self`:
`xs` (`List[B]`): anther `List` object
Returns:
return (`type`):description
Raises:
If the... | [
"def",
"zip",
"(",
"self",
",",
"xs",
":",
"'List[B]'",
")",
"->",
"'List[Tuple[T, B]]'",
":",
"if",
"len",
"(",
"self",
")",
"==",
"len",
"(",
"xs",
")",
":",
"return",
"List",
"(",
"[",
"(",
"x",
",",
"y",
")",
"for",
"x",
",",
"y",
"in",
"... | doufo.List.zip: zip with another `List` object ot `tuple List` object
Args:
`self`:
`xs` (`List[B]`): anther `List` object
Returns:
return (`type`):description
Raises:
If the length of input and current object differs, warning! | [
"doufo",
".",
"List",
".",
"zip",
":",
"zip",
"with",
"another",
"List",
"object",
"ot",
"tuple",
"List",
"object",
"Args",
":",
"self",
":",
"xs",
"(",
"List",
"[",
"B",
"]",
")",
":",
"anther",
"List",
"object",
"Returns",
":",
"return",
"(",
"ty... | 3d375fef30670597768a6eef809b75b4b1b5a3fd | https://github.com/tech-pi/doufo/blob/3d375fef30670597768a6eef809b75b4b1b5a3fd/src/python/doufo/list.py#L95-L109 | train | doufo. List. zip |
tech-pi/doufo | src/python/doufo/list.py | List.filter | def filter(self, f: Callable[[A], B]) -> 'List[T]':
"""doufo.List.filter: filter this `List` obj with input `f` function
Args:
`self`:
f (`Callable[[A],B]`): function that tells `True` or `False`
Returns:
return (`List[T]`): Filtered List
R... | python | def filter(self, f: Callable[[A], B]) -> 'List[T]':
"""doufo.List.filter: filter this `List` obj with input `f` function
Args:
`self`:
f (`Callable[[A],B]`): function that tells `True` or `False`
Returns:
return (`List[T]`): Filtered List
R... | [
"def",
"filter",
"(",
"self",
",",
"f",
":",
"Callable",
"[",
"[",
"A",
"]",
",",
"B",
"]",
")",
"->",
"'List[T]'",
":",
"return",
"List",
"(",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"unbox",
"(",
")",
"if",
"f",
"(",
"x",
")",
"is",
"Tru... | doufo.List.filter: filter this `List` obj with input `f` function
Args:
`self`:
f (`Callable[[A],B]`): function that tells `True` or `False`
Returns:
return (`List[T]`): Filtered List
Raises: | [
"doufo",
".",
"List",
".",
"filter",
":",
"filter",
"this",
"List",
"obj",
"with",
"input",
"f",
"function",
"Args",
":",
"self",
":",
"f",
"(",
"Callable",
"[[",
"A",
"]",
"B",
"]",
")",
":",
"function",
"that",
"tells",
"True",
"or",
"False",
"Re... | 3d375fef30670597768a6eef809b75b4b1b5a3fd | https://github.com/tech-pi/doufo/blob/3d375fef30670597768a6eef809b75b4b1b5a3fd/src/python/doufo/list.py#L111-L120 | train | Returns a new list with only elements that satisfy the given function f. |
brunato/lograptor | lograptor/tui.py | get_terminal_size | def get_terminal_size():
"""
Get the terminal size in width and height. Works on Linux, Mac OS X, Windows, Cygwin (Windows).
:return: Returns a 2-tuple with width and height.
"""
import platform
current_os = platform.system()
tuple_xy = None
if current_os == 'Windows':
tuple... | python | def get_terminal_size():
"""
Get the terminal size in width and height. Works on Linux, Mac OS X, Windows, Cygwin (Windows).
:return: Returns a 2-tuple with width and height.
"""
import platform
current_os = platform.system()
tuple_xy = None
if current_os == 'Windows':
tuple... | [
"def",
"get_terminal_size",
"(",
")",
":",
"import",
"platform",
"current_os",
"=",
"platform",
".",
"system",
"(",
")",
"tuple_xy",
"=",
"None",
"if",
"current_os",
"==",
"'Windows'",
":",
"tuple_xy",
"=",
"get_windows_terminal_size",
"(",
")",
"if",
"tuple_x... | Get the terminal size in width and height. Works on Linux, Mac OS X, Windows, Cygwin (Windows).
:return: Returns a 2-tuple with width and height. | [
"Get",
"the",
"terminal",
"size",
"in",
"width",
"and",
"height",
".",
"Works",
"on",
"Linux",
"Mac",
"OS",
"X",
"Windows",
"Cygwin",
"(",
"Windows",
")",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/tui.py#L28-L47 | train | Get the terminal size in width and height. Works on Linux Mac OS X Windows Cygwin Linux and Windows. |
brunato/lograptor | lograptor/tui.py | get_unix_tput_terminal_size | def get_unix_tput_terminal_size():
"""
Get the terminal size of a UNIX terminal using the tput UNIX command.
Ref: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window
"""
import subprocess
try:
proc = subprocess.Popen(["tput", "cols"], stdin=subpr... | python | def get_unix_tput_terminal_size():
"""
Get the terminal size of a UNIX terminal using the tput UNIX command.
Ref: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window
"""
import subprocess
try:
proc = subprocess.Popen(["tput", "cols"], stdin=subpr... | [
"def",
"get_unix_tput_terminal_size",
"(",
")",
":",
"import",
"subprocess",
"try",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"tput\"",
",",
"\"cols\"",
"]",
",",
"stdin",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"subprocess",
".... | Get the terminal size of a UNIX terminal using the tput UNIX command.
Ref: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window | [
"Get",
"the",
"terminal",
"size",
"of",
"a",
"UNIX",
"terminal",
"using",
"the",
"tput",
"UNIX",
"command",
".",
"Ref",
":",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"263890",
"/",
"how",
"-",
"do",
"-",
"i",
"-",
"find"... | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/tui.py#L76-L91 | train | Get the terminal size of a UNIX terminal using tput. |
brunato/lograptor | lograptor/tui.py | get_unix_ioctl_terminal_size | def get_unix_ioctl_terminal_size():
"""Get the terminal size of a UNIX terminal using the ioctl UNIX command."""
def ioctl_gwinsz(fd):
try:
import fcntl
import termios
import struct
return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
... | python | def get_unix_ioctl_terminal_size():
"""Get the terminal size of a UNIX terminal using the ioctl UNIX command."""
def ioctl_gwinsz(fd):
try:
import fcntl
import termios
import struct
return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
... | [
"def",
"get_unix_ioctl_terminal_size",
"(",
")",
":",
"def",
"ioctl_gwinsz",
"(",
"fd",
")",
":",
"try",
":",
"import",
"fcntl",
"import",
"termios",
"import",
"struct",
"return",
"struct",
".",
"unpack",
"(",
"'hh'",
",",
"fcntl",
".",
"ioctl",
"(",
"fd",... | Get the terminal size of a UNIX terminal using the ioctl UNIX command. | [
"Get",
"the",
"terminal",
"size",
"of",
"a",
"UNIX",
"terminal",
"using",
"the",
"ioctl",
"UNIX",
"command",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/tui.py#L94-L118 | train | Get the terminal size using the ioctl UNIX command. |
PBR/MQ2 | MQ2/add_marker_to_qtls.py | add_marker_to_qtl | def add_marker_to_qtl(qtl, map_list):
"""Add the closest marker to the given QTL.
:arg qtl: a row of the QTL list.
:arg map_list: the genetic map containing the list of markers.
"""
closest = ''
diff = None
for marker in map_list:
if qtl[1] == marker[1]:
tmp_diff = floa... | python | def add_marker_to_qtl(qtl, map_list):
"""Add the closest marker to the given QTL.
:arg qtl: a row of the QTL list.
:arg map_list: the genetic map containing the list of markers.
"""
closest = ''
diff = None
for marker in map_list:
if qtl[1] == marker[1]:
tmp_diff = floa... | [
"def",
"add_marker_to_qtl",
"(",
"qtl",
",",
"map_list",
")",
":",
"closest",
"=",
"''",
"diff",
"=",
"None",
"for",
"marker",
"in",
"map_list",
":",
"if",
"qtl",
"[",
"1",
"]",
"==",
"marker",
"[",
"1",
"]",
":",
"tmp_diff",
"=",
"float",
"(",
"qt... | Add the closest marker to the given QTL.
:arg qtl: a row of the QTL list.
:arg map_list: the genetic map containing the list of markers. | [
"Add",
"the",
"closest",
"marker",
"to",
"the",
"given",
"QTL",
"."
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/add_marker_to_qtls.py#L38-L55 | train | Adds the closest marker to the given QTL. |
PBR/MQ2 | MQ2/add_marker_to_qtls.py | add_marker_to_qtls | def add_marker_to_qtls(qtlfile, mapfile, outputfile='qtls_with_mk.csv'):
"""This function adds to a list of QTLs, the closest marker to the
QTL peak.
:arg qtlfile: a CSV list of all the QTLs found.
The file should be structured as follow::
Trait, Linkage group, position, other columns
... | python | def add_marker_to_qtls(qtlfile, mapfile, outputfile='qtls_with_mk.csv'):
"""This function adds to a list of QTLs, the closest marker to the
QTL peak.
:arg qtlfile: a CSV list of all the QTLs found.
The file should be structured as follow::
Trait, Linkage group, position, other columns
... | [
"def",
"add_marker_to_qtls",
"(",
"qtlfile",
",",
"mapfile",
",",
"outputfile",
"=",
"'qtls_with_mk.csv'",
")",
":",
"qtl_list",
"=",
"read_input_file",
"(",
"qtlfile",
",",
"','",
")",
"map_list",
"=",
"read_input_file",
"(",
"mapfile",
",",
"','",
")",
"if",... | This function adds to a list of QTLs, the closest marker to the
QTL peak.
:arg qtlfile: a CSV list of all the QTLs found.
The file should be structured as follow::
Trait, Linkage group, position, other columns
The other columns will not matter as long as the first three
col... | [
"This",
"function",
"adds",
"to",
"a",
"list",
"of",
"QTLs",
"the",
"closest",
"marker",
"to",
"the",
"QTL",
"peak",
"."
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/add_marker_to_qtls.py#L58-L87 | train | This function adds a marker to the list of QTLs that are closest to the QTL peak. |
kata198/QueryableList | QueryableList/Builder.py | QueryBuilder.addFilter | def addFilter(self, filterMethod=FILTER_METHOD_AND, **kwargs):
'''
addFilter - Add a filter to this query.
@param filterMethod <str> - The filter method to use (AND or OR), default: 'AND'
@param additional args - Filter arguments. @see QueryableListBase.filter
... | python | def addFilter(self, filterMethod=FILTER_METHOD_AND, **kwargs):
'''
addFilter - Add a filter to this query.
@param filterMethod <str> - The filter method to use (AND or OR), default: 'AND'
@param additional args - Filter arguments. @see QueryableListBase.filter
... | [
"def",
"addFilter",
"(",
"self",
",",
"filterMethod",
"=",
"FILTER_METHOD_AND",
",",
"*",
"*",
"kwargs",
")",
":",
"filterMethod",
"=",
"filterMethod",
".",
"upper",
"(",
")",
"if",
"filterMethod",
"not",
"in",
"FILTER_METHODS",
":",
"raise",
"ValueError",
"... | addFilter - Add a filter to this query.
@param filterMethod <str> - The filter method to use (AND or OR), default: 'AND'
@param additional args - Filter arguments. @see QueryableListBase.filter
@raises ValueError if filterMethod is not one of known methods. | [
"addFilter",
"-",
"Add",
"a",
"filter",
"to",
"this",
"query",
"."
] | 279286d46205ce8268af42e03b75820a7483fddb | https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L33-L47 | train | addFilter - Add a filter to this query. |
kata198/QueryableList | QueryableList/Builder.py | QueryBuilder.execute | def execute(self, lst):
'''
execute - Execute the series of filters, in order, on the provided list.
@param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within
the list, you can pick a QueryableList implementing class to g... | python | def execute(self, lst):
'''
execute - Execute the series of filters, in order, on the provided list.
@param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within
the list, you can pick a QueryableList implementing class to g... | [
"def",
"execute",
"(",
"self",
",",
"lst",
")",
":",
"from",
".",
"import",
"QueryableListMixed",
"if",
"not",
"issubclass",
"(",
"lst",
".",
"__class__",
",",
"QueryableListBase",
")",
":",
"lst",
"=",
"QueryableListMixed",
"(",
"lst",
")",
"filters",
"="... | execute - Execute the series of filters, in order, on the provided list.
@param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within
the list, you can pick a QueryableList implementing class to get faster results. Otherwise, if a list type tha... | [
"execute",
"-",
"Execute",
"the",
"series",
"of",
"filters",
"in",
"order",
"on",
"the",
"provided",
"list",
"."
] | 279286d46205ce8268af42e03b75820a7483fddb | https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L65-L90 | train | Execute the series of filters on the provided list. |
kata198/QueryableList | QueryableList/Builder.py | QueryBuilder.copy | def copy(self):
'''
copy - Create a copy of this query.
@return <QueryBuilder> - a copy of this query
'''
ret = QueryBuilder()
ret.filters = copy.copy(self.filters)
return ret | python | def copy(self):
'''
copy - Create a copy of this query.
@return <QueryBuilder> - a copy of this query
'''
ret = QueryBuilder()
ret.filters = copy.copy(self.filters)
return ret | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"QueryBuilder",
"(",
")",
"ret",
".",
"filters",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"filters",
")",
"return",
"ret"
] | copy - Create a copy of this query.
@return <QueryBuilder> - a copy of this query | [
"copy",
"-",
"Create",
"a",
"copy",
"of",
"this",
"query",
"."
] | 279286d46205ce8268af42e03b75820a7483fddb | https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L92-L100 | train | Create a copy of this query. |
kata198/QueryableList | QueryableList/Builder.py | QueryBuilder._applyFilter | def _applyFilter(lst, filterMethod, filterArgs):
'''
_applyFilter - Applies the given filter method on a set of args
private method - used by execute
@return QueryableList - a QueryableList containing the elements of the resulting filter
'''
if filterMetho... | python | def _applyFilter(lst, filterMethod, filterArgs):
'''
_applyFilter - Applies the given filter method on a set of args
private method - used by execute
@return QueryableList - a QueryableList containing the elements of the resulting filter
'''
if filterMetho... | [
"def",
"_applyFilter",
"(",
"lst",
",",
"filterMethod",
",",
"filterArgs",
")",
":",
"if",
"filterMethod",
"==",
"FILTER_METHOD_AND",
":",
"return",
"lst",
".",
"filterAnd",
"(",
"*",
"*",
"filterArgs",
")",
"else",
":",
"# ALready validated in addFIlter that type... | _applyFilter - Applies the given filter method on a set of args
private method - used by execute
@return QueryableList - a QueryableList containing the elements of the resulting filter | [
"_applyFilter",
"-",
"Applies",
"the",
"given",
"filter",
"method",
"on",
"a",
"set",
"of",
"args"
] | 279286d46205ce8268af42e03b75820a7483fddb | https://github.com/kata198/QueryableList/blob/279286d46205ce8268af42e03b75820a7483fddb/QueryableList/Builder.py#L103-L114 | train | Internal function that applies the given filter method on a set of args
and returns a new list containing the elements of the resulting list. |
Fire-Proof/cuepy | cuepy/cuepy.py | CorsairSDK._raise_corsair_error | def _raise_corsair_error(self, error=None, message=""):
"""
Raise error message based on the last reported error from the SDK
:param error: specify error type
:type error: int
:param message: specify error message
:type message: str
"""
if error is None:
... | python | def _raise_corsair_error(self, error=None, message=""):
"""
Raise error message based on the last reported error from the SDK
:param error: specify error type
:type error: int
:param message: specify error message
:type message: str
"""
if error is None:
... | [
"def",
"_raise_corsair_error",
"(",
"self",
",",
"error",
"=",
"None",
",",
"message",
"=",
"\"\"",
")",
":",
"if",
"error",
"is",
"None",
":",
"error",
"=",
"self",
".",
"last_error",
"(",
")",
"raise",
"error",
"(",
"message",
")"
] | Raise error message based on the last reported error from the SDK
:param error: specify error type
:type error: int
:param message: specify error message
:type message: str | [
"Raise",
"error",
"message",
"based",
"on",
"the",
"last",
"reported",
"error",
"from",
"the",
"SDK"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L26-L37 | train | Raise error based on last reported error from the SDK
|
Fire-Proof/cuepy | cuepy/cuepy.py | CorsairSDK.device_count | def device_count(self):
"""
Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int
"""
device_count = get_device_count(self.corsair_sdk)
if device_count == -1:
self._raise_corsair_error()
return device_count | python | def device_count(self):
"""
Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int
"""
device_count = get_device_count(self.corsair_sdk)
if device_count == -1:
self._raise_corsair_error()
return device_count | [
"def",
"device_count",
"(",
"self",
")",
":",
"device_count",
"=",
"get_device_count",
"(",
"self",
".",
"corsair_sdk",
")",
"if",
"device_count",
"==",
"-",
"1",
":",
"self",
".",
"_raise_corsair_error",
"(",
")",
"return",
"device_count"
] | Find amount of CUE devices
:returns: amount of CUE devices
:rtype: int | [
"Find",
"amount",
"of",
"CUE",
"devices"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L48-L58 | train | Find amount of devices in the CUE system |
Fire-Proof/cuepy | cuepy/cuepy.py | CorsairSDK.led_id_from_char | def led_id_from_char(self, char):
"""
Get id of a led by the letter
Only between A-Z
:param char: Character to find led_id from
:type char: str
:returns: id for led
:rtype: int
"""
led_id = get_led_id_for_key_name(self.corsair_sdk, bytes(char))
... | python | def led_id_from_char(self, char):
"""
Get id of a led by the letter
Only between A-Z
:param char: Character to find led_id from
:type char: str
:returns: id for led
:rtype: int
"""
led_id = get_led_id_for_key_name(self.corsair_sdk, bytes(char))
... | [
"def",
"led_id_from_char",
"(",
"self",
",",
"char",
")",
":",
"led_id",
"=",
"get_led_id_for_key_name",
"(",
"self",
".",
"corsair_sdk",
",",
"bytes",
"(",
"char",
")",
")",
"if",
"led_id",
"==",
"0",
":",
"self",
".",
"_raise_corsair_error",
"(",
")",
... | Get id of a led by the letter
Only between A-Z
:param char: Character to find led_id from
:type char: str
:returns: id for led
:rtype: int | [
"Get",
"id",
"of",
"a",
"led",
"by",
"the",
"letter",
"Only",
"between",
"A",
"-",
"Z"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L60-L73 | train | Get the id of a led by the letter
Only between A - Z |
Fire-Proof/cuepy | cuepy/cuepy.py | CorsairSDK.set_led | def set_led(self, led_id, color):
"""
Set color of an led
:param led_id: id of led to set color
:type led_id: int
:param color: list of rgb values of new colors. eg. [255, 255, 255]
:type color: list
:returns: true if successful
:rtype: bool
"""
... | python | def set_led(self, led_id, color):
"""
Set color of an led
:param led_id: id of led to set color
:type led_id: int
:param color: list of rgb values of new colors. eg. [255, 255, 255]
:type color: list
:returns: true if successful
:rtype: bool
"""
... | [
"def",
"set_led",
"(",
"self",
",",
"led_id",
",",
"color",
")",
":",
"if",
"not",
"set_leds_color",
"(",
"self",
".",
"corsair_sdk",
",",
"LedColor",
"(",
"led_id",
",",
"*",
"color",
")",
")",
":",
"self",
".",
"_raise_corsair_error",
"(",
")",
"retu... | Set color of an led
:param led_id: id of led to set color
:type led_id: int
:param color: list of rgb values of new colors. eg. [255, 255, 255]
:type color: list
:returns: true if successful
:rtype: bool | [
"Set",
"color",
"of",
"an",
"led"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L75-L88 | train | Set color of an led |
Fire-Proof/cuepy | cuepy/cuepy.py | CorsairSDK.request_control | def request_control(self, device_id, access_mode=True):
"""
Request exclusive control of device
:param device_id: id of device
:type device_id: int
:param access_mode: True=exclusive, False=shared
:type access_mode: bool
:returns: true if successful
:rtyp... | python | def request_control(self, device_id, access_mode=True):
"""
Request exclusive control of device
:param device_id: id of device
:type device_id: int
:param access_mode: True=exclusive, False=shared
:type access_mode: bool
:returns: true if successful
:rtyp... | [
"def",
"request_control",
"(",
"self",
",",
"device_id",
",",
"access_mode",
"=",
"True",
")",
":",
"if",
"access_mode",
":",
"if",
"not",
"request_control",
"(",
"self",
".",
"corsair_sdk",
",",
"device_id",
")",
":",
"self",
".",
"_raise_corsair_error",
"(... | Request exclusive control of device
:param device_id: id of device
:type device_id: int
:param access_mode: True=exclusive, False=shared
:type access_mode: bool
:returns: true if successful
:rtype: bool | [
"Request",
"exclusive",
"control",
"of",
"device"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L101-L117 | train | Request exclusive control of a specific resource. |
Fire-Proof/cuepy | cuepy/cuepy.py | CorsairSDK.device | def device(self, device_id, *args, **kwargs):
"""
Return a Device object based on id
:param device_id: id of device
:type device_id: int
:param args: extra parameters
:param kwargs: extra parameters
:returns: Device object
:rtype: Device
"""
... | python | def device(self, device_id, *args, **kwargs):
"""
Return a Device object based on id
:param device_id: id of device
:type device_id: int
:param args: extra parameters
:param kwargs: extra parameters
:returns: Device object
:rtype: Device
"""
... | [
"def",
"device",
"(",
"self",
",",
"device_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Device",
"(",
"device_id",
",",
"self",
".",
"corsair_sdk",
",",
"self",
".",
"_corsair_sdk_path",
",",
"*",
"args",
",",
"*",
"*",
"kwarg... | Return a Device object based on id
:param device_id: id of device
:type device_id: int
:param args: extra parameters
:param kwargs: extra parameters
:returns: Device object
:rtype: Device | [
"Return",
"a",
"Device",
"object",
"based",
"on",
"id"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L146-L157 | train | Return a Device object based on id
|
Fire-Proof/cuepy | cuepy/cuepy.py | Device.device_info | def device_info(self, device_id=None):
"""
Return device information, if device_id is not specified, return for this device
:param device_id: id of device
:type device_id: int
:returns: dict containing information about device
:rtype: dict
"""
if device_i... | python | def device_info(self, device_id=None):
"""
Return device information, if device_id is not specified, return for this device
:param device_id: id of device
:type device_id: int
:returns: dict containing information about device
:rtype: dict
"""
if device_i... | [
"def",
"device_info",
"(",
"self",
",",
"device_id",
"=",
"None",
")",
":",
"if",
"device_id",
"is",
"None",
":",
"device_id",
"=",
"self",
".",
"device_id",
"return",
"get_device_info",
"(",
"self",
".",
"corsair_sdk",
",",
"device_id",
")"
] | Return device information, if device_id is not specified, return for this device
:param device_id: id of device
:type device_id: int
:returns: dict containing information about device
:rtype: dict | [
"Return",
"device",
"information",
"if",
"device_id",
"is",
"not",
"specified",
"return",
"for",
"this",
"device"
] | 5add7d62a31589bcdc7d2103c9c482bf718556ec | https://github.com/Fire-Proof/cuepy/blob/5add7d62a31589bcdc7d2103c9c482bf718556ec/cuepy/cuepy.py#L187-L198 | train | Return device information for a specific device_id |
thespacedoctor/HMpTy | HMpTy/htm/sets.py | sets._extract_all_sets_from_list | def _extract_all_sets_from_list(
self):
"""*Extract all of the sets from the list of coordinates*
**Return:**
- ``allMatches`` -- a list of lists. All of the assocaited sets of sources
"""
self.log.debug('starting the ``_extract_all_sets_from_list`` method')
... | python | def _extract_all_sets_from_list(
self):
"""*Extract all of the sets from the list of coordinates*
**Return:**
- ``allMatches`` -- a list of lists. All of the assocaited sets of sources
"""
self.log.debug('starting the ``_extract_all_sets_from_list`` method')
... | [
"def",
"_extract_all_sets_from_list",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'starting the ``_extract_all_sets_from_list`` method'",
")",
"from",
"HMpTy",
"import",
"HTM",
"mesh",
"=",
"HTM",
"(",
"depth",
"=",
"12",
",",
"log",
"=",
"s... | *Extract all of the sets from the list of coordinates*
**Return:**
- ``allMatches`` -- a list of lists. All of the assocaited sets of sources | [
"*",
"Extract",
"all",
"of",
"the",
"sets",
"from",
"the",
"list",
"of",
"coordinates",
"*"
] | 3ce2bdb7ce3351468962ab907ede9a6074c15912 | https://github.com/thespacedoctor/HMpTy/blob/3ce2bdb7ce3351468962ab907ede9a6074c15912/HMpTy/htm/sets.py#L88-L130 | train | This method extracts all of the sets from the list of coordinates and returns a list of lists. |
Kortemme-Lab/klab | klab/bio/uniprot.py | get_obsolete_acc_to_uniparc | def get_obsolete_acc_to_uniparc(acc):
''' Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map.
:param acc: The UniProt accession number.
:return: The corresponding UniParc ID.
Warning: This is a fragile function as the underlying website generation ... | python | def get_obsolete_acc_to_uniparc(acc):
''' Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map.
:param acc: The UniProt accession number.
:return: The corresponding UniParc ID.
Warning: This is a fragile function as the underlying website generation ... | [
"def",
"get_obsolete_acc_to_uniparc",
"(",
"acc",
")",
":",
"contents",
"=",
"http_get",
"(",
"'www.uniprot.org/uniparc/?query={0}'",
".",
"format",
"(",
"acc",
")",
")",
"mtchs",
"=",
"re",
".",
"findall",
"(",
"r'\"UPI[A-Z0-9]+?\"'",
",",
"contents",
",",
"re"... | Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map.
:param acc: The UniProt accession number.
:return: The corresponding UniParc ID.
Warning: This is a fragile function as the underlying website generation or URL could change. | [
"Tries",
"to",
"determine",
"the",
"UniParc",
"ID",
"for",
"obsolete",
"ACCs",
"which",
"are",
"not",
"returned",
"using",
"uniprot_map",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L34-L49 | train | Tries to determine the UniParc ID for obsolete ACCs which are not returned using uniprot_map. |
Kortemme-Lab/klab | klab/bio/uniprot.py | uniprot_map | def uniprot_map(from_scheme, to_scheme, list_of_from_ids, cache_dir = None, silent = True):
'''Maps from one ID scheme to another using the UniProt service.
list_of_ids should be a list of strings.
This function was adapted from http://www.uniprot.org/faq/28#id_mapping_examples which also gives exam... | python | def uniprot_map(from_scheme, to_scheme, list_of_from_ids, cache_dir = None, silent = True):
'''Maps from one ID scheme to another using the UniProt service.
list_of_ids should be a list of strings.
This function was adapted from http://www.uniprot.org/faq/28#id_mapping_examples which also gives exam... | [
"def",
"uniprot_map",
"(",
"from_scheme",
",",
"to_scheme",
",",
"list_of_from_ids",
",",
"cache_dir",
"=",
"None",
",",
"silent",
"=",
"True",
")",
":",
"try",
":",
"assert",
"(",
"hasattr",
"(",
"list_of_from_ids",
",",
"'__iter__'",
")",
")",
"except",
... | Maps from one ID scheme to another using the UniProt service.
list_of_ids should be a list of strings.
This function was adapted from http://www.uniprot.org/faq/28#id_mapping_examples which also gives examples of
valid values for from_scheme and to_scheme.
Note that some conversions are ... | [
"Maps",
"from",
"one",
"ID",
"scheme",
"to",
"another",
"using",
"the",
"UniProt",
"service",
".",
"list_of_ids",
"should",
"be",
"a",
"list",
"of",
"strings",
".",
"This",
"function",
"was",
"adapted",
"from",
"http",
":",
"//",
"www",
".",
"uniprot",
"... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L52-L122 | train | Maps from one ID scheme to another using UniProt service. |
Kortemme-Lab/klab | klab/bio/uniprot.py | pdb_to_uniparc | def pdb_to_uniparc(pdb_ids, silent = True, cache_dir = None, manual_additions = {}):
''' Returns a mapping {PDB ID -> List(UniParcEntry)}
The UniParcEntry objects have a to_dict() method which may be useful.
'''
# Map PDB IDs to UniProtKB AC
if not silent:
colortext.write("Retrieving PD... | python | def pdb_to_uniparc(pdb_ids, silent = True, cache_dir = None, manual_additions = {}):
''' Returns a mapping {PDB ID -> List(UniParcEntry)}
The UniParcEntry objects have a to_dict() method which may be useful.
'''
# Map PDB IDs to UniProtKB AC
if not silent:
colortext.write("Retrieving PD... | [
"def",
"pdb_to_uniparc",
"(",
"pdb_ids",
",",
"silent",
"=",
"True",
",",
"cache_dir",
"=",
"None",
",",
"manual_additions",
"=",
"{",
"}",
")",
":",
"# Map PDB IDs to UniProtKB AC",
"if",
"not",
"silent",
":",
"colortext",
".",
"write",
"(",
"\"Retrieving PDB... | Returns a mapping {PDB ID -> List(UniParcEntry)}
The UniParcEntry objects have a to_dict() method which may be useful. | [
"Returns",
"a",
"mapping",
"{",
"PDB",
"ID",
"-",
">",
"List",
"(",
"UniParcEntry",
")",
"}",
"The",
"UniParcEntry",
"objects",
"have",
"a",
"to_dict",
"()",
"method",
"which",
"may",
"be",
"useful",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L124-L187 | train | Returns a mapping from PDB IDs to UniProtKB UniParc IDs. |
Kortemme-Lab/klab | klab/bio/uniprot.py | get_common_PDB_IDs | def get_common_PDB_IDs(pdb_id, cache_dir = None, exception_on_failure = True):
'''This function takes a PDB ID, maps it to UniProt ACCs, then returns the common set of PDB IDs related to those ACCs.
The purpose is to find any PDB files related to pdb_id, particularly for complexes, such that the other PDB fi... | python | def get_common_PDB_IDs(pdb_id, cache_dir = None, exception_on_failure = True):
'''This function takes a PDB ID, maps it to UniProt ACCs, then returns the common set of PDB IDs related to those ACCs.
The purpose is to find any PDB files related to pdb_id, particularly for complexes, such that the other PDB fi... | [
"def",
"get_common_PDB_IDs",
"(",
"pdb_id",
",",
"cache_dir",
"=",
"None",
",",
"exception_on_failure",
"=",
"True",
")",
":",
"m",
"=",
"pdb_to_uniparc",
"(",
"[",
"pdb_id",
"]",
",",
"cache_dir",
"=",
"cache_dir",
")",
"UniProtACs",
"=",
"[",
"]",
"if",
... | This function takes a PDB ID, maps it to UniProt ACCs, then returns the common set of PDB IDs related to those ACCs.
The purpose is to find any PDB files related to pdb_id, particularly for complexes, such that the other PDB files
contain identical sequences or mutant complexes. | [
"This",
"function",
"takes",
"a",
"PDB",
"ID",
"maps",
"it",
"to",
"UniProt",
"ACCs",
"then",
"returns",
"the",
"common",
"set",
"of",
"PDB",
"IDs",
"related",
"to",
"those",
"ACCs",
".",
"The",
"purpose",
"is",
"to",
"find",
"any",
"PDB",
"files",
"re... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L892-L915 | train | This function takes a PDB ID maps it to UniProt ACCs then returns the common set of PDB IDs related to those ACCs. |
Kortemme-Lab/klab | klab/bio/uniprot.py | UniProtACEntry._parse_sequence_tag | def _parse_sequence_tag(self):
'''Parses the sequence and atomic mass.'''
#main_tags = self._dom.getElementsByTagName("uniprot")
#assert(len(main_tags) == 1)
#entry_tags = main_tags[0].getElementsByTagName("entry")
#assert(len(entry_tags) == 1)
#entry_tags[0]
ent... | python | def _parse_sequence_tag(self):
'''Parses the sequence and atomic mass.'''
#main_tags = self._dom.getElementsByTagName("uniprot")
#assert(len(main_tags) == 1)
#entry_tags = main_tags[0].getElementsByTagName("entry")
#assert(len(entry_tags) == 1)
#entry_tags[0]
ent... | [
"def",
"_parse_sequence_tag",
"(",
"self",
")",
":",
"#main_tags = self._dom.getElementsByTagName(\"uniprot\")",
"#assert(len(main_tags) == 1)",
"#entry_tags = main_tags[0].getElementsByTagName(\"entry\")",
"#assert(len(entry_tags) == 1)",
"#entry_tags[0]",
"entry_tag",
"=",
"self",
".",... | Parses the sequence and atomic mass. | [
"Parses",
"the",
"sequence",
"and",
"atomic",
"mass",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L542-L560 | train | Parses the sequence and atomic mass. |
Kortemme-Lab/klab | klab/bio/uniprot.py | UniProtACEntry._parse_organism_tag | def _parse_organism_tag(self):
'''Parses the protein tag to get the names and EC numbers.'''
organism_name_types = UniProtACEntry.organism_name_types
self.organisms = []
organism_tags = [child for child in self.entry_tag.childNodes if child.nodeType == child.ELEMENT_NODE and child.tagNam... | python | def _parse_organism_tag(self):
'''Parses the protein tag to get the names and EC numbers.'''
organism_name_types = UniProtACEntry.organism_name_types
self.organisms = []
organism_tags = [child for child in self.entry_tag.childNodes if child.nodeType == child.ELEMENT_NODE and child.tagNam... | [
"def",
"_parse_organism_tag",
"(",
"self",
")",
":",
"organism_name_types",
"=",
"UniProtACEntry",
".",
"organism_name_types",
"self",
".",
"organisms",
"=",
"[",
"]",
"organism_tags",
"=",
"[",
"child",
"for",
"child",
"in",
"self",
".",
"entry_tag",
".",
"ch... | Parses the protein tag to get the names and EC numbers. | [
"Parses",
"the",
"protein",
"tag",
"to",
"get",
"the",
"names",
"and",
"EC",
"numbers",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L562-L575 | train | Parses the protein tag to get the names and EC numbers. |
Kortemme-Lab/klab | klab/bio/uniprot.py | UniProtACEntry._parse_protein_tag | def _parse_protein_tag(self):
'''Parses the protein tag to get the names and EC numbers.'''
protein_nodes = self._dom.getElementsByTagName('protein')
assert(len(protein_nodes) == 1)
self.protein_node = protein_nodes[0]
self._get_recommended_name()
self._get_submitted_na... | python | def _parse_protein_tag(self):
'''Parses the protein tag to get the names and EC numbers.'''
protein_nodes = self._dom.getElementsByTagName('protein')
assert(len(protein_nodes) == 1)
self.protein_node = protein_nodes[0]
self._get_recommended_name()
self._get_submitted_na... | [
"def",
"_parse_protein_tag",
"(",
"self",
")",
":",
"protein_nodes",
"=",
"self",
".",
"_dom",
".",
"getElementsByTagName",
"(",
"'protein'",
")",
"assert",
"(",
"len",
"(",
"protein_nodes",
")",
"==",
"1",
")",
"self",
".",
"protein_node",
"=",
"protein_nod... | Parses the protein tag to get the names and EC numbers. | [
"Parses",
"the",
"protein",
"tag",
"to",
"get",
"the",
"names",
"and",
"EC",
"numbers",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L577-L586 | train | Parses the protein tag to get the names and EC numbers. |
joe513/django-cool-pagination | django_cool_paginator/templatetags/cool_paginate.py | cool_paginate | def cool_paginate(context, **kwargs) -> dict:
"""Main function for pagination process."""
names = (
'size',
'next_name',
'previous_name',
'elastic',
'page_obj',
)
return_dict = {name: value for name, value in zip(names, map(kwargs.get, names))}
if context.g... | python | def cool_paginate(context, **kwargs) -> dict:
"""Main function for pagination process."""
names = (
'size',
'next_name',
'previous_name',
'elastic',
'page_obj',
)
return_dict = {name: value for name, value in zip(names, map(kwargs.get, names))}
if context.g... | [
"def",
"cool_paginate",
"(",
"context",
",",
"*",
"*",
"kwargs",
")",
"->",
"dict",
":",
"names",
"=",
"(",
"'size'",
",",
"'next_name'",
",",
"'previous_name'",
",",
"'elastic'",
",",
"'page_obj'",
",",
")",
"return_dict",
"=",
"{",
"name",
":",
"value"... | Main function for pagination process. | [
"Main",
"function",
"for",
"pagination",
"process",
"."
] | ed75a151a016aef0f5216fdb1e3610597872a3ef | https://github.com/joe513/django-cool-pagination/blob/ed75a151a016aef0f5216fdb1e3610597872a3ef/django_cool_paginator/templatetags/cool_paginate.py#L32-L65 | train | Main function for pagination process. |
projectshift/shift-boiler | boiler/timer/restart_timer.py | time_restarts | def time_restarts(data_path):
""" When called will create a file and measure its mtime on restarts """
path = os.path.join(data_path, 'last_restarted')
if not os.path.isfile(path):
with open(path, 'a'):
os.utime(path, None)
last_modified = os.stat(path).st_mtime
with open(path,... | python | def time_restarts(data_path):
""" When called will create a file and measure its mtime on restarts """
path = os.path.join(data_path, 'last_restarted')
if not os.path.isfile(path):
with open(path, 'a'):
os.utime(path, None)
last_modified = os.stat(path).st_mtime
with open(path,... | [
"def",
"time_restarts",
"(",
"data_path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_path",
",",
"'last_restarted'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
... | When called will create a file and measure its mtime on restarts | [
"When",
"called",
"will",
"create",
"a",
"file",
"and",
"measure",
"its",
"mtime",
"on",
"restarts"
] | 8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b | https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/timer/restart_timer.py#L6-L22 | train | When called will create a file and measure its mtime on restarts |
MacHu-GWU/sqlalchemy_mate-project | sqlalchemy_mate/pt.py | from_stmt | def from_stmt(stmt, engine, **kwargs):
"""
Execute a query in form of texture clause, return the result in form of
:class:`PrettyTable`.
:type stmt: TextClause
:param stmt:
:type engine: Engine
:param engine:
:rtype: PrettyTable
"""
result_proxy = engine.execute(stmt, **kwarg... | python | def from_stmt(stmt, engine, **kwargs):
"""
Execute a query in form of texture clause, return the result in form of
:class:`PrettyTable`.
:type stmt: TextClause
:param stmt:
:type engine: Engine
:param engine:
:rtype: PrettyTable
"""
result_proxy = engine.execute(stmt, **kwarg... | [
"def",
"from_stmt",
"(",
"stmt",
",",
"engine",
",",
"*",
"*",
"kwargs",
")",
":",
"result_proxy",
"=",
"engine",
".",
"execute",
"(",
"stmt",
",",
"*",
"*",
"kwargs",
")",
"return",
"from_db_cursor",
"(",
"result_proxy",
".",
"cursor",
")"
] | Execute a query in form of texture clause, return the result in form of
:class:`PrettyTable`.
:type stmt: TextClause
:param stmt:
:type engine: Engine
:param engine:
:rtype: PrettyTable | [
"Execute",
"a",
"query",
"in",
"form",
"of",
"texture",
"clause",
"return",
"the",
"result",
"in",
"form",
"of"
] | 946754744c8870f083fd7b4339fca15d1d6128b2 | https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/pt.py#L34-L49 | train | Execute a query in form of texture clause return the result in form of
:class : PrettyTable. |
MacHu-GWU/sqlalchemy_mate-project | sqlalchemy_mate/pt.py | from_sql | def from_sql(sql, engine, limit=None, **kwargs):
"""
Create a :class:`prettytable.PrettyTable` from :class:`sqlalchemy.select`.
:type sql: Select
:param sql: a ``sqlalchemy.sql.selectable.Select`` object.
:type engine: Engine
:param engine: an ``sqlalchemy.engine.base.Engine`` object.
:ty... | python | def from_sql(sql, engine, limit=None, **kwargs):
"""
Create a :class:`prettytable.PrettyTable` from :class:`sqlalchemy.select`.
:type sql: Select
:param sql: a ``sqlalchemy.sql.selectable.Select`` object.
:type engine: Engine
:param engine: an ``sqlalchemy.engine.base.Engine`` object.
:ty... | [
"def",
"from_sql",
"(",
"sql",
",",
"engine",
",",
"limit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"limit",
"is",
"not",
"None",
":",
"sql",
"=",
"sql",
".",
"limit",
"(",
"limit",
")",
"result_proxy",
"=",
"engine",
".",
"execute",
... | Create a :class:`prettytable.PrettyTable` from :class:`sqlalchemy.select`.
:type sql: Select
:param sql: a ``sqlalchemy.sql.selectable.Select`` object.
:type engine: Engine
:param engine: an ``sqlalchemy.engine.base.Engine`` object.
:type limit: int
:param limit: int, limit rows to return.
... | [
"Create",
"a",
":",
"class",
":",
"prettytable",
".",
"PrettyTable",
"from",
":",
"class",
":",
"sqlalchemy",
".",
"select",
"."
] | 946754744c8870f083fd7b4339fca15d1d6128b2 | https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/pt.py#L52-L81 | train | Create a PrettyTable from a sqlalchemy. select. Select object. |
MacHu-GWU/sqlalchemy_mate-project | sqlalchemy_mate/pt.py | from_query | def from_query(query, engine_or_session=None, limit=None, **kwargs):
"""
Execute an ORM style query, and return the result in
:class:`prettytable.PrettyTable`.
:type query: Query
:param query: an ``sqlalchemy.orm.Query`` object.
:type engine: Any
:param engine: query is always associated w... | python | def from_query(query, engine_or_session=None, limit=None, **kwargs):
"""
Execute an ORM style query, and return the result in
:class:`prettytable.PrettyTable`.
:type query: Query
:param query: an ``sqlalchemy.orm.Query`` object.
:type engine: Any
:param engine: query is always associated w... | [
"def",
"from_query",
"(",
"query",
",",
"engine_or_session",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"limit",
"is",
"not",
"None",
":",
"query",
"=",
"query",
".",
"limit",
"(",
"limit",
")",
"result_proxy",
"... | Execute an ORM style query, and return the result in
:class:`prettytable.PrettyTable`.
:type query: Query
:param query: an ``sqlalchemy.orm.Query`` object.
:type engine: Any
:param engine: query is always associated with a session, this parameter
just reserve the arg place.
:type limi... | [
"Execute",
"an",
"ORM",
"style",
"query",
"and",
"return",
"the",
"result",
"in",
":",
"class",
":",
"prettytable",
".",
"PrettyTable",
"."
] | 946754744c8870f083fd7b4339fca15d1d6128b2 | https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/pt.py#L84-L109 | train | Execute an SQLAlchemy query and return the result as a PrettyTable object. |
MacHu-GWU/sqlalchemy_mate-project | sqlalchemy_mate/pt.py | from_object | def from_object(orm_class, engine_or_session, limit=None, **kwargs):
"""
Select data from the table defined by a ORM class, and put into prettytable
:param orm_class: an orm class inherit from
``sqlalchemy.ext.declarative.declarative_base()``
:type engine_or_session: Union[Engine, Session]
... | python | def from_object(orm_class, engine_or_session, limit=None, **kwargs):
"""
Select data from the table defined by a ORM class, and put into prettytable
:param orm_class: an orm class inherit from
``sqlalchemy.ext.declarative.declarative_base()``
:type engine_or_session: Union[Engine, Session]
... | [
"def",
"from_object",
"(",
"orm_class",
",",
"engine_or_session",
",",
"limit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ses",
",",
"auto_close",
"=",
"ensure_session",
"(",
"engine_or_session",
")",
"query",
"=",
"ses",
".",
"query",
"(",
"orm_cla... | Select data from the table defined by a ORM class, and put into prettytable
:param orm_class: an orm class inherit from
``sqlalchemy.ext.declarative.declarative_base()``
:type engine_or_session: Union[Engine, Session]
:param engine_or_session: the engine or session used to execute the query.
... | [
"Select",
"data",
"from",
"the",
"table",
"defined",
"by",
"a",
"ORM",
"class",
"and",
"put",
"into",
"prettytable"
] | 946754744c8870f083fd7b4339fca15d1d6128b2 | https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/pt.py#L140-L169 | train | Create a PrettyTable from an object. |
MacHu-GWU/sqlalchemy_mate-project | sqlalchemy_mate/pt.py | from_everything | def from_everything(everything, engine_or_session, limit=None, **kwargs):
"""
Construct a Prettytable from any kinds of sqlalchemy query.
:type engine_or_session: Union[Engine, Session]
:rtype: PrettyTable
Usage::
from sqlalchemy import select
sql = select([t_user])
prin... | python | def from_everything(everything, engine_or_session, limit=None, **kwargs):
"""
Construct a Prettytable from any kinds of sqlalchemy query.
:type engine_or_session: Union[Engine, Session]
:rtype: PrettyTable
Usage::
from sqlalchemy import select
sql = select([t_user])
prin... | [
"def",
"from_everything",
"(",
"everything",
",",
"engine_or_session",
",",
"limit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"everything",
",",
"TextClause",
")",
":",
"return",
"from_stmt",
"(",
"everything",
",",
"engine_or... | Construct a Prettytable from any kinds of sqlalchemy query.
:type engine_or_session: Union[Engine, Session]
:rtype: PrettyTable
Usage::
from sqlalchemy import select
sql = select([t_user])
print(from_everything(sql, engine))
query = session.query(User)
print(fro... | [
"Construct",
"a",
"Prettytable",
"from",
"any",
"kinds",
"of",
"sqlalchemy",
"query",
"."
] | 946754744c8870f083fd7b4339fca15d1d6128b2 | https://github.com/MacHu-GWU/sqlalchemy_mate-project/blob/946754744c8870f083fd7b4339fca15d1d6128b2/sqlalchemy_mate/pt.py#L197-L236 | train | Construct a Prettytable from any kinds of sqlalchemy query. |
tech-pi/doufo | src/python/doufo/tensor/matrix.py | Matrix.one_hot | def one_hot(cls, ij, sz):
"""
ij: postion
sz: size of matrix
"""
if isinstance(sz, int):
sz = (sz, sz)
if isinstance(ij, int):
ij = (ij, ij)
m = np.zeros(sz)
m[ij[0], ij[1]] = 1.0
return Matrix(m) | python | def one_hot(cls, ij, sz):
"""
ij: postion
sz: size of matrix
"""
if isinstance(sz, int):
sz = (sz, sz)
if isinstance(ij, int):
ij = (ij, ij)
m = np.zeros(sz)
m[ij[0], ij[1]] = 1.0
return Matrix(m) | [
"def",
"one_hot",
"(",
"cls",
",",
"ij",
",",
"sz",
")",
":",
"if",
"isinstance",
"(",
"sz",
",",
"int",
")",
":",
"sz",
"=",
"(",
"sz",
",",
"sz",
")",
"if",
"isinstance",
"(",
"ij",
",",
"int",
")",
":",
"ij",
"=",
"(",
"ij",
",",
"ij",
... | ij: postion
sz: size of matrix | [
"ij",
":",
"postion",
"sz",
":",
"size",
"of",
"matrix"
] | 3d375fef30670597768a6eef809b75b4b1b5a3fd | https://github.com/tech-pi/doufo/blob/3d375fef30670597768a6eef809b75b4b1b5a3fd/src/python/doufo/tensor/matrix.py#L38-L49 | train | create a matrix that contains one hot entries for the given entry |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | _full_analysis_mp_alias | def _full_analysis_mp_alias(br_obj, analysis_set, output_directory, unique_name, verbose, quick_plots):
"""
Alias for instance method that allows the method to be called in a
multiprocessing pool. Needed as multiprocessing does not otherwise work
on object instance methods.
"""
return (br_obj, u... | python | def _full_analysis_mp_alias(br_obj, analysis_set, output_directory, unique_name, verbose, quick_plots):
"""
Alias for instance method that allows the method to be called in a
multiprocessing pool. Needed as multiprocessing does not otherwise work
on object instance methods.
"""
return (br_obj, u... | [
"def",
"_full_analysis_mp_alias",
"(",
"br_obj",
",",
"analysis_set",
",",
"output_directory",
",",
"unique_name",
",",
"verbose",
",",
"quick_plots",
")",
":",
"return",
"(",
"br_obj",
",",
"unique_name",
",",
"br_obj",
".",
"full_analysis",
"(",
"analysis_set",
... | Alias for instance method that allows the method to be called in a
multiprocessing pool. Needed as multiprocessing does not otherwise work
on object instance methods. | [
"Alias",
"for",
"instance",
"method",
"that",
"allows",
"the",
"method",
"to",
"be",
"called",
"in",
"a",
"multiprocessing",
"pool",
".",
"Needed",
"as",
"multiprocessing",
"does",
"not",
"otherwise",
"work",
"on",
"object",
"instance",
"methods",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2235-L2241 | train | Alias for full_analysis in multiprocessing pool. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | _compare_mp_alias | def _compare_mp_alias(br_i, br_j, analysis_set, analysis_set_subdir, unique_ajps, verbose):
"""
Alias for instance method that allows the method to be called in a
multiprocessing pool. Needed as multiprocessing does not otherwise work
on object instance methods.
"""
return br_i.compare(br_j, ana... | python | def _compare_mp_alias(br_i, br_j, analysis_set, analysis_set_subdir, unique_ajps, verbose):
"""
Alias for instance method that allows the method to be called in a
multiprocessing pool. Needed as multiprocessing does not otherwise work
on object instance methods.
"""
return br_i.compare(br_j, ana... | [
"def",
"_compare_mp_alias",
"(",
"br_i",
",",
"br_j",
",",
"analysis_set",
",",
"analysis_set_subdir",
",",
"unique_ajps",
",",
"verbose",
")",
":",
"return",
"br_i",
".",
"compare",
"(",
"br_j",
",",
"analysis_set",
",",
"analysis_set_subdir",
",",
"unique_ajps... | Alias for instance method that allows the method to be called in a
multiprocessing pool. Needed as multiprocessing does not otherwise work
on object instance methods. | [
"Alias",
"for",
"instance",
"method",
"that",
"allows",
"the",
"method",
"to",
"be",
"called",
"in",
"a",
"multiprocessing",
"pool",
".",
"Needed",
"as",
"multiprocessing",
"does",
"not",
"otherwise",
"work",
"on",
"object",
"instance",
"methods",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2244-L2250 | train | Alias for instance method that allows the method to be called in multiprocessing pool. Needed as multiprocessing does not allow the method to be called in multiprocessing pool. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.filter_data | def filter_data(self):
'''A very rough filtering step to remove certain data.
todo: It is probably best to do this do the actual dataframe rather than at this point.
todo: We currently only handle one filtering criterium.
'''
if not self.dataset_cases or not self.analysis_... | python | def filter_data(self):
'''A very rough filtering step to remove certain data.
todo: It is probably best to do this do the actual dataframe rather than at this point.
todo: We currently only handle one filtering criterium.
'''
if not self.dataset_cases or not self.analysis_... | [
"def",
"filter_data",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"dataset_cases",
"or",
"not",
"self",
".",
"analysis_data",
":",
"# colortext.error('No dataset cases or analysis (DDG) data were passed. Cannot filter the data. If you are using an existing dataframe, this may ... | A very rough filtering step to remove certain data.
todo: It is probably best to do this do the actual dataframe rather than at this point.
todo: We currently only handle one filtering criterium. | [
"A",
"very",
"rough",
"filtering",
"step",
"to",
"remove",
"certain",
"data",
".",
"todo",
":",
"It",
"is",
"probably",
"best",
"to",
"do",
"this",
"do",
"the",
"actual",
"dataframe",
"rather",
"than",
"at",
"this",
"point",
".",
"todo",
":",
"We",
"cu... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L175-L215 | train | A very rough filtering step to remove certain data. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.create_dataframe | def create_dataframe(self, pdb_data = {}, verbose = True):
'''This function creates a dataframe (a matrix with one row per dataset record and one column for fields of interest)
from the benchmark run and the dataset data.
For rows with multiple mutations, there may be multiple values for s... | python | def create_dataframe(self, pdb_data = {}, verbose = True):
'''This function creates a dataframe (a matrix with one row per dataset record and one column for fields of interest)
from the benchmark run and the dataset data.
For rows with multiple mutations, there may be multiple values for s... | [
"def",
"create_dataframe",
"(",
"self",
",",
"pdb_data",
"=",
"{",
"}",
",",
"verbose",
"=",
"True",
")",
":",
"if",
"self",
".",
"use_existing_benchmark_data",
"and",
"self",
".",
"store_data_on_disk",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"self",... | This function creates a dataframe (a matrix with one row per dataset record and one column for fields of interest)
from the benchmark run and the dataset data.
For rows with multiple mutations, there may be multiple values for some fields e.g. wildtype residue exposure.
We take the appr... | [
"This",
"function",
"creates",
"a",
"dataframe",
"(",
"a",
"matrix",
"with",
"one",
"row",
"per",
"dataset",
"record",
"and",
"one",
"column",
"for",
"fields",
"of",
"interest",
")",
"from",
"the",
"benchmark",
"run",
"and",
"the",
"dataset",
"data",
".",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L464-L570 | train | This function creates a dataframe from the benchmark run and the dataset data. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.compute_stability_classification | def compute_stability_classification(self, predicted_data, record, dataframe_record):
'''Calculate the stability classification for this case.'''
stability_classification, stability_classication_x_cutoff, stability_classication_y_cutoff = None, self.stability_classication_x_cutoff, self.stability_classi... | python | def compute_stability_classification(self, predicted_data, record, dataframe_record):
'''Calculate the stability classification for this case.'''
stability_classification, stability_classication_x_cutoff, stability_classication_y_cutoff = None, self.stability_classication_x_cutoff, self.stability_classi... | [
"def",
"compute_stability_classification",
"(",
"self",
",",
"predicted_data",
",",
"record",
",",
"dataframe_record",
")",
":",
"stability_classification",
",",
"stability_classication_x_cutoff",
",",
"stability_classication_y_cutoff",
"=",
"None",
",",
"self",
".",
"sta... | Calculate the stability classification for this case. | [
"Calculate",
"the",
"stability",
"classification",
"for",
"this",
"case",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L595-L602 | train | Calculate the stability classification for this case. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.compute_absolute_error | def compute_absolute_error(self, predicted_data, record, dataframe_record):
'''Calculate the absolute error for this case.'''
absolute_error = abs(record['DDG'] - predicted_data[self.ddg_analysis_type])
dataframe_record['AbsoluteError'] = absolute_error | python | def compute_absolute_error(self, predicted_data, record, dataframe_record):
'''Calculate the absolute error for this case.'''
absolute_error = abs(record['DDG'] - predicted_data[self.ddg_analysis_type])
dataframe_record['AbsoluteError'] = absolute_error | [
"def",
"compute_absolute_error",
"(",
"self",
",",
"predicted_data",
",",
"record",
",",
"dataframe_record",
")",
":",
"absolute_error",
"=",
"abs",
"(",
"record",
"[",
"'DDG'",
"]",
"-",
"predicted_data",
"[",
"self",
".",
"ddg_analysis_type",
"]",
")",
"data... | Calculate the absolute error for this case. | [
"Calculate",
"the",
"absolute",
"error",
"for",
"this",
"case",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L605-L608 | train | Calculate the absolute error for this case. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.count_residues | def count_residues(self, record, pdb_record):
'''Count the number of residues in the chains for the case.'''
mutations = self.get_record_mutations(record)
pdb_chains = set([m['Chain'] for m in mutations])
assert(len(pdb_chains) == 1) # we expect monomeric cases
pdb_chain = pdb_ch... | python | def count_residues(self, record, pdb_record):
'''Count the number of residues in the chains for the case.'''
mutations = self.get_record_mutations(record)
pdb_chains = set([m['Chain'] for m in mutations])
assert(len(pdb_chains) == 1) # we expect monomeric cases
pdb_chain = pdb_ch... | [
"def",
"count_residues",
"(",
"self",
",",
"record",
",",
"pdb_record",
")",
":",
"mutations",
"=",
"self",
".",
"get_record_mutations",
"(",
"record",
")",
"pdb_chains",
"=",
"set",
"(",
"[",
"m",
"[",
"'Chain'",
"]",
"for",
"m",
"in",
"mutations",
"]",... | Count the number of residues in the chains for the case. | [
"Count",
"the",
"number",
"of",
"residues",
"in",
"the",
"chains",
"for",
"the",
"case",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L615-L621 | train | Count the number of residues in the chains for the case. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.get_dataframe_row | def get_dataframe_row(self, dataset_cases, predicted_data, pdb_data, record_id, additional_prediction_data_columns):
'''Create a dataframe row for a prediction.'''
# Ignore derived mutations if appropriate
record = dataset_cases[record_id]
if self.is_this_record_a_derived_mutation(recor... | python | def get_dataframe_row(self, dataset_cases, predicted_data, pdb_data, record_id, additional_prediction_data_columns):
'''Create a dataframe row for a prediction.'''
# Ignore derived mutations if appropriate
record = dataset_cases[record_id]
if self.is_this_record_a_derived_mutation(recor... | [
"def",
"get_dataframe_row",
"(",
"self",
",",
"dataset_cases",
",",
"predicted_data",
",",
"pdb_data",
",",
"record_id",
",",
"additional_prediction_data_columns",
")",
":",
"# Ignore derived mutations if appropriate",
"record",
"=",
"dataset_cases",
"[",
"record_id",
"]"... | Create a dataframe row for a prediction. | [
"Create",
"a",
"dataframe",
"row",
"for",
"a",
"prediction",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L624-L776 | train | Create a dataframe row for a prediction. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.analyze_all | def analyze_all(self, analysis_directory = None):
'''This function runs the analysis and creates the plots and summary file.'''
for analysis_set in self.analysis_sets:
self.analyze(analysis_set, analysis_directory = analysis_directory) | python | def analyze_all(self, analysis_directory = None):
'''This function runs the analysis and creates the plots and summary file.'''
for analysis_set in self.analysis_sets:
self.analyze(analysis_set, analysis_directory = analysis_directory) | [
"def",
"analyze_all",
"(",
"self",
",",
"analysis_directory",
"=",
"None",
")",
":",
"for",
"analysis_set",
"in",
"self",
".",
"analysis_sets",
":",
"self",
".",
"analyze",
"(",
"analysis_set",
",",
"analysis_directory",
"=",
"analysis_directory",
")"
] | This function runs the analysis and creates the plots and summary file. | [
"This",
"function",
"runs",
"the",
"analysis",
"and",
"creates",
"the",
"plots",
"and",
"summary",
"file",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L779-L782 | train | This function runs the analysis and creates the plots and summary file. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.analyze | def analyze(self, analysis_set = '', analysis_directory = None):
'''This function runs the analysis and creates the plots and summary file.'''
self.calculate_metrics(analysis_set, analysis_directory = analysis_directory)
if self.generate_plots:
self.plot(analysis_set, analysis_direct... | python | def analyze(self, analysis_set = '', analysis_directory = None):
'''This function runs the analysis and creates the plots and summary file.'''
self.calculate_metrics(analysis_set, analysis_directory = analysis_directory)
if self.generate_plots:
self.plot(analysis_set, analysis_direct... | [
"def",
"analyze",
"(",
"self",
",",
"analysis_set",
"=",
"''",
",",
"analysis_directory",
"=",
"None",
")",
":",
"self",
".",
"calculate_metrics",
"(",
"analysis_set",
",",
"analysis_directory",
"=",
"analysis_directory",
")",
"if",
"self",
".",
"generate_plots"... | This function runs the analysis and creates the plots and summary file. | [
"This",
"function",
"runs",
"the",
"analysis",
"and",
"creates",
"the",
"plots",
"and",
"summary",
"file",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L785-L789 | train | This function runs the analysis and creates the plots and summary file. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.full_analysis | def full_analysis(self, analysis_set, output_directory, verbose = True, compile_pdf = True, quick_plots = False):
'''Combines calculate_metrics, write_dataframe_to_csv, and plot'''
if not os.path.isdir(output_directory):
os.makedirs(output_directory)
self.analysis_directory = output_... | python | def full_analysis(self, analysis_set, output_directory, verbose = True, compile_pdf = True, quick_plots = False):
'''Combines calculate_metrics, write_dataframe_to_csv, and plot'''
if not os.path.isdir(output_directory):
os.makedirs(output_directory)
self.analysis_directory = output_... | [
"def",
"full_analysis",
"(",
"self",
",",
"analysis_set",
",",
"output_directory",
",",
"verbose",
"=",
"True",
",",
"compile_pdf",
"=",
"True",
",",
"quick_plots",
"=",
"False",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"output_director... | Combines calculate_metrics, write_dataframe_to_csv, and plot | [
"Combines",
"calculate_metrics",
"write_dataframe_to_csv",
"and",
"plot"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L792-L801 | train | Combines calculate_metrics write_dataframe_to_csv and plot |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.get_definitive_name | def get_definitive_name(self, unique_ajps, join_character = '-', prepend_label = True):
"""
Generates a definitive name for this benchmark run object, based on
unique additional join parameters (as passed)
"""
name = ''
for ajp in unique_ajps:
if len(name) > 0... | python | def get_definitive_name(self, unique_ajps, join_character = '-', prepend_label = True):
"""
Generates a definitive name for this benchmark run object, based on
unique additional join parameters (as passed)
"""
name = ''
for ajp in unique_ajps:
if len(name) > 0... | [
"def",
"get_definitive_name",
"(",
"self",
",",
"unique_ajps",
",",
"join_character",
"=",
"'-'",
",",
"prepend_label",
"=",
"True",
")",
":",
"name",
"=",
"''",
"for",
"ajp",
"in",
"unique_ajps",
":",
"if",
"len",
"(",
"name",
")",
">",
"0",
":",
"nam... | Generates a definitive name for this benchmark run object, based on
unique additional join parameters (as passed) | [
"Generates",
"a",
"definitive",
"name",
"for",
"this",
"benchmark",
"run",
"object",
"based",
"on",
"unique",
"additional",
"join",
"parameters",
"(",
"as",
"passed",
")"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L804-L818 | train | Generates a definitive name based on the unique AJPS and the additional join parameters. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.get_unique_ajps | def get_unique_ajps( benchmark_runs ):
"""
Determines which join parameters are unique
"""
br_ajps = {}
for br in benchmark_runs:
for ajp in br.additional_join_parameters:
if ajp not in br_ajps:
br_ajps[ajp] = set()
... | python | def get_unique_ajps( benchmark_runs ):
"""
Determines which join parameters are unique
"""
br_ajps = {}
for br in benchmark_runs:
for ajp in br.additional_join_parameters:
if ajp not in br_ajps:
br_ajps[ajp] = set()
... | [
"def",
"get_unique_ajps",
"(",
"benchmark_runs",
")",
":",
"br_ajps",
"=",
"{",
"}",
"for",
"br",
"in",
"benchmark_runs",
":",
"for",
"ajp",
"in",
"br",
".",
"additional_join_parameters",
":",
"if",
"ajp",
"not",
"in",
"br_ajps",
":",
"br_ajps",
"[",
"ajp"... | Determines which join parameters are unique | [
"Determines",
"which",
"join",
"parameters",
"are",
"unique"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L822-L836 | train | Determines which join parameters are unique |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.analyze_multiple | def analyze_multiple(
benchmark_runs,
analysis_sets = [],
# Singleton arguments
analysis_directory = None,
remove_existing_analysis_directory = True,
quick_plots = False,
use_multiprocessing = True,
verbose = True,
... | python | def analyze_multiple(
benchmark_runs,
analysis_sets = [],
# Singleton arguments
analysis_directory = None,
remove_existing_analysis_directory = True,
quick_plots = False,
use_multiprocessing = True,
verbose = True,
... | [
"def",
"analyze_multiple",
"(",
"benchmark_runs",
",",
"analysis_sets",
"=",
"[",
"]",
",",
"# Singleton arguments",
"analysis_directory",
"=",
"None",
",",
"remove_existing_analysis_directory",
"=",
"True",
",",
"quick_plots",
"=",
"False",
",",
"use_multiprocessing",
... | This function runs the analysis for multiple input settings | [
"This",
"function",
"runs",
"the",
"analysis",
"for",
"multiple",
"input",
"settings"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L862-L993 | train | This function runs the analysis for multiple benchmark runs. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.compare | def compare(self, other, analysis_set, output_directory, unique_ajps, verbose = True, compile_pdf = True):
"""
Generate comparison latex report in specified output directory
Returns LatexReport object
"""
self_unique_name = self.get_definitive_name(unique_ajps)
other_uniq... | python | def compare(self, other, analysis_set, output_directory, unique_ajps, verbose = True, compile_pdf = True):
"""
Generate comparison latex report in specified output directory
Returns LatexReport object
"""
self_unique_name = self.get_definitive_name(unique_ajps)
other_uniq... | [
"def",
"compare",
"(",
"self",
",",
"other",
",",
"analysis_set",
",",
"output_directory",
",",
"unique_ajps",
",",
"verbose",
"=",
"True",
",",
"compile_pdf",
"=",
"True",
")",
":",
"self_unique_name",
"=",
"self",
".",
"get_definitive_name",
"(",
"unique_ajp... | Generate comparison latex report in specified output directory
Returns LatexReport object | [
"Generate",
"comparison",
"latex",
"report",
"in",
"specified",
"output",
"directory",
"Returns",
"LatexReport",
"object"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L996-L1092 | train | Generate a comparison latex report for this analysis set and other analysis set. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.calculate_metrics | def calculate_metrics(self, analysis_set = '', analysis_directory = None, drop_missing = True, case_n_cutoff = 5, verbose = True):
'''Calculates the main metrics for the benchmark run and writes them to file and LaTeX object.'''
dataframe = self.dataframe
if drop_missing:
dataframe ... | python | def calculate_metrics(self, analysis_set = '', analysis_directory = None, drop_missing = True, case_n_cutoff = 5, verbose = True):
'''Calculates the main metrics for the benchmark run and writes them to file and LaTeX object.'''
dataframe = self.dataframe
if drop_missing:
dataframe ... | [
"def",
"calculate_metrics",
"(",
"self",
",",
"analysis_set",
"=",
"''",
",",
"analysis_directory",
"=",
"None",
",",
"drop_missing",
"=",
"True",
",",
"case_n_cutoff",
"=",
"5",
",",
"verbose",
"=",
"True",
")",
":",
"dataframe",
"=",
"self",
".",
"datafr... | Calculates the main metrics for the benchmark run and writes them to file and LaTeX object. | [
"Calculates",
"the",
"main",
"metrics",
"for",
"the",
"benchmark",
"run",
"and",
"writes",
"them",
"to",
"file",
"and",
"LaTeX",
"object",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L1188-L1459 | train | Calculates the main metrics for the benchmark run and writes them to file and LaTeX object. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.determine_optimum_fraction_correct_cutoffs | def determine_optimum_fraction_correct_cutoffs(self, analysis_set, dataframe, stability_classication_x_cutoff):
'''Determines the value of stability_classication_y_cutoff which approximately maximizes the fraction correct
measurement w.r.t. a fixed stability_classication_x_cutoff. This function uses ... | python | def determine_optimum_fraction_correct_cutoffs(self, analysis_set, dataframe, stability_classication_x_cutoff):
'''Determines the value of stability_classication_y_cutoff which approximately maximizes the fraction correct
measurement w.r.t. a fixed stability_classication_x_cutoff. This function uses ... | [
"def",
"determine_optimum_fraction_correct_cutoffs",
"(",
"self",
",",
"analysis_set",
",",
"dataframe",
",",
"stability_classication_x_cutoff",
")",
":",
"# Determine the value for the fraction correct y-value (predicted) cutoff which will approximately yield the",
"# maximum fraction-cor... | Determines the value of stability_classication_y_cutoff which approximately maximizes the fraction correct
measurement w.r.t. a fixed stability_classication_x_cutoff. This function uses discrete sampling and so it
may miss the actual maximum. We use two rounds of sampling: i) a coarse-grained samp... | [
"Determines",
"the",
"value",
"of",
"stability_classication_y_cutoff",
"which",
"approximately",
"maximizes",
"the",
"fraction",
"correct",
"measurement",
"w",
".",
"r",
".",
"t",
".",
"a",
"fixed",
"stability_classication_x_cutoff",
".",
"This",
"function",
"uses",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L1665-L1698 | train | Determines the value of stability_classication_y_cutoff which approximately maximizes the fraction correct
measurement w. r. t. a fixed stability_classication_x_cutoff. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.plot_optimum_prediction_fraction_correct_cutoffs_over_range | def plot_optimum_prediction_fraction_correct_cutoffs_over_range(self, analysis_set, min_stability_classication_x_cutoff, max_stability_classication_x_cutoff, suppress_plot = False, analysis_file_prefix = None, verbose = True):
'''Plots the optimum cutoff for the predictions to maximize the fraction correct metr... | python | def plot_optimum_prediction_fraction_correct_cutoffs_over_range(self, analysis_set, min_stability_classication_x_cutoff, max_stability_classication_x_cutoff, suppress_plot = False, analysis_file_prefix = None, verbose = True):
'''Plots the optimum cutoff for the predictions to maximize the fraction correct metr... | [
"def",
"plot_optimum_prediction_fraction_correct_cutoffs_over_range",
"(",
"self",
",",
"analysis_set",
",",
"min_stability_classication_x_cutoff",
",",
"max_stability_classication_x_cutoff",
",",
"suppress_plot",
"=",
"False",
",",
"analysis_file_prefix",
"=",
"None",
",",
"ve... | Plots the optimum cutoff for the predictions to maximize the fraction correct metric over a range of experimental cutoffs.
Returns the average scalar corresponding to the best value of fraction correct over a range of cutoff values for the experimental cutoffs. | [
"Plots",
"the",
"optimum",
"cutoff",
"for",
"the",
"predictions",
"to",
"maximize",
"the",
"fraction",
"correct",
"metric",
"over",
"a",
"range",
"of",
"experimental",
"cutoffs",
".",
"Returns",
"the",
"average",
"scalar",
"corresponding",
"to",
"the",
"best",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L1759-L1833 | train | Plots the optimum cutoff for the predictions to maximize the fraction correct metric over a range of experimental cutoffs. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | BenchmarkRun.scatterplot_charges | def scatterplot_charges(self, title, csv_filename, analysis_set = ''):
'''Scatterplot by residue charge.'''
# Create CSV input
new_dataframe = self.dataframe.copy()
experimental_field = BenchmarkRun.get_analysis_set_fieldname('Experimental', analysis_set)
new_dataframe = new_dat... | python | def scatterplot_charges(self, title, csv_filename, analysis_set = ''):
'''Scatterplot by residue charge.'''
# Create CSV input
new_dataframe = self.dataframe.copy()
experimental_field = BenchmarkRun.get_analysis_set_fieldname('Experimental', analysis_set)
new_dataframe = new_dat... | [
"def",
"scatterplot_charges",
"(",
"self",
",",
"title",
",",
"csv_filename",
",",
"analysis_set",
"=",
"''",
")",
":",
"# Create CSV input",
"new_dataframe",
"=",
"self",
".",
"dataframe",
".",
"copy",
"(",
")",
"experimental_field",
"=",
"BenchmarkRun",
".",
... | Scatterplot by residue charge. | [
"Scatterplot",
"by",
"residue",
"charge",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2019-L2034 | train | Scatterplot by residue charge. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | DBBenchmarkRun.is_this_record_a_derived_mutation | def is_this_record_a_derived_mutation(self, record):
'''Returns True if a record is marked as a derived record i.e. the DDG value is calculated from one source ("reverse"
mutation) or two sources (a "mutation triangle") without a separate experiment having taken place. This property
is mar... | python | def is_this_record_a_derived_mutation(self, record):
'''Returns True if a record is marked as a derived record i.e. the DDG value is calculated from one source ("reverse"
mutation) or two sources (a "mutation triangle") without a separate experiment having taken place. This property
is mar... | [
"def",
"is_this_record_a_derived_mutation",
"(",
"self",
",",
"record",
")",
":",
"if",
"self",
".",
"contains_experimental_data",
":",
"for",
"analysis_set",
"in",
"self",
".",
"get_analysis_sets",
"(",
"record",
")",
":",
"ddg_details",
"=",
"record",
"[",
"'D... | Returns True if a record is marked as a derived record i.e. the DDG value is calculated from one source ("reverse"
mutation) or two sources (a "mutation triangle") without a separate experiment having taken place. This property
is marked in the Kortemme lab database when we have determined that th... | [
"Returns",
"True",
"if",
"a",
"record",
"is",
"marked",
"as",
"a",
"derived",
"record",
"i",
".",
"e",
".",
"the",
"DDG",
"value",
"is",
"calculated",
"from",
"one",
"source",
"(",
"reverse",
"mutation",
")",
"or",
"two",
"sources",
"(",
"a",
"mutation... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2278-L2292 | train | Returns True if a record is marked as a derived record i. e. the DDG value is calculated from one source or two sources with a separate experiment having taken place. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | DBBenchmarkRun.get_experimental_ddg_values | def get_experimental_ddg_values(self, record, dataframe_record):
'''Adds the mean experimental value associated with each analysis set to the dataframe row.'''
new_idxs = []
for analysis_set in self.get_analysis_sets(record):
ddg_details = record['DDG'][analysis_set]
exp_... | python | def get_experimental_ddg_values(self, record, dataframe_record):
'''Adds the mean experimental value associated with each analysis set to the dataframe row.'''
new_idxs = []
for analysis_set in self.get_analysis_sets(record):
ddg_details = record['DDG'][analysis_set]
exp_... | [
"def",
"get_experimental_ddg_values",
"(",
"self",
",",
"record",
",",
"dataframe_record",
")",
":",
"new_idxs",
"=",
"[",
"]",
"for",
"analysis_set",
"in",
"self",
".",
"get_analysis_sets",
"(",
"record",
")",
":",
"ddg_details",
"=",
"record",
"[",
"'DDG'",
... | Adds the mean experimental value associated with each analysis set to the dataframe row. | [
"Adds",
"the",
"mean",
"experimental",
"value",
"associated",
"with",
"each",
"analysis",
"set",
"to",
"the",
"dataframe",
"row",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2314-L2329 | train | Adds the mean experimental value associated with each analysis set to the dataframe row. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | DBBenchmarkRun.compute_stability_classification | def compute_stability_classification(self, predicted_data, record, dataframe_record):
'''Calculate the stability classification for the analysis cases. Must be called after get_experimental_ddg_values.'''
new_idxs = []
stability_classication_x_cutoff, stability_classication_y_cutoff = self.stab... | python | def compute_stability_classification(self, predicted_data, record, dataframe_record):
'''Calculate the stability classification for the analysis cases. Must be called after get_experimental_ddg_values.'''
new_idxs = []
stability_classication_x_cutoff, stability_classication_y_cutoff = self.stab... | [
"def",
"compute_stability_classification",
"(",
"self",
",",
"predicted_data",
",",
"record",
",",
"dataframe_record",
")",
":",
"new_idxs",
"=",
"[",
"]",
"stability_classication_x_cutoff",
",",
"stability_classication_y_cutoff",
"=",
"self",
".",
"stability_classication... | Calculate the stability classification for the analysis cases. Must be called after get_experimental_ddg_values. | [
"Calculate",
"the",
"stability",
"classification",
"for",
"the",
"analysis",
"cases",
".",
"Must",
"be",
"called",
"after",
"get_experimental_ddg_values",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2332-L2356 | train | Calculate the stability classification for the analysis cases. Must be called after get_experimental_ddg_values. |
Kortemme-Lab/klab | klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py | DBBenchmarkRun.compute_absolute_error | def compute_absolute_error(self, predicted_data, record, dataframe_record):
'''Calculate the absolute error for the analysis cases. Must be called after get_experimental_ddg_values.'''
new_idxs = []
for analysis_set in self.get_analysis_sets(record):
ddg_details = record['DDG'][anal... | python | def compute_absolute_error(self, predicted_data, record, dataframe_record):
'''Calculate the absolute error for the analysis cases. Must be called after get_experimental_ddg_values.'''
new_idxs = []
for analysis_set in self.get_analysis_sets(record):
ddg_details = record['DDG'][anal... | [
"def",
"compute_absolute_error",
"(",
"self",
",",
"predicted_data",
",",
"record",
",",
"dataframe_record",
")",
":",
"new_idxs",
"=",
"[",
"]",
"for",
"analysis_set",
"in",
"self",
".",
"get_analysis_sets",
"(",
"record",
")",
":",
"ddg_details",
"=",
"recor... | Calculate the absolute error for the analysis cases. Must be called after get_experimental_ddg_values. | [
"Calculate",
"the",
"absolute",
"error",
"for",
"the",
"analysis",
"cases",
".",
"Must",
"be",
"called",
"after",
"get_experimental_ddg_values",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ddg_monomeric_stability_analysis.py#L2359-L2378 | train | Calculate the absolute error for the analysis cases. Must be called after get_experimental_ddg_values. |
brunato/lograptor | lograptor/application.py | AppRule.add_result | def add_result(self, values):
"""
Add a tuple or increment the value of an existing one
in the rule results dictionary.
"""
idx = [values['host']]
for gid in self.key_gids[1:]:
idx.append(values[gid])
idx = tuple(idx)
try:
... | python | def add_result(self, values):
"""
Add a tuple or increment the value of an existing one
in the rule results dictionary.
"""
idx = [values['host']]
for gid in self.key_gids[1:]:
idx.append(values[gid])
idx = tuple(idx)
try:
... | [
"def",
"add_result",
"(",
"self",
",",
"values",
")",
":",
"idx",
"=",
"[",
"values",
"[",
"'host'",
"]",
"]",
"for",
"gid",
"in",
"self",
".",
"key_gids",
"[",
"1",
":",
"]",
":",
"idx",
".",
"append",
"(",
"values",
"[",
"gid",
"]",
")",
"idx... | Add a tuple or increment the value of an existing one
in the rule results dictionary. | [
"Add",
"a",
"tuple",
"or",
"increment",
"the",
"value",
"of",
"an",
"existing",
"one",
"in",
"the",
"rule",
"results",
"dictionary",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L103-L117 | train | Add a tuple or increment the value of an existing one
in the rule results dictionary. |
brunato/lograptor | lograptor/application.py | AppRule.increase_last | def increase_last(self, k):
"""
Increase the last result by k.
"""
idx = self._last_idx
if idx is not None:
self.results[idx] += k | python | def increase_last(self, k):
"""
Increase the last result by k.
"""
idx = self._last_idx
if idx is not None:
self.results[idx] += k | [
"def",
"increase_last",
"(",
"self",
",",
"k",
")",
":",
"idx",
"=",
"self",
".",
"_last_idx",
"if",
"idx",
"is",
"not",
"None",
":",
"self",
".",
"results",
"[",
"idx",
"]",
"+=",
"k"
] | Increase the last result by k. | [
"Increase",
"the",
"last",
"result",
"by",
"k",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L119-L125 | train | Increase the last result by k. |
brunato/lograptor | lograptor/application.py | AppRule.total_events | def total_events(self, cond, valfld=None):
"""
Return total number of events in the rule'result set. A condition
could be provided to select the events to count. If value field (valfld)
is passed the function compute the sum taking the product of each value with
corresponden... | python | def total_events(self, cond, valfld=None):
"""
Return total number of events in the rule'result set. A condition
could be provided to select the events to count. If value field (valfld)
is passed the function compute the sum taking the product of each value with
corresponden... | [
"def",
"total_events",
"(",
"self",
",",
"cond",
",",
"valfld",
"=",
"None",
")",
":",
"results",
"=",
"self",
".",
"results",
"if",
"cond",
"==",
"\"*\"",
"and",
"valfld",
"is",
"None",
":",
"return",
"sum",
"(",
"results",
".",
"values",
"(",
")",
... | Return total number of events in the rule'result set. A condition
could be provided to select the events to count. If value field (valfld)
is passed the function compute the sum taking the product of each value with
correspondent event counter. | [
"Return",
"total",
"number",
"of",
"events",
"in",
"the",
"rule",
"result",
"set",
".",
"A",
"condition",
"could",
"be",
"provided",
"to",
"select",
"the",
"events",
"to",
"count",
".",
"If",
"value",
"field",
"(",
"valfld",
")",
"is",
"passed",
"the",
... | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L127-L159 | train | Returns the total number of events in the rule s result set. A condition could be provided to select the events to count. A value field can be provided to select the events to count. |
brunato/lograptor | lograptor/application.py | AppRule.top_events | def top_events(self, num, valfld, usemax, gid):
"""
Return a list with the top NUM list of events. Each list element
contain a value, indicating the number of events, and a list of
matching gid values (usernames, email addresses, clients).
Instead of calculating the top sum ... | python | def top_events(self, num, valfld, usemax, gid):
"""
Return a list with the top NUM list of events. Each list element
contain a value, indicating the number of events, and a list of
matching gid values (usernames, email addresses, clients).
Instead of calculating the top sum ... | [
"def",
"top_events",
"(",
"self",
",",
"num",
",",
"valfld",
",",
"usemax",
",",
"gid",
")",
":",
"def",
"classify",
"(",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"for",
"j",
"in",
"range",
"(",
"num",
")",
":",
"if",
"top",
"[",
"... | Return a list with the top NUM list of events. Each list element
contain a value, indicating the number of events, and a list of
matching gid values (usernames, email addresses, clients).
Instead of calculating the top sum of occurrences a value field
should be provided to compute th... | [
"Return",
"a",
"list",
"with",
"the",
"top",
"NUM",
"list",
"of",
"events",
".",
"Each",
"list",
"element",
"contain",
"a",
"value",
"indicating",
"the",
"number",
"of",
"events",
"and",
"a",
"list",
"of",
"matching",
"gid",
"values",
"(",
"usernames",
"... | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L161-L216 | train | Returns a list with the top NUM list of events. Each list element contains a value indicating the number of events and a list of occurrences of a value field matching the value field with events. |
brunato/lograptor | lograptor/application.py | AppRule.list_events | def list_events(self, cond, cols, fields):
"""
Return the list of events, with a specific order and filtered by a condition.
An element of the list is a tuple with three component. The first is the main
attribute (first field). The second the second field/label, usually a string
... | python | def list_events(self, cond, cols, fields):
"""
Return the list of events, with a specific order and filtered by a condition.
An element of the list is a tuple with three component. The first is the main
attribute (first field). The second the second field/label, usually a string
... | [
"def",
"list_events",
"(",
"self",
",",
"cond",
",",
"cols",
",",
"fields",
")",
":",
"def",
"insert_row",
"(",
")",
":",
"\"\"\"\r\n Internal function to flush results for a single tabkey to result list.\r\n \"\"\"",
"row",
"=",
"list",
"(",
"row_te... | Return the list of events, with a specific order and filtered by a condition.
An element of the list is a tuple with three component. The first is the main
attribute (first field). The second the second field/label, usually a string
that identify the service. The third is a dictionary with a ... | [
"Return",
"the",
"list",
"of",
"events",
"with",
"a",
"specific",
"order",
"and",
"filtered",
"by",
"a",
"condition",
".",
"An",
"element",
"of",
"the",
"list",
"is",
"a",
"tuple",
"with",
"three",
"component",
".",
"The",
"first",
"is",
"the",
"main",
... | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L218-L299 | train | Returns the list of events that match the condition and the specified fields. |
brunato/lograptor | lograptor/application.py | AppLogParser.parse_rules | def parse_rules(self):
"""
Add a set of rules to the app, dividing between filter and other rule set
"""
# Load patterns: an app is removed when has no defined patterns.
try:
rule_options = self.config.items('rules')
except configparser.NoSectionError:
... | python | def parse_rules(self):
"""
Add a set of rules to the app, dividing between filter and other rule set
"""
# Load patterns: an app is removed when has no defined patterns.
try:
rule_options = self.config.items('rules')
except configparser.NoSectionError:
... | [
"def",
"parse_rules",
"(",
"self",
")",
":",
"# Load patterns: an app is removed when has no defined patterns.\r",
"try",
":",
"rule_options",
"=",
"self",
".",
"config",
".",
"items",
"(",
"'rules'",
")",
"except",
"configparser",
".",
"NoSectionError",
":",
"raise",... | Add a set of rules to the app, dividing between filter and other rule set | [
"Add",
"a",
"set",
"of",
"rules",
"to",
"the",
"app",
"dividing",
"between",
"filter",
"and",
"other",
"rule",
"set"
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L385-L411 | train | Parse the rules from the config file and return a list of rules. |
brunato/lograptor | lograptor/application.py | AppLogParser.increase_last | def increase_last(self, k):
"""
Increase the counter of the last matched rule by k.
"""
rule = self._last_rule
if rule is not None:
rule.increase_last(k) | python | def increase_last(self, k):
"""
Increase the counter of the last matched rule by k.
"""
rule = self._last_rule
if rule is not None:
rule.increase_last(k) | [
"def",
"increase_last",
"(",
"self",
",",
"k",
")",
":",
"rule",
"=",
"self",
".",
"_last_rule",
"if",
"rule",
"is",
"not",
"None",
":",
"rule",
".",
"increase_last",
"(",
"k",
")"
] | Increase the counter of the last matched rule by k. | [
"Increase",
"the",
"counter",
"of",
"the",
"last",
"matched",
"rule",
"by",
"k",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L413-L419 | train | Increase the counter of the last matched rule by k. |
brunato/lograptor | lograptor/application.py | AppLogParser.match_rules | def match_rules(self, log_data):
"""
Process a log line data message with app's pattern rules.
Return a tuple with this data:
Element #0 (app_matched): True if a rule match, False otherwise;
Element #1 (has_full_match): True if a rule match and is a filter or the
... | python | def match_rules(self, log_data):
"""
Process a log line data message with app's pattern rules.
Return a tuple with this data:
Element #0 (app_matched): True if a rule match, False otherwise;
Element #1 (has_full_match): True if a rule match and is a filter or the
... | [
"def",
"match_rules",
"(",
"self",
",",
"log_data",
")",
":",
"for",
"rule",
"in",
"self",
".",
"rules",
":",
"match",
"=",
"rule",
".",
"regexp",
".",
"search",
"(",
"log_data",
".",
"message",
")",
"if",
"match",
"is",
"not",
"None",
":",
"gids",
... | Process a log line data message with app's pattern rules.
Return a tuple with this data:
Element #0 (app_matched): True if a rule match, False otherwise;
Element #1 (has_full_match): True if a rule match and is a filter or the
app has not filters; False if a rule ma... | [
"Process",
"a",
"log",
"line",
"data",
"message",
"with",
"app",
"s",
"pattern",
"rules",
".",
"Return",
"a",
"tuple",
"with",
"this",
"data",
":",
"Element",
"#0",
"(",
"app_matched",
")",
":",
"True",
"if",
"a",
"rule",
"match",
"False",
"otherwise",
... | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/application.py#L421-L471 | train | Process a log line data message with app s pattern rules. |
Kortemme-Lab/klab | klab/bio/pymolmod/single_structure.py | create_single_structure_pse | def create_single_structure_pse(structure_name, structure_content, residue_ids_of_interest, pymol_executable = 'pymol', settings = {}):
''' Generates the PyMOL session for the scaffold, model, and design structures.
Returns this session and the script which generated it.'''
b = BatchBuilder(pymol_execut... | python | def create_single_structure_pse(structure_name, structure_content, residue_ids_of_interest, pymol_executable = 'pymol', settings = {}):
''' Generates the PyMOL session for the scaffold, model, and design structures.
Returns this session and the script which generated it.'''
b = BatchBuilder(pymol_execut... | [
"def",
"create_single_structure_pse",
"(",
"structure_name",
",",
"structure_content",
",",
"residue_ids_of_interest",
",",
"pymol_executable",
"=",
"'pymol'",
",",
"settings",
"=",
"{",
"}",
")",
":",
"b",
"=",
"BatchBuilder",
"(",
"pymol_executable",
"=",
"pymol_e... | Generates the PyMOL session for the scaffold, model, and design structures.
Returns this session and the script which generated it. | [
"Generates",
"the",
"PyMOL",
"session",
"for",
"the",
"scaffold",
"model",
"and",
"design",
"structures",
".",
"Returns",
"this",
"session",
"and",
"the",
"script",
"which",
"generated",
"it",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pymolmod/single_structure.py#L37-L42 | train | Creates a single structure PSE file for the scaffold model and design structures. Returns this session and the script which generated it. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_sections_by_delegate_and_term | def get_sections_by_delegate_and_term(person,
term,
future_terms=0,
include_secondaries=True,
transcriptable_course='yes',
delete_... | python | def get_sections_by_delegate_and_term(person,
term,
future_terms=0,
include_secondaries=True,
transcriptable_course='yes',
delete_... | [
"def",
"get_sections_by_delegate_and_term",
"(",
"person",
",",
"term",
",",
"future_terms",
"=",
"0",
",",
"include_secondaries",
"=",
"True",
",",
"transcriptable_course",
"=",
"'yes'",
",",
"delete_flag",
"=",
"[",
"'active'",
"]",
")",
":",
"data",
"=",
"_... | Returns a list of uw_sws.models.SectionReference objects
for the passed grade submission delegate and term.
@param: future_terms: 0..400
@param: transcriptable_course: 'yes', 'no', 'all'
@param: delete_flag: ['active', 'suspended', 'withdrawn'] | [
"Returns",
"a",
"list",
"of",
"uw_sws",
".",
"models",
".",
"SectionReference",
"objects",
"for",
"the",
"passed",
"grade",
"submission",
"delegate",
"and",
"term",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L65-L85 | train | Returns a list of uw_sws. models. SectionReference objects for the passed person and term. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_sections_by_curriculum_and_term | def get_sections_by_curriculum_and_term(curriculum, term):
"""
Returns a list of uw_sws.models.SectionReference objects
for the passed curriculum and term.
"""
url = "{}?{}".format(
section_res_url_prefix,
urlencode([("curriculum_abbreviation", curriculum.label,),
... | python | def get_sections_by_curriculum_and_term(curriculum, term):
"""
Returns a list of uw_sws.models.SectionReference objects
for the passed curriculum and term.
"""
url = "{}?{}".format(
section_res_url_prefix,
urlencode([("curriculum_abbreviation", curriculum.label,),
... | [
"def",
"get_sections_by_curriculum_and_term",
"(",
"curriculum",
",",
"term",
")",
":",
"url",
"=",
"\"{}?{}\"",
".",
"format",
"(",
"section_res_url_prefix",
",",
"urlencode",
"(",
"[",
"(",
"\"curriculum_abbreviation\"",
",",
"curriculum",
".",
"label",
",",
")"... | Returns a list of uw_sws.models.SectionReference objects
for the passed curriculum and term. | [
"Returns",
"a",
"list",
"of",
"uw_sws",
".",
"models",
".",
"SectionReference",
"objects",
"for",
"the",
"passed",
"curriculum",
"and",
"term",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L88-L98 | train | Returns a list of uw_sws. models. SectionReference objects
for the passed curriculum and term. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_sections_by_building_and_term | def get_sections_by_building_and_term(building, term):
"""
Returns a list of uw_sws.models.SectionReference objects
for the passed building and term.
"""
url = "{}?{}".format(
section_res_url_prefix,
urlencode([("quarter", term.quarter.lower(),),
("facility_code", ... | python | def get_sections_by_building_and_term(building, term):
"""
Returns a list of uw_sws.models.SectionReference objects
for the passed building and term.
"""
url = "{}?{}".format(
section_res_url_prefix,
urlencode([("quarter", term.quarter.lower(),),
("facility_code", ... | [
"def",
"get_sections_by_building_and_term",
"(",
"building",
",",
"term",
")",
":",
"url",
"=",
"\"{}?{}\"",
".",
"format",
"(",
"section_res_url_prefix",
",",
"urlencode",
"(",
"[",
"(",
"\"quarter\"",
",",
"term",
".",
"quarter",
".",
"lower",
"(",
")",
",... | Returns a list of uw_sws.models.SectionReference objects
for the passed building and term. | [
"Returns",
"a",
"list",
"of",
"uw_sws",
".",
"models",
".",
"SectionReference",
"objects",
"for",
"the",
"passed",
"building",
"and",
"term",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L101-L111 | train | Returns a list of uw_sws. models. SectionReference objects for the passed building and term. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | _json_to_sectionref | def _json_to_sectionref(data):
"""
Returns a list of SectionReference object created from
the passed json data.
"""
section_term = None
sections = []
for section_data in data.get("Sections", []):
if (section_term is None or
section_data["Year"] != section_term.year or... | python | def _json_to_sectionref(data):
"""
Returns a list of SectionReference object created from
the passed json data.
"""
section_term = None
sections = []
for section_data in data.get("Sections", []):
if (section_term is None or
section_data["Year"] != section_term.year or... | [
"def",
"_json_to_sectionref",
"(",
"data",
")",
":",
"section_term",
"=",
"None",
"sections",
"=",
"[",
"]",
"for",
"section_data",
"in",
"data",
".",
"get",
"(",
"\"Sections\"",
",",
"[",
"]",
")",
":",
"if",
"(",
"section_term",
"is",
"None",
"or",
"... | Returns a list of SectionReference object created from
the passed json data. | [
"Returns",
"a",
"list",
"of",
"SectionReference",
"object",
"created",
"from",
"the",
"passed",
"json",
"data",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L138-L158 | train | Returns a list of SectionReference objects created from the passed json data. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | _get_sections_by_person_and_term | def _get_sections_by_person_and_term(person,
term,
course_role,
include_secondaries,
future_terms,
transcriptable_course,
... | python | def _get_sections_by_person_and_term(person,
term,
course_role,
include_secondaries,
future_terms,
transcriptable_course,
... | [
"def",
"_get_sections_by_person_and_term",
"(",
"person",
",",
"term",
",",
"course_role",
",",
"include_secondaries",
",",
"future_terms",
",",
"transcriptable_course",
",",
"delete_flag",
")",
":",
"params",
"=",
"[",
"(",
"\"reg_id\"",
",",
"person",
".",
"uwre... | Returns the response data for a search request containing the
passed course_role and term (including secondaries).
@param: future_terms: 0..400
@param: transcriptable_course: 'yes', 'no', 'all'
@param: delete_flag: ['active', 'suspended', 'withdrawn'] | [
"Returns",
"the",
"response",
"data",
"for",
"a",
"search",
"request",
"containing",
"the",
"passed",
"course_role",
"and",
"term",
"(",
"including",
"secondaries",
")",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L161-L191 | train | Returns the response data for a search request containing the passed person and term. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_section_by_url | def get_section_by_url(url,
include_instructor_not_on_time_schedule=True):
"""
Returns a uw_sws.models.Section object
for the passed section url.
"""
if not course_url_pattern.match(url):
raise InvalidSectionURL(url)
return _json_to_section(
get_resource(u... | python | def get_section_by_url(url,
include_instructor_not_on_time_schedule=True):
"""
Returns a uw_sws.models.Section object
for the passed section url.
"""
if not course_url_pattern.match(url):
raise InvalidSectionURL(url)
return _json_to_section(
get_resource(u... | [
"def",
"get_section_by_url",
"(",
"url",
",",
"include_instructor_not_on_time_schedule",
"=",
"True",
")",
":",
"if",
"not",
"course_url_pattern",
".",
"match",
"(",
"url",
")",
":",
"raise",
"InvalidSectionURL",
"(",
"url",
")",
"return",
"_json_to_section",
"(",... | Returns a uw_sws.models.Section object
for the passed section url. | [
"Returns",
"a",
"uw_sws",
".",
"models",
".",
"Section",
"object",
"for",
"the",
"passed",
"section",
"url",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L221-L233 | train | Returns a uw_sws. models. Section object for the passed url. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_section_by_label | def get_section_by_label(label,
include_instructor_not_on_time_schedule=True):
"""
Returns a uw_sws.models.Section object for
the passed section label.
"""
validate_section_label(label)
url = "{}/{}.json".format(course_res_url_prefix,
encod... | python | def get_section_by_label(label,
include_instructor_not_on_time_schedule=True):
"""
Returns a uw_sws.models.Section object for
the passed section label.
"""
validate_section_label(label)
url = "{}/{}.json".format(course_res_url_prefix,
encod... | [
"def",
"get_section_by_label",
"(",
"label",
",",
"include_instructor_not_on_time_schedule",
"=",
"True",
")",
":",
"validate_section_label",
"(",
"label",
")",
"url",
"=",
"\"{}/{}.json\"",
".",
"format",
"(",
"course_res_url_prefix",
",",
"encode_section_label",
"(",
... | Returns a uw_sws.models.Section object for
the passed section label. | [
"Returns",
"a",
"uw_sws",
".",
"models",
".",
"Section",
"object",
"for",
"the",
"passed",
"section",
"label",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L236-L248 | train | Returns a uw_sws. models. Section object for the passed section label. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_linked_sections | def get_linked_sections(section,
include_instructor_not_on_time_schedule=True):
"""
Returns a list of uw_sws.models.Section objects,
representing linked sections for the passed section.
"""
linked_sections = []
for url in section.linked_section_urls:
section = ge... | python | def get_linked_sections(section,
include_instructor_not_on_time_schedule=True):
"""
Returns a list of uw_sws.models.Section objects,
representing linked sections for the passed section.
"""
linked_sections = []
for url in section.linked_section_urls:
section = ge... | [
"def",
"get_linked_sections",
"(",
"section",
",",
"include_instructor_not_on_time_schedule",
"=",
"True",
")",
":",
"linked_sections",
"=",
"[",
"]",
"for",
"url",
"in",
"section",
".",
"linked_section_urls",
":",
"section",
"=",
"get_section_by_url",
"(",
"url",
... | Returns a list of uw_sws.models.Section objects,
representing linked sections for the passed section. | [
"Returns",
"a",
"list",
"of",
"uw_sws",
".",
"models",
".",
"Section",
"objects",
"representing",
"linked",
"sections",
"for",
"the",
"passed",
"section",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L251-L264 | train | Returns a list of uw_sws. models. Section objects representing linked sections for the passed section. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_joint_sections | def get_joint_sections(section,
include_instructor_not_on_time_schedule=True):
"""
Returns a list of uw_sws.models.Section objects,
representing joint sections for the passed section.
"""
joint_sections = []
for url in section.joint_section_urls:
section = get_sec... | python | def get_joint_sections(section,
include_instructor_not_on_time_schedule=True):
"""
Returns a list of uw_sws.models.Section objects,
representing joint sections for the passed section.
"""
joint_sections = []
for url in section.joint_section_urls:
section = get_sec... | [
"def",
"get_joint_sections",
"(",
"section",
",",
"include_instructor_not_on_time_schedule",
"=",
"True",
")",
":",
"joint_sections",
"=",
"[",
"]",
"for",
"url",
"in",
"section",
".",
"joint_section_urls",
":",
"section",
"=",
"get_section_by_url",
"(",
"url",
",... | Returns a list of uw_sws.models.Section objects,
representing joint sections for the passed section. | [
"Returns",
"a",
"list",
"of",
"uw_sws",
".",
"models",
".",
"Section",
"objects",
"representing",
"joint",
"sections",
"for",
"the",
"passed",
"section",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L267-L280 | train | Returns a list of uw_sws. models. Section objects representing joint sections for the passed section. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | get_prefetch_for_section_data | def get_prefetch_for_section_data(section_data):
"""
This will return a list of methods that can be called to prefetch (in
threads) content that would be fetched while building the section.
This depends on a good cache backend. Without that, this will just double
the work that's needed :(
Eac... | python | def get_prefetch_for_section_data(section_data):
"""
This will return a list of methods that can be called to prefetch (in
threads) content that would be fetched while building the section.
This depends on a good cache backend. Without that, this will just double
the work that's needed :(
Eac... | [
"def",
"get_prefetch_for_section_data",
"(",
"section_data",
")",
":",
"prefetch",
"=",
"[",
"]",
"for",
"meeting_data",
"in",
"section_data",
"[",
"\"Meetings\"",
"]",
":",
"for",
"instructor_data",
"in",
"meeting_data",
"[",
"\"Instructors\"",
"]",
":",
"pdata",... | This will return a list of methods that can be called to prefetch (in
threads) content that would be fetched while building the section.
This depends on a good cache backend. Without that, this will just double
the work that's needed :(
Each method is identified by a key, so they can be deduped if mu... | [
"This",
"will",
"return",
"a",
"list",
"of",
"methods",
"that",
"can",
"be",
"called",
"to",
"prefetch",
"(",
"in",
"threads",
")",
"content",
"that",
"would",
"be",
"fetched",
"while",
"building",
"the",
"section",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L283-L303 | train | This function returns a list of methods that can be called to prefetch the content of the given section. |
uw-it-aca/uw-restclients-sws | uw_sws/section.py | _json_to_section | def _json_to_section(section_data,
term=None,
include_instructor_not_on_time_schedule=True):
"""
Returns a section model created from the passed json.
"""
section = Section()
if term is not None and (
term.year == int(section_data["Course"]["Year... | python | def _json_to_section(section_data,
term=None,
include_instructor_not_on_time_schedule=True):
"""
Returns a section model created from the passed json.
"""
section = Section()
if term is not None and (
term.year == int(section_data["Course"]["Year... | [
"def",
"_json_to_section",
"(",
"section_data",
",",
"term",
"=",
"None",
",",
"include_instructor_not_on_time_schedule",
"=",
"True",
")",
":",
"section",
"=",
"Section",
"(",
")",
"if",
"term",
"is",
"not",
"None",
"and",
"(",
"term",
".",
"year",
"==",
... | Returns a section model created from the passed json. | [
"Returns",
"a",
"section",
"model",
"created",
"from",
"the",
"passed",
"json",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/section.py#L306-L525 | train | Returns a new object for the passed json. |
Kortemme-Lab/klab | klab/bio/scop.py | SCOPeDatabase.get_chain_details_by_related_pdb_chains | def get_chain_details_by_related_pdb_chains(self, pdb_id, chain_id, pfam_accs):
''' Returns a dict of SCOPe details using info
This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
If there are SCOPe entries for the assoc... | python | def get_chain_details_by_related_pdb_chains(self, pdb_id, chain_id, pfam_accs):
''' Returns a dict of SCOPe details using info
This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
If there are SCOPe entries for the assoc... | [
"def",
"get_chain_details_by_related_pdb_chains",
"(",
"self",
",",
"pdb_id",
",",
"chain_id",
",",
"pfam_accs",
")",
":",
"if",
"not",
"pfam_accs",
":",
"return",
"None",
"associated_pdb_chains",
"=",
"set",
"(",
")",
"pfam_api",
"=",
"self",
".",
"get_pfam_api... | Returns a dict of SCOPe details using info
This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
If there are SCOPe entries for the associated Pfam accession numbers which agree then this function returns
pretty compl... | [
"Returns",
"a",
"dict",
"of",
"SCOPe",
"details",
"using",
"info",
"This",
"returns",
"Pfam",
"-",
"level",
"information",
"for",
"a",
"PDB",
"chain",
"i",
".",
"e",
".",
"no",
"details",
"on",
"the",
"protein",
"species",
"or",
"domain",
"will",
"be",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/scop.py#L216-L275 | train | Returns a dict of SCOPe details using info
This returns a dict of SCOPe details using info
This returns a dict of SCOPe details using info
This returns a dict of SCOPe details using info
|
Kortemme-Lab/klab | klab/bio/scop.py | SCOPeDatabase.get_chain_details_by_pfam | def get_chain_details_by_pfam(self, pdb_id, chain = None):
''' Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
If there are SCOPe entries for the associa... | python | def get_chain_details_by_pfam(self, pdb_id, chain = None):
''' Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
If there are SCOPe entries for the associa... | [
"def",
"get_chain_details_by_pfam",
"(",
"self",
",",
"pdb_id",
",",
"chain",
"=",
"None",
")",
":",
"pfam_api",
"=",
"self",
".",
"get_pfam_api",
"(",
")",
"if",
"chain",
":",
"pfam_accs",
"=",
"pfam_api",
".",
"get_pfam_accession_numbers_from_pdb_chain",
"(",
... | Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
If there are SCOPe entries for the associated Pfam accession numbers which agree then this function returns
... | [
"Returns",
"a",
"dict",
"pdb_id",
"-",
">",
"chain",
"(",
"s",
")",
"-",
">",
"chain",
"and",
"SCOPe",
"details",
".",
"This",
"returns",
"Pfam",
"-",
"level",
"information",
"for",
"a",
"PDB",
"chain",
"i",
".",
"e",
".",
"no",
"details",
"on",
"t... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/scop.py#L278-L326 | train | Returns a dict pdb_id -> chain and SCOPe details. This function returns a dict pdb_id -> chain and SCOPe details. |
Kortemme-Lab/klab | klab/bio/scop.py | SCOPeDatabase.get_chain_details | def get_chain_details(self, pdb_id, chain = None, internal_function_call = False, pfam_scop_mapping = {}):
''' Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
This is the main function for getting details for a PDB chain. If there is an associated SCOPe entry for this
chain... | python | def get_chain_details(self, pdb_id, chain = None, internal_function_call = False, pfam_scop_mapping = {}):
''' Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
This is the main function for getting details for a PDB chain. If there is an associated SCOPe entry for this
chain... | [
"def",
"get_chain_details",
"(",
"self",
",",
"pdb_id",
",",
"chain",
"=",
"None",
",",
"internal_function_call",
"=",
"False",
",",
"pfam_scop_mapping",
"=",
"{",
"}",
")",
":",
"query",
"=",
"'''\n SELECT DISTINCT scop_node.id AS scop_node_id, scop_node.*, ... | Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
This is the main function for getting details for a PDB chain. If there is an associated SCOPe entry for this
chain then this function returns the most information.
internal_function_call is used to prevent potential infin... | [
"Returns",
"a",
"dict",
"pdb_id",
"-",
">",
"chain",
"(",
"s",
")",
"-",
">",
"chain",
"and",
"SCOPe",
"details",
".",
"This",
"is",
"the",
"main",
"function",
"for",
"getting",
"details",
"for",
"a",
"PDB",
"chain",
".",
"If",
"there",
"is",
"an",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/scop.py#L343-L520 | train | Returns a dict pdb_id - > chain and SCOPe details. |
Kortemme-Lab/klab | klab/bio/scop.py | SCOPeDatabase.get_pfam_details | def get_pfam_details(self, pfam_accession):
'''Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.'''
results = self.execute_select('''
SELECT DISTINCT scop_node.*, scop_node.release_id AS scop_node_release_id,
pfam.release_id AS pfam_release_id, pfam.name AS pfam_name... | python | def get_pfam_details(self, pfam_accession):
'''Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.'''
results = self.execute_select('''
SELECT DISTINCT scop_node.*, scop_node.release_id AS scop_node_release_id,
pfam.release_id AS pfam_release_id, pfam.name AS pfam_name... | [
"def",
"get_pfam_details",
"(",
"self",
",",
"pfam_accession",
")",
":",
"results",
"=",
"self",
".",
"execute_select",
"(",
"'''\n SELECT DISTINCT scop_node.*, scop_node.release_id AS scop_node_release_id,\n pfam.release_id AS pfam_release_id, pfam.name AS pfam_nam... | Returns a dict pdb_id -> chain(s) -> chain and SCOPe details. | [
"Returns",
"a",
"dict",
"pdb_id",
"-",
">",
"chain",
"(",
"s",
")",
"-",
">",
"chain",
"and",
"SCOPe",
"details",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/scop.py#L569-L635 | train | Returns a dict pdb_id -> chain ( s ) -> chain and SCOPe details. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.recall_service | def recall_service(self, service):
"""
This method assumes that its a roll back during a deployment. If not used during a deployment session
This method should be extended later to be more useful.
"""
if not isinstance(service, Service):
raise TypeError("service mus... | python | def recall_service(self, service):
"""
This method assumes that its a roll back during a deployment. If not used during a deployment session
This method should be extended later to be more useful.
"""
if not isinstance(service, Service):
raise TypeError("service mus... | [
"def",
"recall_service",
"(",
"self",
",",
"service",
")",
":",
"if",
"not",
"isinstance",
"(",
"service",
",",
"Service",
")",
":",
"raise",
"TypeError",
"(",
"\"service must be of type Service.\"",
")",
"logger",
".",
"warning",
"(",
"\"The deployment for {0} on... | This method assumes that its a roll back during a deployment. If not used during a deployment session
This method should be extended later to be more useful. | [
"This",
"method",
"assumes",
"that",
"its",
"a",
"roll",
"back",
"during",
"a",
"deployment",
".",
"If",
"not",
"used",
"during",
"a",
"deployment",
"session"
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L88-L134 | train | Recall a service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.load_containers | def load_containers(self, service, configs, use_cache):
"""
:param service_name:
:return None:
"""
if not isinstance(service, Service):
raise TypeError("service must be and instance of service. {0} was passed.".format(service))
if not self.healthy():
... | python | def load_containers(self, service, configs, use_cache):
"""
:param service_name:
:return None:
"""
if not isinstance(service, Service):
raise TypeError("service must be and instance of service. {0} was passed.".format(service))
if not self.healthy():
... | [
"def",
"load_containers",
"(",
"self",
",",
"service",
",",
"configs",
",",
"use_cache",
")",
":",
"if",
"not",
"isinstance",
"(",
"service",
",",
"Service",
")",
":",
"raise",
"TypeError",
"(",
"\"service must be and instance of service. {0} was passed.\"",
".",
... | :param service_name:
:return None: | [
":",
"param",
"service_name",
":",
":",
"return",
"None",
":"
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L139-L151 | train | Load containers from a service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.clean_up_dangling_images | def clean_up_dangling_images(self):
"""
Clean up all dangling images.
"""
cargoes = Image.all(client=self._client_session, filters={'dangling': True})
for id, cargo in six.iteritems(cargoes):
logger.info("Removing dangling image: {0}".format(id))
cargo.del... | python | def clean_up_dangling_images(self):
"""
Clean up all dangling images.
"""
cargoes = Image.all(client=self._client_session, filters={'dangling': True})
for id, cargo in six.iteritems(cargoes):
logger.info("Removing dangling image: {0}".format(id))
cargo.del... | [
"def",
"clean_up_dangling_images",
"(",
"self",
")",
":",
"cargoes",
"=",
"Image",
".",
"all",
"(",
"client",
"=",
"self",
".",
"_client_session",
",",
"filters",
"=",
"{",
"'dangling'",
":",
"True",
"}",
")",
"for",
"id",
",",
"cargo",
"in",
"six",
".... | Clean up all dangling images. | [
"Clean",
"up",
"all",
"dangling",
"images",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L156-L163 | train | Clean up all dangling images. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.offload_all_service_cargo | def offload_all_service_cargo(self, service):
"""Remove docker images for a specific service. This method will call itself recursively for dependents and
dependencies.
:param service_name:
:return None:
"""
def anonymous(anonymous_service):
if not isinstanc... | python | def offload_all_service_cargo(self, service):
"""Remove docker images for a specific service. This method will call itself recursively for dependents and
dependencies.
:param service_name:
:return None:
"""
def anonymous(anonymous_service):
if not isinstanc... | [
"def",
"offload_all_service_cargo",
"(",
"self",
",",
"service",
")",
":",
"def",
"anonymous",
"(",
"anonymous_service",
")",
":",
"if",
"not",
"isinstance",
"(",
"anonymous_service",
",",
"Service",
")",
":",
"raise",
"TypeError",
"(",
"\"service must be an insta... | Remove docker images for a specific service. This method will call itself recursively for dependents and
dependencies.
:param service_name:
:return None: | [
"Remove",
"docker",
"images",
"for",
"a",
"specific",
"service",
".",
"This",
"method",
"will",
"call",
"itself",
"recursively",
"for",
"dependents",
"and",
"dependencies",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L277-L298 | train | Remove all docker images for a specific service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.offload_expired_service_cargo | def offload_expired_service_cargo(self, service):
"""Remove docker images for a specific service. This method will call itself recursively for dependents and
dependencies.
:param service:
:return None:
"""
# TODO: move offload cargo logic to this method
self._s... | python | def offload_expired_service_cargo(self, service):
"""Remove docker images for a specific service. This method will call itself recursively for dependents and
dependencies.
:param service:
:return None:
"""
# TODO: move offload cargo logic to this method
self._s... | [
"def",
"offload_expired_service_cargo",
"(",
"self",
",",
"service",
")",
":",
"# TODO: move offload cargo logic to this method",
"self",
".",
"_service_map",
"(",
"service",
",",
"self",
".",
"_offload_cargo",
",",
"descending",
"=",
"True",
")"
] | Remove docker images for a specific service. This method will call itself recursively for dependents and
dependencies.
:param service:
:return None: | [
"Remove",
"docker",
"images",
"for",
"a",
"specific",
"service",
".",
"This",
"method",
"will",
"call",
"itself",
"recursively",
"for",
"dependents",
"and",
"dependencies",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L300-L308 | train | Remove docker images for a specific service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.offload_service_containers | def offload_service_containers(self, service):
"""
:param service:
:return:
"""
def anonymous(anonymous_service):
if not isinstance(anonymous_service, Service):
raise TypeError("service must be an instance of Service.")
if anonymous_servic... | python | def offload_service_containers(self, service):
"""
:param service:
:return:
"""
def anonymous(anonymous_service):
if not isinstance(anonymous_service, Service):
raise TypeError("service must be an instance of Service.")
if anonymous_servic... | [
"def",
"offload_service_containers",
"(",
"self",
",",
"service",
")",
":",
"def",
"anonymous",
"(",
"anonymous_service",
")",
":",
"if",
"not",
"isinstance",
"(",
"anonymous_service",
",",
"Service",
")",
":",
"raise",
"TypeError",
"(",
"\"service must be an inst... | :param service:
:return: | [
":",
"param",
"service",
":",
":",
"return",
":"
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L310-L324 | train | Offload containers for a service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.offload_all_service_containers | def offload_all_service_containers(self, service):
"""Deletes all containers related to the service.
"""
def anonymous(anonymous_service):
if not isinstance(anonymous_service, Service):
raise TypeError("service must be an instance of Service.")
containers... | python | def offload_all_service_containers(self, service):
"""Deletes all containers related to the service.
"""
def anonymous(anonymous_service):
if not isinstance(anonymous_service, Service):
raise TypeError("service must be an instance of Service.")
containers... | [
"def",
"offload_all_service_containers",
"(",
"self",
",",
"service",
")",
":",
"def",
"anonymous",
"(",
"anonymous_service",
")",
":",
"if",
"not",
"isinstance",
"(",
"anonymous_service",
",",
"Service",
")",
":",
"raise",
"TypeError",
"(",
"\"service must be an ... | Deletes all containers related to the service. | [
"Deletes",
"all",
"containers",
"related",
"to",
"the",
"service",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L326-L339 | train | Deletes all containers related to the service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip.start_service_containers | def start_service_containers(self, service, attach):
"""
:param service:
:return bool:
"""
if not isinstance(service, Service):
TypeError("Service must be a instance of Service.")
if not service.containers:
raise AttributeError("Must load containe... | python | def start_service_containers(self, service, attach):
"""
:param service:
:return bool:
"""
if not isinstance(service, Service):
TypeError("Service must be a instance of Service.")
if not service.containers:
raise AttributeError("Must load containe... | [
"def",
"start_service_containers",
"(",
"self",
",",
"service",
",",
"attach",
")",
":",
"if",
"not",
"isinstance",
"(",
"service",
",",
"Service",
")",
":",
"TypeError",
"(",
"\"Service must be a instance of Service.\"",
")",
"if",
"not",
"service",
".",
"conta... | :param service:
:return bool: | [
":",
"param",
"service",
":",
":",
"return",
"bool",
":"
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L357-L382 | train | Start all the containers for a given service. |
TUNE-Archive/freight_forwarder | freight_forwarder/container_ship.py | ContainerShip._container_registration | def _container_registration(self, alias):
"""
Check for an available name and return that to the caller.
"""
containers = Container.find_by_name(self._client_session, alias)
def validate_name(name):
valid = True
if name in containers:
vali... | python | def _container_registration(self, alias):
"""
Check for an available name and return that to the caller.
"""
containers = Container.find_by_name(self._client_session, alias)
def validate_name(name):
valid = True
if name in containers:
vali... | [
"def",
"_container_registration",
"(",
"self",
",",
"alias",
")",
":",
"containers",
"=",
"Container",
".",
"find_by_name",
"(",
"self",
".",
"_client_session",
",",
"alias",
")",
"def",
"validate_name",
"(",
"name",
")",
":",
"valid",
"=",
"True",
"if",
"... | Check for an available name and return that to the caller. | [
"Check",
"for",
"an",
"available",
"name",
"and",
"return",
"that",
"to",
"the",
"caller",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container_ship.py#L529-L549 | train | Check for an available name and return that to the caller. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.