partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Yolk.show_pypi_releases | Show PyPI releases for the last number of `hours`
@returns: 0 = success or 1 if failed to retrieve from XML-RPC server | yolk/cli.py | def show_pypi_releases(self):
"""
Show PyPI releases for the last number of `hours`
@returns: 0 = success or 1 if failed to retrieve from XML-RPC server
"""
try:
hours = int(self.options.show_pypi_releases)
except ValueError:
self.logger.error("E... | def show_pypi_releases(self):
"""
Show PyPI releases for the last number of `hours`
@returns: 0 = success or 1 if failed to retrieve from XML-RPC server
"""
try:
hours = int(self.options.show_pypi_releases)
except ValueError:
self.logger.error("E... | [
"Show",
"PyPI",
"releases",
"for",
"the",
"last",
"number",
"of",
"hours"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L471-L492 | [
"def",
"show_pypi_releases",
"(",
"self",
")",
":",
"try",
":",
"hours",
"=",
"int",
"(",
"self",
".",
"options",
".",
"show_pypi_releases",
")",
"except",
"ValueError",
":",
"self",
".",
"logger",
".",
"error",
"(",
"\"ERROR: You must supply an integer.\"",
"... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.show_download_links | Query PyPI for pkg download URI for a packge
@returns: 0 | yolk/cli.py | def show_download_links(self):
"""
Query PyPI for pkg download URI for a packge
@returns: 0
"""
#In case they specify version as 'dev' instead of using -T svn,
#don't show three svn URI's
if self.options.file_type == "all" and self.version == "dev":
... | def show_download_links(self):
"""
Query PyPI for pkg download URI for a packge
@returns: 0
"""
#In case they specify version as 'dev' instead of using -T svn,
#don't show three svn URI's
if self.options.file_type == "all" and self.version == "dev":
... | [
"Query",
"PyPI",
"for",
"pkg",
"download",
"URI",
"for",
"a",
"packge"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L494-L524 | [
"def",
"show_download_links",
"(",
"self",
")",
":",
"#In case they specify version as 'dev' instead of using -T svn,",
"#don't show three svn URI's",
"if",
"self",
".",
"options",
".",
"file_type",
"==",
"\"all\"",
"and",
"self",
".",
"version",
"==",
"\"dev\"",
":",
"... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.print_download_uri | @param version: version number or 'dev' for svn
@type version: string
@param source: download source or egg
@type source: boolean
@returns: None | yolk/cli.py | def print_download_uri(self, version, source):
"""
@param version: version number or 'dev' for svn
@type version: string
@param source: download source or egg
@type source: boolean
@returns: None
"""
if version == "dev":
pkg_type = "subvers... | def print_download_uri(self, version, source):
"""
@param version: version number or 'dev' for svn
@type version: string
@param source: download source or egg
@type source: boolean
@returns: None
"""
if version == "dev":
pkg_type = "subvers... | [
"@param",
"version",
":",
"version",
"number",
"or",
"dev",
"for",
"svn",
"@type",
"version",
":",
"string"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L526-L552 | [
"def",
"print_download_uri",
"(",
"self",
",",
"version",
",",
"source",
")",
":",
"if",
"version",
"==",
"\"dev\"",
":",
"pkg_type",
"=",
"\"subversion\"",
"source",
"=",
"True",
"elif",
"source",
":",
"pkg_type",
"=",
"\"source\"",
"else",
":",
"pkg_type",... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.fetch | Download a package
@returns: 0 = success or 1 if failed download | yolk/cli.py | def fetch(self):
"""
Download a package
@returns: 0 = success or 1 if failed download
"""
#Default type to download
source = True
directory = "."
if self.options.file_type == "svn":
version = "dev"
svn_uri = get_download_uri(self... | def fetch(self):
"""
Download a package
@returns: 0 = success or 1 if failed download
"""
#Default type to download
source = True
directory = "."
if self.options.file_type == "svn":
version = "dev"
svn_uri = get_download_uri(self... | [
"Download",
"a",
"package"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L554-L588 | [
"def",
"fetch",
"(",
"self",
")",
":",
"#Default type to download",
"source",
"=",
"True",
"directory",
"=",
"\".\"",
"if",
"self",
".",
"options",
".",
"file_type",
"==",
"\"svn\"",
":",
"version",
"=",
"\"dev\"",
"svn_uri",
"=",
"get_download_uri",
"(",
"s... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.fetch_uri | Use ``urllib.urlretrieve`` to download package to file in sandbox dir.
@param directory: directory to download to
@type directory: string
@param uri: uri to download
@type uri: string
@returns: 0 = success or 1 for failed download | yolk/cli.py | def fetch_uri(self, directory, uri):
"""
Use ``urllib.urlretrieve`` to download package to file in sandbox dir.
@param directory: directory to download to
@type directory: string
@param uri: uri to download
@type uri: string
@returns: 0 = success or 1 for faile... | def fetch_uri(self, directory, uri):
"""
Use ``urllib.urlretrieve`` to download package to file in sandbox dir.
@param directory: directory to download to
@type directory: string
@param uri: uri to download
@type uri: string
@returns: 0 = success or 1 for faile... | [
"Use",
"urllib",
".",
"urlretrieve",
"to",
"download",
"package",
"to",
"file",
"in",
"sandbox",
"dir",
"."
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L590-L623 | [
"def",
"fetch_uri",
"(",
"self",
",",
"directory",
",",
"uri",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"urlparse",
"(",
"uri",
")",
"[",
"2",
"]",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.fetch_svn | Fetch subversion repository
@param svn_uri: subversion repository uri to check out
@type svn_uri: string
@param directory: directory to download to
@type directory: string
@returns: 0 = success or 1 for failed download | yolk/cli.py | def fetch_svn(self, svn_uri, directory):
"""
Fetch subversion repository
@param svn_uri: subversion repository uri to check out
@type svn_uri: string
@param directory: directory to download to
@type directory: string
@returns: 0 = success or 1 for failed downlo... | def fetch_svn(self, svn_uri, directory):
"""
Fetch subversion repository
@param svn_uri: subversion repository uri to check out
@type svn_uri: string
@param directory: directory to download to
@type directory: string
@returns: 0 = success or 1 for failed downlo... | [
"Fetch",
"subversion",
"repository"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L626-L660 | [
"def",
"fetch_svn",
"(",
"self",
",",
"svn_uri",
",",
"directory",
")",
":",
"if",
"not",
"command_successful",
"(",
"\"svn --version\"",
")",
":",
"self",
".",
"logger",
".",
"error",
"(",
"\"ERROR: Do you have subversion installed?\"",
")",
"return",
"1",
"if"... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.browse_website | Launch web browser at project's homepage
@param browser: name of web browser to use
@type browser: string
@returns: 0 if homepage found, 1 if no homepage found | yolk/cli.py | def browse_website(self, browser=None):
"""
Launch web browser at project's homepage
@param browser: name of web browser to use
@type browser: string
@returns: 0 if homepage found, 1 if no homepage found
"""
if len(self.all_versions):
metadata = self... | def browse_website(self, browser=None):
"""
Launch web browser at project's homepage
@param browser: name of web browser to use
@type browser: string
@returns: 0 if homepage found, 1 if no homepage found
"""
if len(self.all_versions):
metadata = self... | [
"Launch",
"web",
"browser",
"at",
"project",
"s",
"homepage"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L662-L686 | [
"def",
"browse_website",
"(",
"self",
",",
"browser",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"all_versions",
")",
":",
"metadata",
"=",
"self",
".",
"pypi",
".",
"release_data",
"(",
"self",
".",
"project_name",
",",
"self",
".",
"all_ve... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.query_metadata_pypi | Show pkg metadata queried from PyPI
@returns: 0 | yolk/cli.py | def query_metadata_pypi(self):
"""
Show pkg metadata queried from PyPI
@returns: 0
"""
if self.version and self.version in self.all_versions:
metadata = self.pypi.release_data(self.project_name, self.version)
else:
#Give highest version
... | def query_metadata_pypi(self):
"""
Show pkg metadata queried from PyPI
@returns: 0
"""
if self.version and self.version in self.all_versions:
metadata = self.pypi.release_data(self.project_name, self.version)
else:
#Give highest version
... | [
"Show",
"pkg",
"metadata",
"queried",
"from",
"PyPI"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L689-L708 | [
"def",
"query_metadata_pypi",
"(",
"self",
")",
":",
"if",
"self",
".",
"version",
"and",
"self",
".",
"version",
"in",
"self",
".",
"all_versions",
":",
"metadata",
"=",
"self",
".",
"pypi",
".",
"release_data",
"(",
"self",
".",
"project_name",
",",
"s... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.versions_available | Query PyPI for a particular version or all versions of a package
@returns: 0 if version(s) found or 1 if none found | yolk/cli.py | def versions_available(self):
"""
Query PyPI for a particular version or all versions of a package
@returns: 0 if version(s) found or 1 if none found
"""
if self.version:
spec = "%s==%s" % (self.project_name, self.version)
else:
spec = self.proje... | def versions_available(self):
"""
Query PyPI for a particular version or all versions of a package
@returns: 0 if version(s) found or 1 if none found
"""
if self.version:
spec = "%s==%s" % (self.project_name, self.version)
else:
spec = self.proje... | [
"Query",
"PyPI",
"for",
"a",
"particular",
"version",
"or",
"all",
"versions",
"of",
"a",
"package"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L710-L733 | [
"def",
"versions_available",
"(",
"self",
")",
":",
"if",
"self",
".",
"version",
":",
"spec",
"=",
"\"%s==%s\"",
"%",
"(",
"self",
".",
"project_name",
",",
"self",
".",
"version",
")",
"else",
":",
"spec",
"=",
"self",
".",
"project_name",
"if",
"sel... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.parse_search_spec | Parse search args and return spec dict for PyPI
* Owwww, my eyes!. Re-write this.
@param spec: Cheese Shop package search spec
e.g.
name=Cheetah
license=ZPL
license=ZPL AND name=Cheetah
@type spec: string
... | yolk/cli.py | def parse_search_spec(self, spec):
"""
Parse search args and return spec dict for PyPI
* Owwww, my eyes!. Re-write this.
@param spec: Cheese Shop package search spec
e.g.
name=Cheetah
license=ZPL
license... | def parse_search_spec(self, spec):
"""
Parse search args and return spec dict for PyPI
* Owwww, my eyes!. Re-write this.
@param spec: Cheese Shop package search spec
e.g.
name=Cheetah
license=ZPL
license... | [
"Parse",
"search",
"args",
"and",
"return",
"spec",
"dict",
"for",
"PyPI",
"*",
"Owwww",
"my",
"eyes!",
".",
"Re",
"-",
"write",
"this",
"."
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L735-L798 | [
"def",
"parse_search_spec",
"(",
"self",
",",
"spec",
")",
":",
"usage",
"=",
"\"\"\"You can search PyPI by the following:\n name\n version\n author\n author_email\n maintainer\n maintainer_email\n home_page\n license\n summary\n description\n keywords... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.pypi_search | Search PyPI by metadata keyword
e.g. yolk -S name=yolk AND license=GPL
@param spec: Cheese Shop search spec
@type spec: list of strings
spec examples:
["name=yolk"]
["license=GPL"]
["name=yolk", "AND", "license=GPL"]
@returns: 0 on success or 1 if... | yolk/cli.py | def pypi_search(self):
"""
Search PyPI by metadata keyword
e.g. yolk -S name=yolk AND license=GPL
@param spec: Cheese Shop search spec
@type spec: list of strings
spec examples:
["name=yolk"]
["license=GPL"]
["name=yolk", "AND", "license=GP... | def pypi_search(self):
"""
Search PyPI by metadata keyword
e.g. yolk -S name=yolk AND license=GPL
@param spec: Cheese Shop search spec
@type spec: list of strings
spec examples:
["name=yolk"]
["license=GPL"]
["name=yolk", "AND", "license=GP... | [
"Search",
"PyPI",
"by",
"metadata",
"keyword",
"e",
".",
"g",
".",
"yolk",
"-",
"S",
"name",
"=",
"yolk",
"AND",
"license",
"=",
"GPL"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L801-L834 | [
"def",
"pypi_search",
"(",
"self",
")",
":",
"spec",
"=",
"self",
".",
"pkg_spec",
"#Add remainging cli arguments to options.pypi_search",
"search_arg",
"=",
"self",
".",
"options",
".",
"pypi_search",
"spec",
".",
"insert",
"(",
"0",
",",
"search_arg",
".",
"st... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.show_entry_map | Show entry map for a package
@param dist: package
@param type: srting
@returns: 0 for success or 1 if error | yolk/cli.py | def show_entry_map(self):
"""
Show entry map for a package
@param dist: package
@param type: srting
@returns: 0 for success or 1 if error
"""
pprinter = pprint.PrettyPrinter()
try:
entry_map = pkg_resources.get_entry_map(self.options.show_ent... | def show_entry_map(self):
"""
Show entry map for a package
@param dist: package
@param type: srting
@returns: 0 for success or 1 if error
"""
pprinter = pprint.PrettyPrinter()
try:
entry_map = pkg_resources.get_entry_map(self.options.show_ent... | [
"Show",
"entry",
"map",
"for",
"a",
"package"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L836-L854 | [
"def",
"show_entry_map",
"(",
"self",
")",
":",
"pprinter",
"=",
"pprint",
".",
"PrettyPrinter",
"(",
")",
"try",
":",
"entry_map",
"=",
"pkg_resources",
".",
"get_entry_map",
"(",
"self",
".",
"options",
".",
"show_entry_map",
")",
"if",
"entry_map",
":",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.show_entry_points | Show entry points for a module
@returns: 0 for success or 1 if error | yolk/cli.py | def show_entry_points(self):
"""
Show entry points for a module
@returns: 0 for success or 1 if error
"""
found = False
for entry_point in \
pkg_resources.iter_entry_points(self.options.show_entry_points):
found = True
try:
... | def show_entry_points(self):
"""
Show entry points for a module
@returns: 0 for success or 1 if error
"""
found = False
for entry_point in \
pkg_resources.iter_entry_points(self.options.show_entry_points):
found = True
try:
... | [
"Show",
"entry",
"points",
"for",
"a",
"module"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L856-L880 | [
"def",
"show_entry_points",
"(",
"self",
")",
":",
"found",
"=",
"False",
"for",
"entry_point",
"in",
"pkg_resources",
".",
"iter_entry_points",
"(",
"self",
".",
"options",
".",
"show_entry_points",
")",
":",
"found",
"=",
"True",
"try",
":",
"plugin",
"=",... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Yolk.parse_pkg_ver | Return tuple with project_name and version from CLI args
If the user gave the wrong case for the project name, this corrects it
@param want_installed: whether package we want is installed or not
@type want_installed: boolean
@returns: tuple(project_name, version, all_versions) | yolk/cli.py | def parse_pkg_ver(self, want_installed):
"""
Return tuple with project_name and version from CLI args
If the user gave the wrong case for the project name, this corrects it
@param want_installed: whether package we want is installed or not
@type want_installed: boolean
... | def parse_pkg_ver(self, want_installed):
"""
Return tuple with project_name and version from CLI args
If the user gave the wrong case for the project name, this corrects it
@param want_installed: whether package we want is installed or not
@type want_installed: boolean
... | [
"Return",
"tuple",
"with",
"project_name",
"and",
"version",
"from",
"CLI",
"args",
"If",
"the",
"user",
"gave",
"the",
"wrong",
"case",
"for",
"the",
"project",
"name",
"this",
"corrects",
"it"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/cli.py#L891-L926 | [
"def",
"parse_pkg_ver",
"(",
"self",
",",
"want_installed",
")",
":",
"all_versions",
"=",
"[",
"]",
"arg_str",
"=",
"(",
"\"\"",
")",
".",
"join",
"(",
"self",
".",
"pkg_spec",
")",
"if",
"\"==\"",
"not",
"in",
"arg_str",
":",
"#No version specified",
"... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | install_backport_hook | Install a backport import hook for Qt4 api
Parameters
----------
api : str
The Qt4 api whose structure should be intercepted
('pyqt4' or 'pyside').
Example
-------
>>> install_backport_hook("pyqt4")
>>> import PyQt4
Loaded module AnyQt._backport as a substitute for PyQt... | AnyQt/importhooks.py | def install_backport_hook(api):
"""
Install a backport import hook for Qt4 api
Parameters
----------
api : str
The Qt4 api whose structure should be intercepted
('pyqt4' or 'pyside').
Example
-------
>>> install_backport_hook("pyqt4")
>>> import PyQt4
Loaded mod... | def install_backport_hook(api):
"""
Install a backport import hook for Qt4 api
Parameters
----------
api : str
The Qt4 api whose structure should be intercepted
('pyqt4' or 'pyside').
Example
-------
>>> install_backport_hook("pyqt4")
>>> import PyQt4
Loaded mod... | [
"Install",
"a",
"backport",
"import",
"hook",
"for",
"Qt4",
"api"
] | ales-erjavec/anyqt | python | https://github.com/ales-erjavec/anyqt/blob/07b73c5ccb8f73f70fc6566249c0c7228fc9b921/AnyQt/importhooks.py#L81-L101 | [
"def",
"install_backport_hook",
"(",
"api",
")",
":",
"if",
"api",
"==",
"USED_API",
":",
"raise",
"ValueError",
"sys",
".",
"meta_path",
".",
"insert",
"(",
"0",
",",
"ImportHookBackport",
"(",
"api",
")",
")"
] | 07b73c5ccb8f73f70fc6566249c0c7228fc9b921 |
train | install_deny_hook | Install a deny import hook for Qt api.
Parameters
----------
api : str
The Qt api whose import should be prevented
Example
-------
>>> install_deny_import("pyqt4")
>>> import PyQt4
Traceback (most recent call last):...
ImportError: Import of PyQt4 is denied. | AnyQt/importhooks.py | def install_deny_hook(api):
"""
Install a deny import hook for Qt api.
Parameters
----------
api : str
The Qt api whose import should be prevented
Example
-------
>>> install_deny_import("pyqt4")
>>> import PyQt4
Traceback (most recent call last):...
ImportError: Im... | def install_deny_hook(api):
"""
Install a deny import hook for Qt api.
Parameters
----------
api : str
The Qt api whose import should be prevented
Example
-------
>>> install_deny_import("pyqt4")
>>> import PyQt4
Traceback (most recent call last):...
ImportError: Im... | [
"Install",
"a",
"deny",
"import",
"hook",
"for",
"Qt",
"api",
"."
] | ales-erjavec/anyqt | python | https://github.com/ales-erjavec/anyqt/blob/07b73c5ccb8f73f70fc6566249c0c7228fc9b921/AnyQt/importhooks.py#L104-L124 | [
"def",
"install_deny_hook",
"(",
"api",
")",
":",
"if",
"api",
"==",
"USED_API",
":",
"raise",
"ValueError",
"sys",
".",
"meta_path",
".",
"insert",
"(",
"0",
",",
"ImportHookDeny",
"(",
"api",
")",
")"
] | 07b73c5ccb8f73f70fc6566249c0c7228fc9b921 |
train | run_command | Run command and return its return status code and its output | yolk/utils.py | def run_command(cmd, env=None, max_timeout=None):
"""
Run command and return its return status code and its output
"""
arglist = cmd.split()
output = os.tmpfile()
try:
pipe = Popen(arglist, stdout=output, stderr=STDOUT, env=env)
except Exception as errmsg:
return 1, errmsg
... | def run_command(cmd, env=None, max_timeout=None):
"""
Run command and return its return status code and its output
"""
arglist = cmd.split()
output = os.tmpfile()
try:
pipe = Popen(arglist, stdout=output, stderr=STDOUT, env=env)
except Exception as errmsg:
return 1, errmsg
... | [
"Run",
"command",
"and",
"return",
"its",
"return",
"status",
"code",
"and",
"its",
"output"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/utils.py#L30-L55 | [
"def",
"run_command",
"(",
"cmd",
",",
"env",
"=",
"None",
",",
"max_timeout",
"=",
"None",
")",
":",
"arglist",
"=",
"cmd",
".",
"split",
"(",
")",
"output",
"=",
"os",
".",
"tmpfile",
"(",
")",
"try",
":",
"pipe",
"=",
"Popen",
"(",
"arglist",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | SlackAPI.iter | Iterate over a slack API method supporting pagination
When using :class:`slack.methods` the request is made `as_json` if available
Args:
url: :class:`slack.methods` or url string
data: JSON encodable MutableMapping
headers:
limit: Maximum number of resul... | slack/io/abc.py | async def iter(
self,
url: Union[str, methods],
data: Optional[MutableMapping] = None,
headers: Optional[MutableMapping] = None,
*,
limit: int = 200,
iterkey: Optional[str] = None,
itermode: Optional[str] = None,
minimum_time: Optional[int] = None,... | async def iter(
self,
url: Union[str, methods],
data: Optional[MutableMapping] = None,
headers: Optional[MutableMapping] = None,
*,
limit: int = 200,
iterkey: Optional[str] = None,
itermode: Optional[str] = None,
minimum_time: Optional[int] = None,... | [
"Iterate",
"over",
"a",
"slack",
"API",
"method",
"supporting",
"pagination"
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/io/abc.py#L88-L149 | [
"async",
"def",
"iter",
"(",
"self",
",",
"url",
":",
"Union",
"[",
"str",
",",
"methods",
"]",
",",
"data",
":",
"Optional",
"[",
"MutableMapping",
"]",
"=",
"None",
",",
"headers",
":",
"Optional",
"[",
"MutableMapping",
"]",
"=",
"None",
",",
"*",... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | SlackAPI._incoming_from_rtm | Connect and discard incoming RTM event if necessary.
:param url: Websocket url
:param bot_id: Bot ID
:return: Incoming events | slack/io/abc.py | async def _incoming_from_rtm(
self, url: str, bot_id: str
) -> AsyncIterator[events.Event]:
"""
Connect and discard incoming RTM event if necessary.
:param url: Websocket url
:param bot_id: Bot ID
:return: Incoming events
"""
async for data in self._r... | async def _incoming_from_rtm(
self, url: str, bot_id: str
) -> AsyncIterator[events.Event]:
"""
Connect and discard incoming RTM event if necessary.
:param url: Websocket url
:param bot_id: Bot ID
:return: Incoming events
"""
async for data in self._r... | [
"Connect",
"and",
"discard",
"incoming",
"RTM",
"event",
"if",
"necessary",
"."
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/io/abc.py#L195-L212 | [
"async",
"def",
"_incoming_from_rtm",
"(",
"self",
",",
"url",
":",
"str",
",",
"bot_id",
":",
"str",
")",
"->",
"AsyncIterator",
"[",
"events",
".",
"Event",
"]",
":",
"async",
"for",
"data",
"in",
"self",
".",
"_rtm",
"(",
"url",
")",
":",
"event",... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | login | Displays the login form and handles the login action. | ratelimitbackend/views.py | def login(request, template_name='registration/login.html',
redirect_field_name=REDIRECT_FIELD_NAME,
authentication_form=AuthenticationForm,
current_app=None, extra_context=None):
"""
Displays the login form and handles the login action.
"""
redirect_to = request.POST.get(r... | def login(request, template_name='registration/login.html',
redirect_field_name=REDIRECT_FIELD_NAME,
authentication_form=AuthenticationForm,
current_app=None, extra_context=None):
"""
Displays the login form and handles the login action.
"""
redirect_to = request.POST.get(r... | [
"Displays",
"the",
"login",
"form",
"and",
"handles",
"the",
"login",
"action",
"."
] | brutasse/django-ratelimit-backend | python | https://github.com/brutasse/django-ratelimit-backend/blob/1f8f485c139eb8067f0d821ff77df98038ab9448/ratelimitbackend/views.py#L17-L59 | [
"def",
"login",
"(",
"request",
",",
"template_name",
"=",
"'registration/login.html'",
",",
"redirect_field_name",
"=",
"REDIRECT_FIELD_NAME",
",",
"authentication_form",
"=",
"AuthenticationForm",
",",
"current_app",
"=",
"None",
",",
"extra_context",
"=",
"None",
"... | 1f8f485c139eb8067f0d821ff77df98038ab9448 |
train | PackageManagerPlugin.package_manager_owns | Returns True if package manager 'owns' file
Returns False if package manager does not 'own' file
There is currently no way to determine if distutils or
setuptools installed a package. A future feature of setuptools
will make a package manifest which can be checked.
'... | examples/plugins/yolk_pkg_manager/yolk_acme.py | def package_manager_owns(self, dist):
"""
Returns True if package manager 'owns' file
Returns False if package manager does not 'own' file
There is currently no way to determine if distutils or
setuptools installed a package. A future feature of setuptools
will make a pa... | def package_manager_owns(self, dist):
"""
Returns True if package manager 'owns' file
Returns False if package manager does not 'own' file
There is currently no way to determine if distutils or
setuptools installed a package. A future feature of setuptools
will make a pa... | [
"Returns",
"True",
"if",
"package",
"manager",
"owns",
"file",
"Returns",
"False",
"if",
"package",
"manager",
"does",
"not",
"own",
"file"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/examples/plugins/yolk_pkg_manager/yolk_acme.py#L71-L96 | [
"def",
"package_manager_owns",
"(",
"self",
",",
"dist",
")",
":",
"#Installed by distutils/setuptools or external package manager?",
"#If location is in site-packages dir, check for .egg-info file",
"if",
"dist",
".",
"location",
".",
"lower",
"(",
")",
"==",
"get_python_lib",... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | check_proxy_setting | If the environmental variable 'HTTP_PROXY' is set, it will most likely be
in one of these forms:
proxyhost:8080
http://proxyhost:8080
urlllib2 requires the proxy URL to start with 'http://'
This routine does that, and returns the transport for xmlrpc. | yolk/pypi.py | def check_proxy_setting():
"""
If the environmental variable 'HTTP_PROXY' is set, it will most likely be
in one of these forms:
proxyhost:8080
http://proxyhost:8080
urlllib2 requires the proxy URL to start with 'http://'
This routine does that, and returns the transport for xml... | def check_proxy_setting():
"""
If the environmental variable 'HTTP_PROXY' is set, it will most likely be
in one of these forms:
proxyhost:8080
http://proxyhost:8080
urlllib2 requires the proxy URL to start with 'http://'
This routine does that, and returns the transport for xml... | [
"If",
"the",
"environmental",
"variable",
"HTTP_PROXY",
"is",
"set",
"it",
"will",
"most",
"likely",
"be",
"in",
"one",
"of",
"these",
"forms",
":"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L95-L117 | [
"def",
"check_proxy_setting",
"(",
")",
":",
"try",
":",
"http_proxy",
"=",
"os",
".",
"environ",
"[",
"'HTTP_PROXY'",
"]",
"except",
"KeyError",
":",
"return",
"if",
"not",
"http_proxy",
".",
"startswith",
"(",
"'http://'",
")",
":",
"match",
"=",
"re",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | filter_url | Returns URL of specified file type
'source', 'egg', or 'all' | yolk/pypi.py | def filter_url(pkg_type, url):
"""
Returns URL of specified file type
'source', 'egg', or 'all'
"""
bad_stuff = ["?modtime", "#md5="]
for junk in bad_stuff:
if junk in url:
url = url.split(junk)[0]
break
#pkg_spec==dev (svn)
if url.endswith("-dev"):
... | def filter_url(pkg_type, url):
"""
Returns URL of specified file type
'source', 'egg', or 'all'
"""
bad_stuff = ["?modtime", "#md5="]
for junk in bad_stuff:
if junk in url:
url = url.split(junk)[0]
break
#pkg_spec==dev (svn)
if url.endswith("-dev"):
... | [
"Returns",
"URL",
"of",
"specified",
"file",
"type",
"source",
"egg",
"or",
"all"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L288-L314 | [
"def",
"filter_url",
"(",
"pkg_type",
",",
"url",
")",
":",
"bad_stuff",
"=",
"[",
"\"?modtime\"",
",",
"\"#md5=\"",
"]",
"for",
"junk",
"in",
"bad_stuff",
":",
"if",
"junk",
"in",
"url",
":",
"url",
"=",
"url",
".",
"split",
"(",
"junk",
")",
"[",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | ProxyTransport.request | Send xml-rpc request using proxy | yolk/pypi.py | def request(self, host, handler, request_body, verbose):
'''Send xml-rpc request using proxy'''
#We get a traceback if we don't have this attribute:
self.verbose = verbose
url = 'http://' + host + handler
request = urllib2.Request(url)
request.add_data(request_body)
... | def request(self, host, handler, request_body, verbose):
'''Send xml-rpc request using proxy'''
#We get a traceback if we don't have this attribute:
self.verbose = verbose
url = 'http://' + host + handler
request = urllib2.Request(url)
request.add_data(request_body)
... | [
"Send",
"xml",
"-",
"rpc",
"request",
"using",
"proxy"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L79-L92 | [
"def",
"request",
"(",
"self",
",",
"host",
",",
"handler",
",",
"request_body",
",",
"verbose",
")",
":",
"#We get a traceback if we don't have this attribute:",
"self",
".",
"verbose",
"=",
"verbose",
"url",
"=",
"'http://'",
"+",
"host",
"+",
"handler",
"requ... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.get_cache | Get a package name list from disk cache or PyPI | yolk/pypi.py | def get_cache(self):
"""
Get a package name list from disk cache or PyPI
"""
#This is used by external programs that import `CheeseShop` and don't
#want a cache file written to ~/.pypi and query PyPI every time.
if self.no_cache:
self.pkg_list = self.list_pack... | def get_cache(self):
"""
Get a package name list from disk cache or PyPI
"""
#This is used by external programs that import `CheeseShop` and don't
#want a cache file written to ~/.pypi and query PyPI every time.
if self.no_cache:
self.pkg_list = self.list_pack... | [
"Get",
"a",
"package",
"name",
"list",
"from",
"disk",
"cache",
"or",
"PyPI"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L138-L154 | [
"def",
"get_cache",
"(",
"self",
")",
":",
"#This is used by external programs that import `CheeseShop` and don't",
"#want a cache file written to ~/.pypi and query PyPI every time.",
"if",
"self",
".",
"no_cache",
":",
"self",
".",
"pkg_list",
"=",
"self",
".",
"list_packages"... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.get_xmlrpc_server | Returns PyPI's XML-RPC server instance | yolk/pypi.py | def get_xmlrpc_server(self):
"""
Returns PyPI's XML-RPC server instance
"""
check_proxy_setting()
if os.environ.has_key('XMLRPC_DEBUG'):
debug = 1
else:
debug = 0
try:
return xmlrpclib.Server(XML_RPC_SERVER, transport=ProxyTrans... | def get_xmlrpc_server(self):
"""
Returns PyPI's XML-RPC server instance
"""
check_proxy_setting()
if os.environ.has_key('XMLRPC_DEBUG'):
debug = 1
else:
debug = 0
try:
return xmlrpclib.Server(XML_RPC_SERVER, transport=ProxyTrans... | [
"Returns",
"PyPI",
"s",
"XML",
"-",
"RPC",
"server",
"instance"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L162-L175 | [
"def",
"get_xmlrpc_server",
"(",
"self",
")",
":",
"check_proxy_setting",
"(",
")",
"if",
"os",
".",
"environ",
".",
"has_key",
"(",
"'XMLRPC_DEBUG'",
")",
":",
"debug",
"=",
"1",
"else",
":",
"debug",
"=",
"0",
"try",
":",
"return",
"xmlrpclib",
".",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.query_versions_pypi | Fetch list of available versions for a package from The CheeseShop | yolk/pypi.py | def query_versions_pypi(self, package_name):
"""Fetch list of available versions for a package from The CheeseShop"""
if not package_name in self.pkg_list:
self.logger.debug("Package %s not in cache, querying PyPI..." \
% package_name)
self.fetch_pkg_list()
... | def query_versions_pypi(self, package_name):
"""Fetch list of available versions for a package from The CheeseShop"""
if not package_name in self.pkg_list:
self.logger.debug("Package %s not in cache, querying PyPI..." \
% package_name)
self.fetch_pkg_list()
... | [
"Fetch",
"list",
"of",
"available",
"versions",
"for",
"a",
"package",
"from",
"The",
"CheeseShop"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L183-L200 | [
"def",
"query_versions_pypi",
"(",
"self",
",",
"package_name",
")",
":",
"if",
"not",
"package_name",
"in",
"self",
".",
"pkg_list",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Package %s not in cache, querying PyPI...\"",
"%",
"package_name",
")",
"self",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.query_cached_package_list | Return list of pickled package names from PYPI | yolk/pypi.py | def query_cached_package_list(self):
"""Return list of pickled package names from PYPI"""
if self.debug:
self.logger.debug("DEBUG: reading pickled cache file")
return cPickle.load(open(self.pkg_cache_file, "r")) | def query_cached_package_list(self):
"""Return list of pickled package names from PYPI"""
if self.debug:
self.logger.debug("DEBUG: reading pickled cache file")
return cPickle.load(open(self.pkg_cache_file, "r")) | [
"Return",
"list",
"of",
"pickled",
"package",
"names",
"from",
"PYPI"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L202-L206 | [
"def",
"query_cached_package_list",
"(",
"self",
")",
":",
"if",
"self",
".",
"debug",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"DEBUG: reading pickled cache file\"",
")",
"return",
"cPickle",
".",
"load",
"(",
"open",
"(",
"self",
".",
"pkg_cache_file... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.fetch_pkg_list | Fetch and cache master list of package names from PYPI | yolk/pypi.py | def fetch_pkg_list(self):
"""Fetch and cache master list of package names from PYPI"""
self.logger.debug("DEBUG: Fetching package name list from PyPI")
package_list = self.list_packages()
cPickle.dump(package_list, open(self.pkg_cache_file, "w"))
self.pkg_list = package_list | def fetch_pkg_list(self):
"""Fetch and cache master list of package names from PYPI"""
self.logger.debug("DEBUG: Fetching package name list from PyPI")
package_list = self.list_packages()
cPickle.dump(package_list, open(self.pkg_cache_file, "w"))
self.pkg_list = package_list | [
"Fetch",
"and",
"cache",
"master",
"list",
"of",
"package",
"names",
"from",
"PYPI"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L208-L213 | [
"def",
"fetch_pkg_list",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"DEBUG: Fetching package name list from PyPI\"",
")",
"package_list",
"=",
"self",
".",
"list_packages",
"(",
")",
"cPickle",
".",
"dump",
"(",
"package_list",
",",
"open... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.search | Query PYPI via XMLRPC interface using search spec | yolk/pypi.py | def search(self, spec, operator):
'''Query PYPI via XMLRPC interface using search spec'''
return self.xmlrpc.search(spec, operator.lower()) | def search(self, spec, operator):
'''Query PYPI via XMLRPC interface using search spec'''
return self.xmlrpc.search(spec, operator.lower()) | [
"Query",
"PYPI",
"via",
"XMLRPC",
"interface",
"using",
"search",
"spec"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L215-L217 | [
"def",
"search",
"(",
"self",
",",
"spec",
",",
"operator",
")",
":",
"return",
"self",
".",
"xmlrpc",
".",
"search",
"(",
"spec",
",",
"operator",
".",
"lower",
"(",
")",
")"
] | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.release_data | Query PYPI via XMLRPC interface for a pkg's metadata | yolk/pypi.py | def release_data(self, package_name, version):
"""Query PYPI via XMLRPC interface for a pkg's metadata"""
try:
return self.xmlrpc.release_data(package_name, version)
except xmlrpclib.Fault:
#XXX Raises xmlrpclib.Fault if you give non-existant version
#Could th... | def release_data(self, package_name, version):
"""Query PYPI via XMLRPC interface for a pkg's metadata"""
try:
return self.xmlrpc.release_data(package_name, version)
except xmlrpclib.Fault:
#XXX Raises xmlrpclib.Fault if you give non-existant version
#Could th... | [
"Query",
"PYPI",
"via",
"XMLRPC",
"interface",
"for",
"a",
"pkg",
"s",
"metadata"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L236-L243 | [
"def",
"release_data",
"(",
"self",
",",
"package_name",
",",
"version",
")",
":",
"try",
":",
"return",
"self",
".",
"xmlrpc",
".",
"release_data",
"(",
"package_name",
",",
"version",
")",
"except",
"xmlrpclib",
".",
"Fault",
":",
"#XXX Raises xmlrpclib.Faul... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.package_releases | Query PYPI via XMLRPC interface for a pkg's available versions | yolk/pypi.py | def package_releases(self, package_name):
"""Query PYPI via XMLRPC interface for a pkg's available versions"""
if self.debug:
self.logger.debug("DEBUG: querying PyPI for versions of " \
+ package_name)
return self.xmlrpc.package_releases(package_name) | def package_releases(self, package_name):
"""Query PYPI via XMLRPC interface for a pkg's available versions"""
if self.debug:
self.logger.debug("DEBUG: querying PyPI for versions of " \
+ package_name)
return self.xmlrpc.package_releases(package_name) | [
"Query",
"PYPI",
"via",
"XMLRPC",
"interface",
"for",
"a",
"pkg",
"s",
"available",
"versions"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L245-L250 | [
"def",
"package_releases",
"(",
"self",
",",
"package_name",
")",
":",
"if",
"self",
".",
"debug",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"DEBUG: querying PyPI for versions of \"",
"+",
"package_name",
")",
"return",
"self",
".",
"xmlrpc",
".",
"pack... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | CheeseShop.get_download_urls | Query PyPI for pkg download URI for a packge | yolk/pypi.py | def get_download_urls(self, package_name, version="", pkg_type="all"):
"""Query PyPI for pkg download URI for a packge"""
if version:
versions = [version]
else:
#If they don't specify version, show em all.
(package_name, versions) = self.query_versions_pypi... | def get_download_urls(self, package_name, version="", pkg_type="all"):
"""Query PyPI for pkg download URI for a packge"""
if version:
versions = [version]
else:
#If they don't specify version, show em all.
(package_name, versions) = self.query_versions_pypi... | [
"Query",
"PyPI",
"for",
"pkg",
"download",
"URI",
"for",
"a",
"packge"
] | cakebread/yolk | python | https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L252-L286 | [
"def",
"get_download_urls",
"(",
"self",
",",
"package_name",
",",
"version",
"=",
"\"\"",
",",
"pkg_type",
"=",
"\"all\"",
")",
":",
"if",
"version",
":",
"versions",
"=",
"[",
"version",
"]",
"else",
":",
"#If they don't specify version, show em all.",
"(",
... | ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8 |
train | Event.clone | Clone the event
Returns:
:class:`slack.events.Event` | slack/events.py | def clone(self) -> "Event":
"""
Clone the event
Returns:
:class:`slack.events.Event`
"""
return self.__class__(copy.deepcopy(self.event), copy.deepcopy(self.metadata)) | def clone(self) -> "Event":
"""
Clone the event
Returns:
:class:`slack.events.Event`
"""
return self.__class__(copy.deepcopy(self.event), copy.deepcopy(self.metadata)) | [
"Clone",
"the",
"event"
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L48-L56 | [
"def",
"clone",
"(",
"self",
")",
"->",
"\"Event\"",
":",
"return",
"self",
".",
"__class__",
"(",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"event",
")",
",",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"metadata",
")",
")"
] | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | Event.from_rtm | Create an event with data coming from the RTM API.
If the event type is a message a :class:`slack.events.Message` is returned.
Args:
raw_event: JSON decoded data from the RTM API
Returns:
:class:`slack.events.Event` or :class:`slack.events.Message` | slack/events.py | def from_rtm(cls, raw_event: MutableMapping) -> "Event":
"""
Create an event with data coming from the RTM API.
If the event type is a message a :class:`slack.events.Message` is returned.
Args:
raw_event: JSON decoded data from the RTM API
Returns:
:cla... | def from_rtm(cls, raw_event: MutableMapping) -> "Event":
"""
Create an event with data coming from the RTM API.
If the event type is a message a :class:`slack.events.Message` is returned.
Args:
raw_event: JSON decoded data from the RTM API
Returns:
:cla... | [
"Create",
"an",
"event",
"with",
"data",
"coming",
"from",
"the",
"RTM",
"API",
"."
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L59-L74 | [
"def",
"from_rtm",
"(",
"cls",
",",
"raw_event",
":",
"MutableMapping",
")",
"->",
"\"Event\"",
":",
"if",
"raw_event",
"[",
"\"type\"",
"]",
".",
"startswith",
"(",
"\"message\"",
")",
":",
"return",
"Message",
"(",
"raw_event",
")",
"else",
":",
"return"... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | Event.from_http | Create an event with data coming from the HTTP Event API.
If the event type is a message a :class:`slack.events.Message` is returned.
Args:
raw_body: Decoded body of the Event API request
verification_token: Slack verification token used to verify the request came from slack
... | slack/events.py | def from_http(
cls,
raw_body: MutableMapping,
verification_token: Optional[str] = None,
team_id: Optional[str] = None,
) -> "Event":
"""
Create an event with data coming from the HTTP Event API.
If the event type is a message a :class:`slack.events.Message` i... | def from_http(
cls,
raw_body: MutableMapping,
verification_token: Optional[str] = None,
team_id: Optional[str] = None,
) -> "Event":
"""
Create an event with data coming from the HTTP Event API.
If the event type is a message a :class:`slack.events.Message` i... | [
"Create",
"an",
"event",
"with",
"data",
"coming",
"from",
"the",
"HTTP",
"Event",
"API",
"."
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L77-L109 | [
"def",
"from_http",
"(",
"cls",
",",
"raw_body",
":",
"MutableMapping",
",",
"verification_token",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"team_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"->",
"\"Event\"",
":",
"if",
"ve... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | Message.response | Create a response message.
Depending on the incoming message the response can be in a thread. By default the response follow where the
incoming message was posted.
Args:
in_thread (boolean): Overwrite the `threading` behaviour
Returns:
a new :class:`slack.even... | slack/events.py | def response(self, in_thread: Optional[bool] = None) -> "Message":
"""
Create a response message.
Depending on the incoming message the response can be in a thread. By default the response follow where the
incoming message was posted.
Args:
in_thread (boolean): Over... | def response(self, in_thread: Optional[bool] = None) -> "Message":
"""
Create a response message.
Depending on the incoming message the response can be in a thread. By default the response follow where the
incoming message was posted.
Args:
in_thread (boolean): Over... | [
"Create",
"a",
"response",
"message",
"."
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L129-L157 | [
"def",
"response",
"(",
"self",
",",
"in_thread",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
")",
"->",
"\"Message\"",
":",
"data",
"=",
"{",
"\"channel\"",
":",
"self",
"[",
"\"channel\"",
"]",
"}",
"if",
"in_thread",
":",
"if",
"\"message\"",
"i... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | Message.serialize | Serialize the message for sending to slack API
Returns:
serialized message | slack/events.py | def serialize(self) -> dict:
"""
Serialize the message for sending to slack API
Returns:
serialized message
"""
data = {**self}
if "attachments" in self:
data["attachments"] = json.dumps(self["attachments"])
return data | def serialize(self) -> dict:
"""
Serialize the message for sending to slack API
Returns:
serialized message
"""
data = {**self}
if "attachments" in self:
data["attachments"] = json.dumps(self["attachments"])
return data | [
"Serialize",
"the",
"message",
"for",
"sending",
"to",
"slack",
"API"
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L159-L169 | [
"def",
"serialize",
"(",
"self",
")",
"->",
"dict",
":",
"data",
"=",
"{",
"*",
"*",
"self",
"}",
"if",
"\"attachments\"",
"in",
"self",
":",
"data",
"[",
"\"attachments\"",
"]",
"=",
"json",
".",
"dumps",
"(",
"self",
"[",
"\"attachments\"",
"]",
")... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | EventRouter.register | Register a new handler for a specific :class:`slack.events.Event` `type` (See `slack event types documentation
<https://api.slack.com/events>`_ for a list of event types).
The arbitrary keyword argument is used as a key/value pair to compare against what is in the incoming
:class:`slack.events.... | slack/events.py | def register(self, event_type: str, handler: Any, **detail: Any) -> None:
"""
Register a new handler for a specific :class:`slack.events.Event` `type` (See `slack event types documentation
<https://api.slack.com/events>`_ for a list of event types).
The arbitrary keyword argument is use... | def register(self, event_type: str, handler: Any, **detail: Any) -> None:
"""
Register a new handler for a specific :class:`slack.events.Event` `type` (See `slack event types documentation
<https://api.slack.com/events>`_ for a list of event types).
The arbitrary keyword argument is use... | [
"Register",
"a",
"new",
"handler",
"for",
"a",
"specific",
":",
"class",
":",
"slack",
".",
"events",
".",
"Event",
"type",
"(",
"See",
"slack",
"event",
"types",
"documentation",
"<https",
":",
"//",
"api",
".",
"slack",
".",
"com",
"/",
"events",
">"... | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L185-L212 | [
"def",
"register",
"(",
"self",
",",
"event_type",
":",
"str",
",",
"handler",
":",
"Any",
",",
"*",
"*",
"detail",
":",
"Any",
")",
"->",
"None",
":",
"LOG",
".",
"info",
"(",
"\"Registering %s, %s to %s\"",
",",
"event_type",
",",
"detail",
",",
"han... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | EventRouter.dispatch | Yields handlers matching the routing of the incoming :class:`slack.events.Event`.
Args:
event: :class:`slack.events.Event`
Yields:
handler | slack/events.py | def dispatch(self, event: Event) -> Iterator[Any]:
"""
Yields handlers matching the routing of the incoming :class:`slack.events.Event`.
Args:
event: :class:`slack.events.Event`
Yields:
handler
"""
LOG.debug('Dispatching event "%s"', event.get("t... | def dispatch(self, event: Event) -> Iterator[Any]:
"""
Yields handlers matching the routing of the incoming :class:`slack.events.Event`.
Args:
event: :class:`slack.events.Event`
Yields:
handler
"""
LOG.debug('Dispatching event "%s"', event.get("t... | [
"Yields",
"handlers",
"matching",
"the",
"routing",
"of",
"the",
"incoming",
":",
"class",
":",
"slack",
".",
"events",
".",
"Event",
"."
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L214-L232 | [
"def",
"dispatch",
"(",
"self",
",",
"event",
":",
"Event",
")",
"->",
"Iterator",
"[",
"Any",
"]",
":",
"LOG",
".",
"debug",
"(",
"'Dispatching event \"%s\"'",
",",
"event",
".",
"get",
"(",
"\"type\"",
")",
")",
"if",
"event",
"[",
"\"type\"",
"]",
... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | MessageRouter.register | Register a new handler for a specific :class:`slack.events.Message`.
The routing is based on regex pattern matching the message text and the incoming slack channel.
Args:
pattern: Regex pattern matching the message text.
handler: Callback
flags: Regex flags.
... | slack/events.py | def register(
self,
pattern: str,
handler: Any,
flags: int = 0,
channel: str = "*",
subtype: Optional[str] = None,
) -> None:
"""
Register a new handler for a specific :class:`slack.events.Message`.
The routing is based on regex pattern matchi... | def register(
self,
pattern: str,
handler: Any,
flags: int = 0,
channel: str = "*",
subtype: Optional[str] = None,
) -> None:
"""
Register a new handler for a specific :class:`slack.events.Message`.
The routing is based on regex pattern matchi... | [
"Register",
"a",
"new",
"handler",
"for",
"a",
"specific",
":",
"class",
":",
"slack",
".",
"events",
".",
"Message",
"."
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L247-L276 | [
"def",
"register",
"(",
"self",
",",
"pattern",
":",
"str",
",",
"handler",
":",
"Any",
",",
"flags",
":",
"int",
"=",
"0",
",",
"channel",
":",
"str",
"=",
"\"*\"",
",",
"subtype",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"->",
... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | MessageRouter.dispatch | Yields handlers matching the routing of the incoming :class:`slack.events.Message`
Args:
message: :class:`slack.events.Message`
Yields:
handler | slack/events.py | def dispatch(self, message: Message) -> Iterator[Any]:
"""
Yields handlers matching the routing of the incoming :class:`slack.events.Message`
Args:
message: :class:`slack.events.Message`
Yields:
handler
"""
if "text" in message:
text ... | def dispatch(self, message: Message) -> Iterator[Any]:
"""
Yields handlers matching the routing of the incoming :class:`slack.events.Message`
Args:
message: :class:`slack.events.Message`
Yields:
handler
"""
if "text" in message:
text ... | [
"Yields",
"handlers",
"matching",
"the",
"routing",
"of",
"the",
"incoming",
":",
"class",
":",
"slack",
".",
"events",
".",
"Message"
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/events.py#L278-L303 | [
"def",
"dispatch",
"(",
"self",
",",
"message",
":",
"Message",
")",
"->",
"Iterator",
"[",
"Any",
"]",
":",
"if",
"\"text\"",
"in",
"message",
":",
"text",
"=",
"message",
"[",
"\"text\"",
"]",
"or",
"\"\"",
"elif",
"\"message\"",
"in",
"message",
":"... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | SlackAPI.query | Query the slack API
When using :class:`slack.methods` the request is made `as_json` if available
Args:
url: :class:`slack.methods` or url string
data: JSON encodable MutableMapping
headers: Custom headers
as_json: Post JSON to the slack API
Retur... | slack/io/requests.py | def query( # type: ignore
self,
url: Union[str, methods],
data: Optional[MutableMapping] = None,
headers: Optional[MutableMapping] = None,
as_json: Optional[bool] = None,
) -> dict:
"""
Query the slack API
When using :class:`slack.methods` the reques... | def query( # type: ignore
self,
url: Union[str, methods],
data: Optional[MutableMapping] = None,
headers: Optional[MutableMapping] = None,
as_json: Optional[bool] = None,
) -> dict:
"""
Query the slack API
When using :class:`slack.methods` the reques... | [
"Query",
"the",
"slack",
"API"
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/io/requests.py#L65-L93 | [
"def",
"query",
"(",
"# type: ignore",
"self",
",",
"url",
":",
"Union",
"[",
"str",
",",
"methods",
"]",
",",
"data",
":",
"Optional",
"[",
"MutableMapping",
"]",
"=",
"None",
",",
"headers",
":",
"Optional",
"[",
"MutableMapping",
"]",
"=",
"None",
"... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | SlackAPI.rtm | Iterate over event from the RTM API
Args:
url: Websocket connection url
bot_id: Connecting bot ID
Returns:
:class:`slack.events.Event` or :class:`slack.events.Message` | slack/io/requests.py | def rtm( # type: ignore
self, url: Optional[str] = None, bot_id: Optional[str] = None
) -> Iterator[events.Event]:
"""
Iterate over event from the RTM API
Args:
url: Websocket connection url
bot_id: Connecting bot ID
Returns:
:class:`sla... | def rtm( # type: ignore
self, url: Optional[str] = None, bot_id: Optional[str] = None
) -> Iterator[events.Event]:
"""
Iterate over event from the RTM API
Args:
url: Websocket connection url
bot_id: Connecting bot ID
Returns:
:class:`sla... | [
"Iterate",
"over",
"event",
"from",
"the",
"RTM",
"API"
] | pyslackers/slack-sansio | python | https://github.com/pyslackers/slack-sansio/blob/068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab/slack/io/requests.py#L159-L178 | [
"def",
"rtm",
"(",
"# type: ignore",
"self",
",",
"url",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"bot_id",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Iterator",
"[",
"events",
".",
"Event",
"]",
":",
"while",
"True",
":"... | 068ddd6480c6d2f9bf14fa4db498c9fe1017f4ab |
train | RateLimitAdminSite.login | Displays the login form for the given HttpRequest. | ratelimitbackend/admin.py | def login(self, request, extra_context=None):
"""
Displays the login form for the given HttpRequest.
"""
context = {
'title': _('Log in'),
'app_path': request.get_full_path(),
}
if (REDIRECT_FIELD_NAME not in request.GET and
REDIREC... | def login(self, request, extra_context=None):
"""
Displays the login form for the given HttpRequest.
"""
context = {
'title': _('Log in'),
'app_path': request.get_full_path(),
}
if (REDIRECT_FIELD_NAME not in request.GET and
REDIREC... | [
"Displays",
"the",
"login",
"form",
"for",
"the",
"given",
"HttpRequest",
"."
] | brutasse/django-ratelimit-backend | python | https://github.com/brutasse/django-ratelimit-backend/blob/1f8f485c139eb8067f0d821ff77df98038ab9448/ratelimitbackend/admin.py#L13-L31 | [
"def",
"login",
"(",
"self",
",",
"request",
",",
"extra_context",
"=",
"None",
")",
":",
"context",
"=",
"{",
"'title'",
":",
"_",
"(",
"'Log in'",
")",
",",
"'app_path'",
":",
"request",
".",
"get_full_path",
"(",
")",
",",
"}",
"if",
"(",
"REDIREC... | 1f8f485c139eb8067f0d821ff77df98038ab9448 |
train | get_config | Get configuration from a file. | leadbutt.py | def get_config(config_file):
"""Get configuration from a file."""
def load(fp):
try:
return yaml.safe_load(fp)
except yaml.YAMLError as e:
sys.stderr.write(text_type(e))
sys.exit(1) # TODO document exit codes
if config_file == '-':
return load(sy... | def get_config(config_file):
"""Get configuration from a file."""
def load(fp):
try:
return yaml.safe_load(fp)
except yaml.YAMLError as e:
sys.stderr.write(text_type(e))
sys.exit(1) # TODO document exit codes
if config_file == '-':
return load(sy... | [
"Get",
"configuration",
"from",
"a",
"file",
"."
] | crccheck/cloudwatch-to-graphite | python | https://github.com/crccheck/cloudwatch-to-graphite/blob/28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6/leadbutt.py#L51-L67 | [
"def",
"get_config",
"(",
"config_file",
")",
":",
"def",
"load",
"(",
"fp",
")",
":",
"try",
":",
"return",
"yaml",
".",
"safe_load",
"(",
"fp",
")",
"except",
"yaml",
".",
"YAMLError",
"as",
"e",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"tex... | 28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6 |
train | get_options | Figure out what options to use based on the four places it can come from.
Order of precedence:
* cli_options specified by the user at the command line
* local_options specified in the config file for the metric
* config_options specified in the config file at the base
* DEFAULT_OPTIONS h... | leadbutt.py | def get_options(config_options, local_options, cli_options):
"""
Figure out what options to use based on the four places it can come from.
Order of precedence:
* cli_options specified by the user at the command line
* local_options specified in the config file for the metric
* config_op... | def get_options(config_options, local_options, cli_options):
"""
Figure out what options to use based on the four places it can come from.
Order of precedence:
* cli_options specified by the user at the command line
* local_options specified in the config file for the metric
* config_op... | [
"Figure",
"out",
"what",
"options",
"to",
"use",
"based",
"on",
"the",
"four",
"places",
"it",
"can",
"come",
"from",
"."
] | crccheck/cloudwatch-to-graphite | python | https://github.com/crccheck/cloudwatch-to-graphite/blob/28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6/leadbutt.py#L70-L87 | [
"def",
"get_options",
"(",
"config_options",
",",
"local_options",
",",
"cli_options",
")",
":",
"options",
"=",
"DEFAULT_OPTIONS",
".",
"copy",
"(",
")",
"if",
"config_options",
"is",
"not",
"None",
":",
"options",
".",
"update",
"(",
"config_options",
")",
... | 28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6 |
train | output_results | Output the results to stdout.
TODO: add AMPQ support for efficiency | leadbutt.py | def output_results(results, metric, options):
"""
Output the results to stdout.
TODO: add AMPQ support for efficiency
"""
formatter = options['Formatter']
context = metric.copy() # XXX might need to sanitize this
try:
context['dimension'] = list(metric['Dimensions'].values())[0]
... | def output_results(results, metric, options):
"""
Output the results to stdout.
TODO: add AMPQ support for efficiency
"""
formatter = options['Formatter']
context = metric.copy() # XXX might need to sanitize this
try:
context['dimension'] = list(metric['Dimensions'].values())[0]
... | [
"Output",
"the",
"results",
"to",
"stdout",
"."
] | crccheck/cloudwatch-to-graphite | python | https://github.com/crccheck/cloudwatch-to-graphite/blob/28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6/leadbutt.py#L90-L117 | [
"def",
"output_results",
"(",
"results",
",",
"metric",
",",
"options",
")",
":",
"formatter",
"=",
"options",
"[",
"'Formatter'",
"]",
"context",
"=",
"metric",
".",
"copy",
"(",
")",
"# XXX might need to sanitize this",
"try",
":",
"context",
"[",
"'dimensio... | 28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6 |
train | GoogleStorageIO.download_to_path | This method is analogous to "gsutil cp gsuri localpath", but in a
programatically accesible way. The only difference is that we
have to make a guess about the encoding of the file to not upset
downstream file operations. If you are downloading a VCF, then
"False" is great. If this is a B... | cohorts/io/gcloud_storage.py | def download_to_path(self, gsuri, localpath, binary_mode=False, tmpdir=None):
"""
This method is analogous to "gsutil cp gsuri localpath", but in a
programatically accesible way. The only difference is that we
have to make a guess about the encoding of the file to not upset
downs... | def download_to_path(self, gsuri, localpath, binary_mode=False, tmpdir=None):
"""
This method is analogous to "gsutil cp gsuri localpath", but in a
programatically accesible way. The only difference is that we
have to make a guess about the encoding of the file to not upset
downs... | [
"This",
"method",
"is",
"analogous",
"to",
"gsutil",
"cp",
"gsuri",
"localpath",
"but",
"in",
"a",
"programatically",
"accesible",
"way",
".",
"The",
"only",
"difference",
"is",
"that",
"we",
"have",
"to",
"make",
"a",
"guess",
"about",
"the",
"encoding",
... | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/io/gcloud_storage.py#L97-L136 | [
"def",
"download_to_path",
"(",
"self",
",",
"gsuri",
",",
"localpath",
",",
"binary_mode",
"=",
"False",
",",
"tmpdir",
"=",
"None",
")",
":",
"bucket_name",
",",
"gs_rel_path",
"=",
"self",
".",
"parse_uri",
"(",
"gsuri",
")",
"# And now request the handles ... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | round_float | Accurate float rounding from http://stackoverflow.com/a/15398691. | cohorts/rounding.py | def round_float(f, digits, rounding=ROUND_HALF_UP):
"""
Accurate float rounding from http://stackoverflow.com/a/15398691.
"""
return Decimal(str(f)).quantize(Decimal(10) ** (-1 * digits),
rounding=rounding) | def round_float(f, digits, rounding=ROUND_HALF_UP):
"""
Accurate float rounding from http://stackoverflow.com/a/15398691.
"""
return Decimal(str(f)).quantize(Decimal(10) ** (-1 * digits),
rounding=rounding) | [
"Accurate",
"float",
"rounding",
"from",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"15398691",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/rounding.py#L17-L22 | [
"def",
"round_float",
"(",
"f",
",",
"digits",
",",
"rounding",
"=",
"ROUND_HALF_UP",
")",
":",
"return",
"Decimal",
"(",
"str",
"(",
"f",
")",
")",
".",
"quantize",
"(",
"Decimal",
"(",
"10",
")",
"**",
"(",
"-",
"1",
"*",
"digits",
")",
",",
"r... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | float_str | Returns a string representing a float, where the number of
significant digits is min_digits unless it takes more digits
to hit a non-zero digit (and the number is 0 < x < 1).
We stop looking for a non-zero digit after max_digits. | cohorts/rounding.py | def float_str(f, min_digits=2, max_digits=6):
"""
Returns a string representing a float, where the number of
significant digits is min_digits unless it takes more digits
to hit a non-zero digit (and the number is 0 < x < 1).
We stop looking for a non-zero digit after max_digits.
"""
if f >= ... | def float_str(f, min_digits=2, max_digits=6):
"""
Returns a string representing a float, where the number of
significant digits is min_digits unless it takes more digits
to hit a non-zero digit (and the number is 0 < x < 1).
We stop looking for a non-zero digit after max_digits.
"""
if f >= ... | [
"Returns",
"a",
"string",
"representing",
"a",
"float",
"where",
"the",
"number",
"of",
"significant",
"digits",
"is",
"min_digits",
"unless",
"it",
"takes",
"more",
"digits",
"to",
"hit",
"a",
"non",
"-",
"zero",
"digit",
"(",
"and",
"the",
"number",
"is"... | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/rounding.py#L24-L46 | [
"def",
"float_str",
"(",
"f",
",",
"min_digits",
"=",
"2",
",",
"max_digits",
"=",
"6",
")",
":",
"if",
"f",
">=",
"1",
"or",
"f",
"<=",
"0",
":",
"return",
"str",
"(",
"round_float",
"(",
"f",
",",
"min_digits",
")",
")",
"start_str",
"=",
"str"... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | UserFormatter.default_format | Returns full name (first and last) if name is available.
If not, returns username if available.
If not available too, returns the user id as a string. | bot/action/util/format.py | def default_format(self):
"""
Returns full name (first and last) if name is available.
If not, returns username if available.
If not available too, returns the user id as a string.
"""
user = self.user
if user.first_name is not None:
return self.full_n... | def default_format(self):
"""
Returns full name (first and last) if name is available.
If not, returns username if available.
If not available too, returns the user id as a string.
"""
user = self.user
if user.first_name is not None:
return self.full_n... | [
"Returns",
"full",
"name",
"(",
"first",
"and",
"last",
")",
"if",
"name",
"is",
"available",
".",
"If",
"not",
"returns",
"username",
"if",
"available",
".",
"If",
"not",
"available",
"too",
"returns",
"the",
"user",
"id",
"as",
"a",
"string",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/util/format.py#L31-L43 | [
"def",
"default_format",
"(",
"self",
")",
":",
"user",
"=",
"self",
".",
"user",
"if",
"user",
".",
"first_name",
"is",
"not",
"None",
":",
"return",
"self",
".",
"full_name",
"elif",
"user",
".",
"username",
"is",
"not",
"None",
":",
"return",
"user"... | 7b597a415c1901901c677976cb13100fc3083107 |
train | UserFormatter.full_name | Returns the first and last name of the user separated by a space. | bot/action/util/format.py | def full_name(self):
"""
Returns the first and last name of the user separated by a space.
"""
formatted_user = []
if self.user.first_name is not None:
formatted_user.append(self.user.first_name)
if self.user.last_name is not None:
formatted_user.a... | def full_name(self):
"""
Returns the first and last name of the user separated by a space.
"""
formatted_user = []
if self.user.first_name is not None:
formatted_user.append(self.user.first_name)
if self.user.last_name is not None:
formatted_user.a... | [
"Returns",
"the",
"first",
"and",
"last",
"name",
"of",
"the",
"user",
"separated",
"by",
"a",
"space",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/util/format.py#L46-L55 | [
"def",
"full_name",
"(",
"self",
")",
":",
"formatted_user",
"=",
"[",
"]",
"if",
"self",
".",
"user",
".",
"first_name",
"is",
"not",
"None",
":",
"formatted_user",
".",
"append",
"(",
"self",
".",
"user",
".",
"first_name",
")",
"if",
"self",
".",
... | 7b597a415c1901901c677976cb13100fc3083107 |
train | UserFormatter.full_format | Returns the full name (first and last parts), and the username between brackets if the user has it.
If there is no info about the user, returns the user id between < and >. | bot/action/util/format.py | def full_format(self):
"""
Returns the full name (first and last parts), and the username between brackets if the user has it.
If there is no info about the user, returns the user id between < and >.
"""
formatted_user = self.full_name
if self.user.username is not None:
... | def full_format(self):
"""
Returns the full name (first and last parts), and the username between brackets if the user has it.
If there is no info about the user, returns the user id between < and >.
"""
formatted_user = self.full_name
if self.user.username is not None:
... | [
"Returns",
"the",
"full",
"name",
"(",
"first",
"and",
"last",
"parts",
")",
"and",
"the",
"username",
"between",
"brackets",
"if",
"the",
"user",
"has",
"it",
".",
"If",
"there",
"is",
"no",
"info",
"about",
"the",
"user",
"returns",
"the",
"user",
"i... | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/util/format.py#L66-L76 | [
"def",
"full_format",
"(",
"self",
")",
":",
"formatted_user",
"=",
"self",
".",
"full_name",
"if",
"self",
".",
"user",
".",
"username",
"is",
"not",
"None",
":",
"formatted_user",
"+=",
"\" [\"",
"+",
"self",
".",
"user",
".",
"username",
"+",
"\"]\"",... | 7b597a415c1901901c677976cb13100fc3083107 |
train | UserFormatter.full_data | Returns all the info available for the user in the following format:
name [username] <id> (locale) bot_or_user
If any data is not available, it is not added. | bot/action/util/format.py | def full_data(self):
"""
Returns all the info available for the user in the following format:
name [username] <id> (locale) bot_or_user
If any data is not available, it is not added.
"""
data = [
self.full_name,
self._username(),
se... | def full_data(self):
"""
Returns all the info available for the user in the following format:
name [username] <id> (locale) bot_or_user
If any data is not available, it is not added.
"""
data = [
self.full_name,
self._username(),
se... | [
"Returns",
"all",
"the",
"info",
"available",
"for",
"the",
"user",
"in",
"the",
"following",
"format",
":",
"name",
"[",
"username",
"]",
"<id",
">",
"(",
"locale",
")",
"bot_or_user",
"If",
"any",
"data",
"is",
"not",
"available",
"it",
"is",
"not",
... | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/util/format.py#L79-L92 | [
"def",
"full_data",
"(",
"self",
")",
":",
"data",
"=",
"[",
"self",
".",
"full_name",
",",
"self",
".",
"_username",
"(",
")",
",",
"self",
".",
"_id",
"(",
")",
",",
"self",
".",
"_language_code",
"(",
")",
",",
"self",
".",
"_is_bot",
"(",
")"... | 7b597a415c1901901c677976cb13100fc3083107 |
train | ChatFormatter.full_data | Returns all the info available for the chat in the following format:
title [username] (type) <id>
If any data is not available, it is not added. | bot/action/util/format.py | def full_data(self):
"""
Returns all the info available for the chat in the following format:
title [username] (type) <id>
If any data is not available, it is not added.
"""
data = [
self.chat.title,
self._username(),
self._type(),
... | def full_data(self):
"""
Returns all the info available for the chat in the following format:
title [username] (type) <id>
If any data is not available, it is not added.
"""
data = [
self.chat.title,
self._username(),
self._type(),
... | [
"Returns",
"all",
"the",
"info",
"available",
"for",
"the",
"chat",
"in",
"the",
"following",
"format",
":",
"title",
"[",
"username",
"]",
"(",
"type",
")",
"<id",
">",
"If",
"any",
"data",
"is",
"not",
"available",
"it",
"is",
"not",
"added",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/util/format.py#L124-L136 | [
"def",
"full_data",
"(",
"self",
")",
":",
"data",
"=",
"[",
"self",
".",
"chat",
".",
"title",
",",
"self",
".",
"_username",
"(",
")",
",",
"self",
".",
"_type",
"(",
")",
",",
"self",
".",
"_id",
"(",
")",
"]",
"return",
"\" \"",
".",
"join"... | 7b597a415c1901901c677976cb13100fc3083107 |
train | use_defaults | Decorator for functions that should automatically fall back to the Cohort-default filter_fn and
normalized_per_mb if not specified. | cohorts/functions.py | def use_defaults(func):
"""
Decorator for functions that should automatically fall back to the Cohort-default filter_fn and
normalized_per_mb if not specified.
"""
@wraps(func)
def wrapper(row, cohort, filter_fn=None, normalized_per_mb=None, **kwargs):
filter_fn = first_not_none_param([f... | def use_defaults(func):
"""
Decorator for functions that should automatically fall back to the Cohort-default filter_fn and
normalized_per_mb if not specified.
"""
@wraps(func)
def wrapper(row, cohort, filter_fn=None, normalized_per_mb=None, **kwargs):
filter_fn = first_not_none_param([f... | [
"Decorator",
"for",
"functions",
"that",
"should",
"automatically",
"fall",
"back",
"to",
"the",
"Cohort",
"-",
"default",
"filter_fn",
"and",
"normalized_per_mb",
"if",
"not",
"specified",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/functions.py#L28-L42 | [
"def",
"use_defaults",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"row",
",",
"cohort",
",",
"filter_fn",
"=",
"None",
",",
"normalized_per_mb",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"filter_fn",
"=",
"fir... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | count_function | Decorator for functions that return a collection (technically a dict of collections) that should be
counted up. Also automatically falls back to the Cohort-default filter_fn and normalized_per_mb if
not specified. | cohorts/functions.py | def count_function(func):
"""
Decorator for functions that return a collection (technically a dict of collections) that should be
counted up. Also automatically falls back to the Cohort-default filter_fn and normalized_per_mb if
not specified.
"""
# Fall back to Cohort-level defaults.
@use_d... | def count_function(func):
"""
Decorator for functions that return a collection (technically a dict of collections) that should be
counted up. Also automatically falls back to the Cohort-default filter_fn and normalized_per_mb if
not specified.
"""
# Fall back to Cohort-level defaults.
@use_d... | [
"Decorator",
"for",
"functions",
"that",
"return",
"a",
"collection",
"(",
"technically",
"a",
"dict",
"of",
"collections",
")",
"that",
"should",
"be",
"counted",
"up",
".",
"Also",
"automatically",
"falls",
"back",
"to",
"the",
"Cohort",
"-",
"default",
"f... | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/functions.py#L44-L66 | [
"def",
"count_function",
"(",
"func",
")",
":",
"# Fall back to Cohort-level defaults.",
"@",
"use_defaults",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"row",
",",
"cohort",
",",
"filter_fn",
"=",
"None",
",",
"normalized_per_mb",
"=",
"None",
","... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | count_variants_function_builder | Creates a function that counts variants that are filtered by the provided filterable_variant_function.
The filterable_variant_function is a function that takes a filterable_variant and returns True or False.
Users of this builder need not worry about applying e.g. the Cohort's default `filter_fn`. That will be... | cohorts/functions.py | def count_variants_function_builder(function_name, filterable_variant_function=None):
"""
Creates a function that counts variants that are filtered by the provided filterable_variant_function.
The filterable_variant_function is a function that takes a filterable_variant and returns True or False.
Users... | def count_variants_function_builder(function_name, filterable_variant_function=None):
"""
Creates a function that counts variants that are filtered by the provided filterable_variant_function.
The filterable_variant_function is a function that takes a filterable_variant and returns True or False.
Users... | [
"Creates",
"a",
"function",
"that",
"counts",
"variants",
"that",
"are",
"filtered",
"by",
"the",
"provided",
"filterable_variant_function",
".",
"The",
"filterable_variant_function",
"is",
"a",
"function",
"that",
"takes",
"a",
"filterable_variant",
"and",
"returns",... | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/functions.py#L73-L93 | [
"def",
"count_variants_function_builder",
"(",
"function_name",
",",
"filterable_variant_function",
"=",
"None",
")",
":",
"@",
"count_function",
"def",
"count",
"(",
"row",
",",
"cohort",
",",
"filter_fn",
",",
"normalized_per_mb",
",",
"*",
"*",
"kwargs",
")",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | count_effects_function_builder | Create a function that counts effects that are filtered by the provided filterable_effect_function.
The filterable_effect_function is a function that takes a filterable_effect and returns True or False.
Users of this builder need not worry about applying e.g. the Cohort's default `filter_fn`. That will be appl... | cohorts/functions.py | def count_effects_function_builder(function_name, only_nonsynonymous, filterable_effect_function=None):
"""
Create a function that counts effects that are filtered by the provided filterable_effect_function.
The filterable_effect_function is a function that takes a filterable_effect and returns True or Fals... | def count_effects_function_builder(function_name, only_nonsynonymous, filterable_effect_function=None):
"""
Create a function that counts effects that are filtered by the provided filterable_effect_function.
The filterable_effect_function is a function that takes a filterable_effect and returns True or Fals... | [
"Create",
"a",
"function",
"that",
"counts",
"effects",
"that",
"are",
"filtered",
"by",
"the",
"provided",
"filterable_effect_function",
".",
"The",
"filterable_effect_function",
"is",
"a",
"function",
"that",
"takes",
"a",
"filterable_effect",
"and",
"returns",
"T... | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/functions.py#L95-L121 | [
"def",
"count_effects_function_builder",
"(",
"function_name",
",",
"only_nonsynonymous",
",",
"filterable_effect_function",
"=",
"None",
")",
":",
"@",
"count_function",
"def",
"count",
"(",
"row",
",",
"cohort",
",",
"filter_fn",
",",
"normalized_per_mb",
",",
"*"... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | median_vaf_purity | Estimate purity based on 2 * median VAF.
Even if the Cohort has a default filter_fn, ignore it: we want to use all variants for
this estimate. | cohorts/functions.py | def median_vaf_purity(row, cohort, **kwargs):
"""
Estimate purity based on 2 * median VAF.
Even if the Cohort has a default filter_fn, ignore it: we want to use all variants for
this estimate.
"""
patient_id = row["patient_id"]
patient = cohort.patient_from_id(patient_id)
variants = coh... | def median_vaf_purity(row, cohort, **kwargs):
"""
Estimate purity based on 2 * median VAF.
Even if the Cohort has a default filter_fn, ignore it: we want to use all variants for
this estimate.
"""
patient_id = row["patient_id"]
patient = cohort.patient_from_id(patient_id)
variants = coh... | [
"Estimate",
"purity",
"based",
"on",
"2",
"*",
"median",
"VAF",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/functions.py#L264-L282 | [
"def",
"median_vaf_purity",
"(",
"row",
",",
"cohort",
",",
"*",
"*",
"kwargs",
")",
":",
"patient_id",
"=",
"row",
"[",
"\"patient_id\"",
"]",
"patient",
"=",
"cohort",
".",
"patient_from_id",
"(",
"patient_id",
")",
"variants",
"=",
"cohort",
".",
"load_... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | bootstrap_auc | Calculate the boostrapped AUC for a given col trying to predict a pred_col.
Parameters
----------
df : pandas.DataFrame
col : str
column to retrieve the values from
pred_col : str
the column we're trying to predict
n_boostrap : int
the number of bootstrap samples
Re... | cohorts/model.py | def bootstrap_auc(df, col, pred_col, n_bootstrap=1000):
"""
Calculate the boostrapped AUC for a given col trying to predict a pred_col.
Parameters
----------
df : pandas.DataFrame
col : str
column to retrieve the values from
pred_col : str
the column we're trying to predict
... | def bootstrap_auc(df, col, pred_col, n_bootstrap=1000):
"""
Calculate the boostrapped AUC for a given col trying to predict a pred_col.
Parameters
----------
df : pandas.DataFrame
col : str
column to retrieve the values from
pred_col : str
the column we're trying to predict
... | [
"Calculate",
"the",
"boostrapped",
"AUC",
"for",
"a",
"given",
"col",
"trying",
"to",
"predict",
"a",
"pred_col",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/model.py#L36-L66 | [
"def",
"bootstrap_auc",
"(",
"df",
",",
"col",
",",
"pred_col",
",",
"n_bootstrap",
"=",
"1000",
")",
":",
"scores",
"=",
"np",
".",
"zeros",
"(",
"n_bootstrap",
")",
"old_len",
"=",
"len",
"(",
"df",
")",
"df",
".",
"dropna",
"(",
"subset",
"=",
"... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | SchedulerApi.set_callbacks | :param are_async: True if the callbacks execute asynchronously, posting any heavy work to another thread. | bot/multithreading/scheduler.py | def set_callbacks(self, worker_start_callback: callable, worker_end_callback: callable, are_async: bool = False):
"""
:param are_async: True if the callbacks execute asynchronously, posting any heavy work to another thread.
"""
# We are setting self.worker_start_callback and self.worker_... | def set_callbacks(self, worker_start_callback: callable, worker_end_callback: callable, are_async: bool = False):
"""
:param are_async: True if the callbacks execute asynchronously, posting any heavy work to another thread.
"""
# We are setting self.worker_start_callback and self.worker_... | [
":",
"param",
"are_async",
":",
"True",
"if",
"the",
"callbacks",
"execute",
"asynchronously",
"posting",
"any",
"heavy",
"work",
"to",
"another",
"thread",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/multithreading/scheduler.py#L59-L80 | [
"def",
"set_callbacks",
"(",
"self",
",",
"worker_start_callback",
":",
"callable",
",",
"worker_end_callback",
":",
"callable",
",",
"are_async",
":",
"bool",
"=",
"False",
")",
":",
"# We are setting self.worker_start_callback and self.worker_end_callback",
"# to lambdas ... | 7b597a415c1901901c677976cb13100fc3083107 |
train | SchedulerApi._start_worker | Can be safely called multiple times on the same worker (for workers that support it)
to start a new thread for it. | bot/multithreading/scheduler.py | def _start_worker(self, worker: Worker):
"""
Can be safely called multiple times on the same worker (for workers that support it)
to start a new thread for it.
"""
# This function is called from main thread and from worker pools threads to start their children threads
wit... | def _start_worker(self, worker: Worker):
"""
Can be safely called multiple times on the same worker (for workers that support it)
to start a new thread for it.
"""
# This function is called from main thread and from worker pools threads to start their children threads
wit... | [
"Can",
"be",
"safely",
"called",
"multiple",
"times",
"on",
"the",
"same",
"worker",
"(",
"for",
"workers",
"that",
"support",
"it",
")",
"to",
"start",
"a",
"new",
"thread",
"for",
"it",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/multithreading/scheduler.py#L95-L106 | [
"def",
"_start_worker",
"(",
"self",
",",
"worker",
":",
"Worker",
")",
":",
"# This function is called from main thread and from worker pools threads to start their children threads",
"with",
"self",
".",
"running_workers_lock",
":",
"self",
".",
"running_workers",
".",
"app... | 7b597a415c1901901c677976cb13100fc3083107 |
train | SchedulerApi.new_worker | Creates a new Worker and start a new Thread with it. Returns the Worker. | bot/multithreading/scheduler.py | def new_worker(self, name: str):
"""Creates a new Worker and start a new Thread with it. Returns the Worker."""
if not self.running:
return self.immediate_worker
worker = self._new_worker(name)
self._start_worker(worker)
return worker | def new_worker(self, name: str):
"""Creates a new Worker and start a new Thread with it. Returns the Worker."""
if not self.running:
return self.immediate_worker
worker = self._new_worker(name)
self._start_worker(worker)
return worker | [
"Creates",
"a",
"new",
"Worker",
"and",
"start",
"a",
"new",
"Thread",
"with",
"it",
".",
"Returns",
"the",
"Worker",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/multithreading/scheduler.py#L148-L154 | [
"def",
"new_worker",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"if",
"not",
"self",
".",
"running",
":",
"return",
"self",
".",
"immediate_worker",
"worker",
"=",
"self",
".",
"_new_worker",
"(",
"name",
")",
"self",
".",
"_start_worker",
"(",
"w... | 7b597a415c1901901c677976cb13100fc3083107 |
train | SchedulerApi.new_worker_pool | Creates a new worker pool and starts it.
Returns the Worker that schedules works to the pool. | bot/multithreading/scheduler.py | def new_worker_pool(self, name: str, min_workers: int = 0, max_workers: int = 1,
max_seconds_idle: int = DEFAULT_WORKER_POOL_MAX_SECONDS_IDLE):
"""
Creates a new worker pool and starts it.
Returns the Worker that schedules works to the pool.
"""
if not sel... | def new_worker_pool(self, name: str, min_workers: int = 0, max_workers: int = 1,
max_seconds_idle: int = DEFAULT_WORKER_POOL_MAX_SECONDS_IDLE):
"""
Creates a new worker pool and starts it.
Returns the Worker that schedules works to the pool.
"""
if not sel... | [
"Creates",
"a",
"new",
"worker",
"pool",
"and",
"starts",
"it",
".",
"Returns",
"the",
"Worker",
"that",
"schedules",
"works",
"to",
"the",
"pool",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/multithreading/scheduler.py#L156-L166 | [
"def",
"new_worker_pool",
"(",
"self",
",",
"name",
":",
"str",
",",
"min_workers",
":",
"int",
"=",
"0",
",",
"max_workers",
":",
"int",
"=",
"1",
",",
"max_seconds_idle",
":",
"int",
"=",
"DEFAULT_WORKER_POOL_MAX_SECONDS_IDLE",
")",
":",
"if",
"not",
"se... | 7b597a415c1901901c677976cb13100fc3083107 |
train | Cohort.as_dataframe | Return this Cohort as a DataFrame, and optionally include additional columns
using `on`.
on : str or function or list or dict, optional
- A column name.
- Or a function that creates a new column for comparison, e.g. count.snv_count.
- Or a list of column-generating f... | cohorts/cohort.py | def as_dataframe(self, on=None, join_with=None, join_how=None,
return_cols=False, rename_cols=False,
keep_paren_contents=True, **kwargs):
"""
Return this Cohort as a DataFrame, and optionally include additional columns
using `on`.
on : str or fu... | def as_dataframe(self, on=None, join_with=None, join_how=None,
return_cols=False, rename_cols=False,
keep_paren_contents=True, **kwargs):
"""
Return this Cohort as a DataFrame, and optionally include additional columns
using `on`.
on : str or fu... | [
"Return",
"this",
"Cohort",
"as",
"a",
"DataFrame",
"and",
"optionally",
"include",
"additional",
"columns",
"using",
"on",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L302-L400 | [
"def",
"as_dataframe",
"(",
"self",
",",
"on",
"=",
"None",
",",
"join_with",
"=",
"None",
",",
"join_how",
"=",
"None",
",",
"return_cols",
"=",
"False",
",",
"rename_cols",
"=",
"False",
",",
"keep_paren_contents",
"=",
"True",
",",
"*",
"*",
"kwargs",... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.load_dataframe | Instead of joining a DataFrameJoiner with the Cohort in `as_dataframe`, sometimes
we may want to just directly load a particular DataFrame. | cohorts/cohort.py | def load_dataframe(self, df_loader_name):
"""
Instead of joining a DataFrameJoiner with the Cohort in `as_dataframe`, sometimes
we may want to just directly load a particular DataFrame.
"""
logger.debug("loading dataframe: {}".format(df_loader_name))
# Get the DataFrameLo... | def load_dataframe(self, df_loader_name):
"""
Instead of joining a DataFrameJoiner with the Cohort in `as_dataframe`, sometimes
we may want to just directly load a particular DataFrame.
"""
logger.debug("loading dataframe: {}".format(df_loader_name))
# Get the DataFrameLo... | [
"Instead",
"of",
"joining",
"a",
"DataFrameJoiner",
"with",
"the",
"Cohort",
"in",
"as_dataframe",
"sometimes",
"we",
"may",
"want",
"to",
"just",
"directly",
"load",
"a",
"particular",
"DataFrame",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L402-L416 | [
"def",
"load_dataframe",
"(",
"self",
",",
"df_loader_name",
")",
":",
"logger",
".",
"debug",
"(",
"\"loading dataframe: {}\"",
".",
"format",
"(",
"df_loader_name",
")",
")",
"# Get the DataFrameLoader object corresponding to this name.",
"df_loaders",
"=",
"[",
"df_l... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._get_function_name | Return name of function, using default value if function not defined | cohorts/cohort.py | def _get_function_name(self, fn, default="None"):
""" Return name of function, using default value if function not defined
"""
if fn is None:
fn_name = default
else:
fn_name = fn.__name__
return fn_name | def _get_function_name(self, fn, default="None"):
""" Return name of function, using default value if function not defined
"""
if fn is None:
fn_name = default
else:
fn_name = fn.__name__
return fn_name | [
"Return",
"name",
"of",
"function",
"using",
"default",
"value",
"if",
"function",
"not",
"defined"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L502-L509 | [
"def",
"_get_function_name",
"(",
"self",
",",
"fn",
",",
"default",
"=",
"\"None\"",
")",
":",
"if",
"fn",
"is",
"None",
":",
"fn_name",
"=",
"default",
"else",
":",
"fn_name",
"=",
"fn",
".",
"__name__",
"return",
"fn_name"
] | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.load_variants | Load a dictionary of patient_id to varcode.VariantCollection
Parameters
----------
patients : str, optional
Filter to a subset of patients
filter_fn : function
Takes a FilterableVariant and returns a boolean. Only variants returning True are preserved.
... | cohorts/cohort.py | def load_variants(self, patients=None, filter_fn=None, **kwargs):
"""Load a dictionary of patient_id to varcode.VariantCollection
Parameters
----------
patients : str, optional
Filter to a subset of patients
filter_fn : function
Takes a FilterableVariant ... | def load_variants(self, patients=None, filter_fn=None, **kwargs):
"""Load a dictionary of patient_id to varcode.VariantCollection
Parameters
----------
patients : str, optional
Filter to a subset of patients
filter_fn : function
Takes a FilterableVariant ... | [
"Load",
"a",
"dictionary",
"of",
"patient_id",
"to",
"varcode",
".",
"VariantCollection"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L511-L536 | [
"def",
"load_variants",
"(",
"self",
",",
"patients",
"=",
"None",
",",
"filter_fn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"filter_fn",
"=",
"first_not_none_param",
"(",
"[",
"filter_fn",
",",
"self",
".",
"filter_fn",
"]",
",",
"no_filter",
")... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._hash_filter_fn | Construct string representing state of filter_fn
Used to cache filtered variants or effects uniquely depending on filter fn values | cohorts/cohort.py | def _hash_filter_fn(self, filter_fn, **kwargs):
""" Construct string representing state of filter_fn
Used to cache filtered variants or effects uniquely depending on filter fn values
"""
filter_fn_name = self._get_function_name(filter_fn, default="filter-none")
logger.debug("... | def _hash_filter_fn(self, filter_fn, **kwargs):
""" Construct string representing state of filter_fn
Used to cache filtered variants or effects uniquely depending on filter fn values
"""
filter_fn_name = self._get_function_name(filter_fn, default="filter-none")
logger.debug("... | [
"Construct",
"string",
"representing",
"state",
"of",
"filter_fn",
"Used",
"to",
"cache",
"filtered",
"variants",
"or",
"effects",
"uniquely",
"depending",
"on",
"filter",
"fn",
"values"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L538-L570 | [
"def",
"_hash_filter_fn",
"(",
"self",
",",
"filter_fn",
",",
"*",
"*",
"kwargs",
")",
":",
"filter_fn_name",
"=",
"self",
".",
"_get_function_name",
"(",
"filter_fn",
",",
"default",
"=",
"\"filter-none\"",
")",
"logger",
".",
"debug",
"(",
"\"Computing hash ... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._load_single_patient_variants | Load filtered, merged variants for a single patient, optionally using cache
Note that filtered variants are first merged before filtering, and
each step is cached independently. Turn on debug statements for more
details about cached files.
Use `_load_single_pati... | cohorts/cohort.py | def _load_single_patient_variants(self, patient, filter_fn, use_cache=True, **kwargs):
""" Load filtered, merged variants for a single patient, optionally using cache
Note that filtered variants are first merged before filtering, and
each step is cached independently. Turn on debug ... | def _load_single_patient_variants(self, patient, filter_fn, use_cache=True, **kwargs):
""" Load filtered, merged variants for a single patient, optionally using cache
Note that filtered variants are first merged before filtering, and
each step is cached independently. Turn on debug ... | [
"Load",
"filtered",
"merged",
"variants",
"for",
"a",
"single",
"patient",
"optionally",
"using",
"cache"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L572-L626 | [
"def",
"_load_single_patient_variants",
"(",
"self",
",",
"patient",
",",
"filter_fn",
",",
"use_cache",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"filter_fn",
"is",
"None",
":",
"use_filtered_cache",
"=",
"False",
"else",
":",
"filter_fn_name",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._load_single_patient_merged_variants | Load merged variants for a single patient, optionally using cache
Note that merged variants are not filtered.
Use `_load_single_patient_variants` to get filtered variants | cohorts/cohort.py | def _load_single_patient_merged_variants(self, patient, use_cache=True):
""" Load merged variants for a single patient, optionally using cache
Note that merged variants are not filtered.
Use `_load_single_patient_variants` to get filtered variants
"""
logger.debug("loadi... | def _load_single_patient_merged_variants(self, patient, use_cache=True):
""" Load merged variants for a single patient, optionally using cache
Note that merged variants are not filtered.
Use `_load_single_patient_variants` to get filtered variants
"""
logger.debug("loadi... | [
"Load",
"merged",
"variants",
"for",
"a",
"single",
"patient",
"optionally",
"using",
"cache"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L628-L695 | [
"def",
"_load_single_patient_merged_variants",
"(",
"self",
",",
"patient",
",",
"use_cache",
"=",
"True",
")",
":",
"logger",
".",
"debug",
"(",
"\"loading merged variants for patient {}\"",
".",
"format",
"(",
"patient",
".",
"id",
")",
")",
"no_variants",
"=",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.load_polyphen_annotations | Load a dataframe containing polyphen2 annotations for all variants
Parameters
----------
database_file : string, sqlite
Path to the WHESS/Polyphen2 SQLite database.
Can be downloaded and bunzip2"ed from http://bit.ly/208mlIU
filter_fn : function
Takes... | cohorts/cohort.py | def load_polyphen_annotations(self, as_dataframe=False,
filter_fn=None):
"""Load a dataframe containing polyphen2 annotations for all variants
Parameters
----------
database_file : string, sqlite
Path to the WHESS/Polyphen2 SQLite database.
... | def load_polyphen_annotations(self, as_dataframe=False,
filter_fn=None):
"""Load a dataframe containing polyphen2 annotations for all variants
Parameters
----------
database_file : string, sqlite
Path to the WHESS/Polyphen2 SQLite database.
... | [
"Load",
"a",
"dataframe",
"containing",
"polyphen2",
"annotations",
"for",
"all",
"variants"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L708-L738 | [
"def",
"load_polyphen_annotations",
"(",
"self",
",",
"as_dataframe",
"=",
"False",
",",
"filter_fn",
"=",
"None",
")",
":",
"filter_fn",
"=",
"first_not_none_param",
"(",
"[",
"filter_fn",
",",
"self",
".",
"filter_fn",
"]",
",",
"no_filter",
")",
"patient_an... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.load_effects | Load a dictionary of patient_id to varcode.EffectCollection
Note that this only loads one effect per variant.
Parameters
----------
patients : str, optional
Filter to a subset of patients
only_nonsynonymous : bool, optional
If true, load only nonsynonymo... | cohorts/cohort.py | def load_effects(self, patients=None, only_nonsynonymous=False,
all_effects=False, filter_fn=None, **kwargs):
"""Load a dictionary of patient_id to varcode.EffectCollection
Note that this only loads one effect per variant.
Parameters
----------
patients : s... | def load_effects(self, patients=None, only_nonsynonymous=False,
all_effects=False, filter_fn=None, **kwargs):
"""Load a dictionary of patient_id to varcode.EffectCollection
Note that this only loads one effect per variant.
Parameters
----------
patients : s... | [
"Load",
"a",
"dictionary",
"of",
"patient_id",
"to",
"varcode",
".",
"EffectCollection"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L790-L822 | [
"def",
"load_effects",
"(",
"self",
",",
"patients",
"=",
"None",
",",
"only_nonsynonymous",
"=",
"False",
",",
"all_effects",
"=",
"False",
",",
"filter_fn",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"filter_fn",
"=",
"first_not_none_param",
"(",
"[... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.load_kallisto | Load Kallisto transcript quantification data for a cohort
Parameters
----------
Returns
-------
kallisto_data : Pandas dataframe
Pandas dataframe with Kallisto data for all patients
columns include patient_id, gene_name, est_counts | cohorts/cohort.py | def load_kallisto(self):
"""
Load Kallisto transcript quantification data for a cohort
Parameters
----------
Returns
-------
kallisto_data : Pandas dataframe
Pandas dataframe with Kallisto data for all patients
columns include patient_id,... | def load_kallisto(self):
"""
Load Kallisto transcript quantification data for a cohort
Parameters
----------
Returns
-------
kallisto_data : Pandas dataframe
Pandas dataframe with Kallisto data for all patients
columns include patient_id,... | [
"Load",
"Kallisto",
"transcript",
"quantification",
"data",
"for",
"a",
"cohort"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L865-L895 | [
"def",
"load_kallisto",
"(",
"self",
")",
":",
"kallisto_data",
"=",
"pd",
".",
"concat",
"(",
"[",
"self",
".",
"_load_single_patient_kallisto",
"(",
"patient",
")",
"for",
"patient",
"in",
"self",
"]",
",",
"copy",
"=",
"False",
")",
"if",
"self",
".",... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._load_single_patient_kallisto | Load Kallisto gene quantification given a patient
Parameters
----------
patient : Patient
Returns
-------
data: Pandas dataframe
Pandas dataframe of sample's Kallisto data
columns include patient_id, target_id, length, eff_length, est_counts, tpm | cohorts/cohort.py | def _load_single_patient_kallisto(self, patient):
"""
Load Kallisto gene quantification given a patient
Parameters
----------
patient : Patient
Returns
-------
data: Pandas dataframe
Pandas dataframe of sample's Kallisto data
colu... | def _load_single_patient_kallisto(self, patient):
"""
Load Kallisto gene quantification given a patient
Parameters
----------
patient : Patient
Returns
-------
data: Pandas dataframe
Pandas dataframe of sample's Kallisto data
colu... | [
"Load",
"Kallisto",
"gene",
"quantification",
"given",
"a",
"patient"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L897-L913 | [
"def",
"_load_single_patient_kallisto",
"(",
"self",
",",
"patient",
")",
":",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"patient",
".",
"tumor_sample",
".",
"kallisto_path",
",",
"sep",
"=",
"\"\\t\"",
")",
"data",
"[",
"\"patient_id\"",
"]",
"=",
"patient",... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.load_cufflinks | Load a Cufflinks gene expression data for a cohort
Parameters
----------
filter_ok : bool, optional
If true, filter Cufflinks data to row with FPKM_status == "OK"
Returns
-------
cufflinks_data : Pandas dataframe
Pandas dataframe with Cufflinks d... | cohorts/cohort.py | def load_cufflinks(self, filter_ok=True):
"""
Load a Cufflinks gene expression data for a cohort
Parameters
----------
filter_ok : bool, optional
If true, filter Cufflinks data to row with FPKM_status == "OK"
Returns
-------
cufflinks_data : ... | def load_cufflinks(self, filter_ok=True):
"""
Load a Cufflinks gene expression data for a cohort
Parameters
----------
filter_ok : bool, optional
If true, filter Cufflinks data to row with FPKM_status == "OK"
Returns
-------
cufflinks_data : ... | [
"Load",
"a",
"Cufflinks",
"gene",
"expression",
"data",
"for",
"a",
"cohort"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L915-L934 | [
"def",
"load_cufflinks",
"(",
"self",
",",
"filter_ok",
"=",
"True",
")",
":",
"return",
"pd",
".",
"concat",
"(",
"[",
"self",
".",
"_load_single_patient_cufflinks",
"(",
"patient",
",",
"filter_ok",
")",
"for",
"patient",
"in",
"self",
"]",
",",
"copy",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._load_single_patient_cufflinks | Load Cufflinks gene quantification given a patient
Parameters
----------
patient : Patient
filter_ok : bool, optional
If true, filter Cufflinks data to row with FPKM_status == "OK"
Returns
-------
data: Pandas dataframe
Pandas dataframe o... | cohorts/cohort.py | def _load_single_patient_cufflinks(self, patient, filter_ok):
"""
Load Cufflinks gene quantification given a patient
Parameters
----------
patient : Patient
filter_ok : bool, optional
If true, filter Cufflinks data to row with FPKM_status == "OK"
Ret... | def _load_single_patient_cufflinks(self, patient, filter_ok):
"""
Load Cufflinks gene quantification given a patient
Parameters
----------
patient : Patient
filter_ok : bool, optional
If true, filter Cufflinks data to row with FPKM_status == "OK"
Ret... | [
"Load",
"Cufflinks",
"gene",
"quantification",
"given",
"a",
"patient"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L936-L958 | [
"def",
"_load_single_patient_cufflinks",
"(",
"self",
",",
"patient",
",",
"filter_ok",
")",
":",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"patient",
".",
"tumor_sample",
".",
"cufflinks_path",
",",
"sep",
"=",
"\"\\t\"",
")",
"data",
"[",
"\"patient_id\"",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.get_filtered_isovar_epitopes | Mostly replicates topiary.build_epitope_collection_from_binding_predictions
Note: topiary needs to do fancy stuff like subsequence_protein_offset + binding_prediction.offset
in order to figure out whether a variant is in the peptide because it only has the variant's
offset into the full protein... | cohorts/cohort.py | def get_filtered_isovar_epitopes(self, epitopes, ic50_cutoff):
"""
Mostly replicates topiary.build_epitope_collection_from_binding_predictions
Note: topiary needs to do fancy stuff like subsequence_protein_offset + binding_prediction.offset
in order to figure out whether a variant is in... | def get_filtered_isovar_epitopes(self, epitopes, ic50_cutoff):
"""
Mostly replicates topiary.build_epitope_collection_from_binding_predictions
Note: topiary needs to do fancy stuff like subsequence_protein_offset + binding_prediction.offset
in order to figure out whether a variant is in... | [
"Mostly",
"replicates",
"topiary",
".",
"build_epitope_collection_from_binding_predictions"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1064-L1086 | [
"def",
"get_filtered_isovar_epitopes",
"(",
"self",
",",
"epitopes",
",",
"ic50_cutoff",
")",
":",
"mutant_binding_predictions",
"=",
"[",
"]",
"for",
"binding_prediction",
"in",
"epitopes",
":",
"peptide",
"=",
"binding_prediction",
".",
"peptide",
"peptide_offset",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.plot_roc_curve | Plot an ROC curve for benefit and a given variable
Parameters
----------
on : str or function or list or dict
See `cohort.load.as_dataframe`
bootstrap_samples : int, optional
Number of boostrap samples to use to compute the AUC
ax : Axes, default None
... | cohorts/cohort.py | def plot_roc_curve(self, on, bootstrap_samples=100, ax=None, **kwargs):
"""Plot an ROC curve for benefit and a given variable
Parameters
----------
on : str or function or list or dict
See `cohort.load.as_dataframe`
bootstrap_samples : int, optional
Numbe... | def plot_roc_curve(self, on, bootstrap_samples=100, ax=None, **kwargs):
"""Plot an ROC curve for benefit and a given variable
Parameters
----------
on : str or function or list or dict
See `cohort.load.as_dataframe`
bootstrap_samples : int, optional
Numbe... | [
"Plot",
"an",
"ROC",
"curve",
"for",
"benefit",
"and",
"a",
"given",
"variable"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1171-L1193 | [
"def",
"plot_roc_curve",
"(",
"self",
",",
"on",
",",
"bootstrap_samples",
"=",
"100",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"plot_col",
",",
"df",
"=",
"self",
".",
"as_dataframe",
"(",
"on",
",",
"return_cols",
"=",
"True",
","... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.plot_benefit | Plot a comparison of benefit/response in the cohort on a given variable | cohorts/cohort.py | def plot_benefit(self, on, benefit_col="benefit", label="Response", ax=None,
alternative="two-sided", boolean_value_map={},
order=None, **kwargs):
"""Plot a comparison of benefit/response in the cohort on a given variable
"""
no_benefit_plot_name = "No %... | def plot_benefit(self, on, benefit_col="benefit", label="Response", ax=None,
alternative="two-sided", boolean_value_map={},
order=None, **kwargs):
"""Plot a comparison of benefit/response in the cohort on a given variable
"""
no_benefit_plot_name = "No %... | [
"Plot",
"a",
"comparison",
"of",
"benefit",
"/",
"response",
"in",
"the",
"cohort",
"on",
"a",
"given",
"variable"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1195-L1211 | [
"def",
"plot_benefit",
"(",
"self",
",",
"on",
",",
"benefit_col",
"=",
"\"benefit\"",
",",
"label",
"=",
"\"Response\"",
",",
"ax",
"=",
"None",
",",
"alternative",
"=",
"\"two-sided\"",
",",
"boolean_value_map",
"=",
"{",
"}",
",",
"order",
"=",
"None",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.plot_boolean | Plot a comparison of `boolean_col` in the cohort on a given variable via
`on` or `col`.
If the variable (through `on` or `col`) is binary this will compare
odds-ratios and perform a Fisher's exact test.
If the variable is numeric, this will compare the distributions through
a M... | cohorts/cohort.py | def plot_boolean(self,
on,
boolean_col,
plot_col=None,
boolean_label=None,
boolean_value_map={},
order=None,
ax=None,
alternative="two-sided",
... | def plot_boolean(self,
on,
boolean_col,
plot_col=None,
boolean_label=None,
boolean_value_map={},
order=None,
ax=None,
alternative="two-sided",
... | [
"Plot",
"a",
"comparison",
"of",
"boolean_col",
"in",
"the",
"cohort",
"on",
"a",
"given",
"variable",
"via",
"on",
"or",
"col",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1213-L1293 | [
"def",
"plot_boolean",
"(",
"self",
",",
"on",
",",
"boolean_col",
",",
"plot_col",
"=",
"None",
",",
"boolean_label",
"=",
"None",
",",
"boolean_value_map",
"=",
"{",
"}",
",",
"order",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"alternative",
"=",
"\"... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.plot_survival | Plot a Kaplan Meier survival curve by splitting the cohort into two groups
Parameters
----------
on : str or function or list or dict
See `cohort.load.as_dataframe`
how : {"os", "pfs"}, optional
Whether to plot OS (overall survival) or PFS (progression free surviv... | cohorts/cohort.py | def plot_survival(self,
on,
how="os",
survival_units="Days",
strata=None,
ax=None,
ci_show=False,
with_condition_color="#B38600",
no_condition_c... | def plot_survival(self,
on,
how="os",
survival_units="Days",
strata=None,
ax=None,
ci_show=False,
with_condition_color="#B38600",
no_condition_c... | [
"Plot",
"a",
"Kaplan",
"Meier",
"survival",
"curve",
"by",
"splitting",
"the",
"cohort",
"into",
"two",
"groups",
"Parameters",
"----------",
"on",
":",
"str",
"or",
"function",
"or",
"list",
"or",
"dict",
"See",
"cohort",
".",
"load",
".",
"as_dataframe",
... | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1295-L1349 | [
"def",
"plot_survival",
"(",
"self",
",",
"on",
",",
"how",
"=",
"\"os\"",
",",
"survival_units",
"=",
"\"Days\"",
",",
"strata",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"ci_show",
"=",
"False",
",",
"with_condition_color",
"=",
"\"#B38600\"",
",",
"no... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.plot_correlation | Plot the correlation between two variables.
Parameters
----------
on : list or dict of functions or strings
See `cohort.load.as_dataframe`
x_col : str, optional
If `on` is a dict, this guarantees we have the expected ordering.
plot_type : str, optional
... | cohorts/cohort.py | def plot_correlation(self, on, x_col=None, plot_type="jointplot", stat_func=pearsonr, show_stat_func=True, plot_kwargs={}, **kwargs):
"""Plot the correlation between two variables.
Parameters
----------
on : list or dict of functions or strings
See `cohort.load.as_dataframe`... | def plot_correlation(self, on, x_col=None, plot_type="jointplot", stat_func=pearsonr, show_stat_func=True, plot_kwargs={}, **kwargs):
"""Plot the correlation between two variables.
Parameters
----------
on : list or dict of functions or strings
See `cohort.load.as_dataframe`... | [
"Plot",
"the",
"correlation",
"between",
"two",
"variables",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1351-L1399 | [
"def",
"plot_correlation",
"(",
"self",
",",
"on",
",",
"x_col",
"=",
"None",
",",
"plot_type",
"=",
"\"jointplot\"",
",",
"stat_func",
"=",
"pearsonr",
",",
"show_stat_func",
"=",
"True",
",",
"plot_kwargs",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort._list_patient_ids | Utility function to return a list of patient ids in the Cohort | cohorts/cohort.py | def _list_patient_ids(self):
""" Utility function to return a list of patient ids in the Cohort
"""
results = []
for patient in self:
results.append(patient.id)
return(results) | def _list_patient_ids(self):
""" Utility function to return a list of patient ids in the Cohort
"""
results = []
for patient in self:
results.append(patient.id)
return(results) | [
"Utility",
"function",
"to",
"return",
"a",
"list",
"of",
"patient",
"ids",
"in",
"the",
"Cohort"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1410-L1416 | [
"def",
"_list_patient_ids",
"(",
"self",
")",
":",
"results",
"=",
"[",
"]",
"for",
"patient",
"in",
"self",
":",
"results",
".",
"append",
"(",
"patient",
".",
"id",
")",
"return",
"(",
"results",
")"
] | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.summarize_provenance_per_cache | Utility function to summarize provenance files for cached items used by a Cohort,
for each cache_dir that exists. Only existing cache_dirs are summarized.
This is a summary of provenance files because the function checks to see whether all
patients data have the same provenance within the cache... | cohorts/cohort.py | def summarize_provenance_per_cache(self):
"""Utility function to summarize provenance files for cached items used by a Cohort,
for each cache_dir that exists. Only existing cache_dirs are summarized.
This is a summary of provenance files because the function checks to see whether all
pa... | def summarize_provenance_per_cache(self):
"""Utility function to summarize provenance files for cached items used by a Cohort,
for each cache_dir that exists. Only existing cache_dirs are summarized.
This is a summary of provenance files because the function checks to see whether all
pa... | [
"Utility",
"function",
"to",
"summarize",
"provenance",
"files",
"for",
"cached",
"items",
"used",
"by",
"a",
"Cohort",
"for",
"each",
"cache_dir",
"that",
"exists",
".",
"Only",
"existing",
"cache_dirs",
"are",
"summarized",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1418-L1471 | [
"def",
"summarize_provenance_per_cache",
"(",
"self",
")",
":",
"provenance_summary",
"=",
"{",
"}",
"df",
"=",
"self",
".",
"as_dataframe",
"(",
")",
"for",
"cache",
"in",
"self",
".",
"cache_names",
":",
"cache_name",
"=",
"self",
".",
"cache_names",
"[",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.summarize_dataframe | Summarize default dataframe for this cohort using a hash function.
Useful for confirming the version of data used in various reports, e.g. ipynbs | cohorts/cohort.py | def summarize_dataframe(self):
"""Summarize default dataframe for this cohort using a hash function.
Useful for confirming the version of data used in various reports, e.g. ipynbs
"""
if self.dataframe_hash:
return(self.dataframe_hash)
else:
df = self._as_... | def summarize_dataframe(self):
"""Summarize default dataframe for this cohort using a hash function.
Useful for confirming the version of data used in various reports, e.g. ipynbs
"""
if self.dataframe_hash:
return(self.dataframe_hash)
else:
df = self._as_... | [
"Summarize",
"default",
"dataframe",
"for",
"this",
"cohort",
"using",
"a",
"hash",
"function",
".",
"Useful",
"for",
"confirming",
"the",
"version",
"of",
"data",
"used",
"in",
"various",
"reports",
"e",
".",
"g",
".",
"ipynbs"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1473-L1481 | [
"def",
"summarize_dataframe",
"(",
"self",
")",
":",
"if",
"self",
".",
"dataframe_hash",
":",
"return",
"(",
"self",
".",
"dataframe_hash",
")",
"else",
":",
"df",
"=",
"self",
".",
"_as_dataframe_unmodified",
"(",
")",
"return",
"(",
"self",
".",
"datafr... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.summarize_provenance | Utility function to summarize provenance files for cached items used by a Cohort.
At the moment, most PROVENANCE files contain details about packages used to
generate files. However, this function is generic & so it summarizes the contents
of those files irrespective of their contents.
... | cohorts/cohort.py | def summarize_provenance(self):
"""Utility function to summarize provenance files for cached items used by a Cohort.
At the moment, most PROVENANCE files contain details about packages used to
generate files. However, this function is generic & so it summarizes the contents
of those fil... | def summarize_provenance(self):
"""Utility function to summarize provenance files for cached items used by a Cohort.
At the moment, most PROVENANCE files contain details about packages used to
generate files. However, this function is generic & so it summarizes the contents
of those fil... | [
"Utility",
"function",
"to",
"summarize",
"provenance",
"files",
"for",
"cached",
"items",
"used",
"by",
"a",
"Cohort",
"."
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1483-L1523 | [
"def",
"summarize_provenance",
"(",
"self",
")",
":",
"provenance_per_cache",
"=",
"self",
".",
"summarize_provenance_per_cache",
"(",
")",
"summary_provenance",
"=",
"None",
"num_discrepant",
"=",
"0",
"for",
"cache",
"in",
"provenance_per_cache",
":",
"if",
"not",... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | Cohort.summarize_data_sources | Utility function to summarize data source status for this Cohort, useful for confirming
the state of data used for an analysis
Returns
----------
Dictionary with summary of data sources
Currently contains
- dataframe_hash: hash of the dataframe (see `?cohorts.Cohort.sum... | cohorts/cohort.py | def summarize_data_sources(self):
"""Utility function to summarize data source status for this Cohort, useful for confirming
the state of data used for an analysis
Returns
----------
Dictionary with summary of data sources
Currently contains
- dataframe_hash: ha... | def summarize_data_sources(self):
"""Utility function to summarize data source status for this Cohort, useful for confirming
the state of data used for an analysis
Returns
----------
Dictionary with summary of data sources
Currently contains
- dataframe_hash: ha... | [
"Utility",
"function",
"to",
"summarize",
"data",
"source",
"status",
"for",
"this",
"Cohort",
"useful",
"for",
"confirming",
"the",
"state",
"of",
"data",
"used",
"for",
"an",
"analysis"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/cohort.py#L1525-L1543 | [
"def",
"summarize_data_sources",
"(",
"self",
")",
":",
"provenance_file_summary",
"=",
"self",
".",
"summarize_provenance",
"(",
")",
"dataframe_hash",
"=",
"self",
".",
"summarize_dataframe",
"(",
")",
"results",
"=",
"{",
"\"provenance_file_summary\"",
":",
"prov... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | strelka_somatic_variant_stats | Parse out the variant calling statistics for a given variant from a Strelka VCF
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of sample to variant calling statistics, corresponds to the sample columns
in a Strelka VCF
Returns
-------
SomaticV... | cohorts/variant_stats.py | def strelka_somatic_variant_stats(variant, variant_metadata):
"""Parse out the variant calling statistics for a given variant from a Strelka VCF
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of sample to variant calling statistics, corresponds to the sample c... | def strelka_somatic_variant_stats(variant, variant_metadata):
"""Parse out the variant calling statistics for a given variant from a Strelka VCF
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of sample to variant calling statistics, corresponds to the sample c... | [
"Parse",
"out",
"the",
"variant",
"calling",
"statistics",
"for",
"a",
"given",
"variant",
"from",
"a",
"Strelka",
"VCF"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L24-L44 | [
"def",
"strelka_somatic_variant_stats",
"(",
"variant",
",",
"variant_metadata",
")",
":",
"sample_info",
"=",
"variant_metadata",
"[",
"\"sample_info\"",
"]",
"# Ensure there are exactly two samples in the VCF, a tumor and normal",
"assert",
"len",
"(",
"sample_info",
")",
"... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | _strelka_variant_stats | Parse a single sample"s variant calling statistics based on Strelka VCF output
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of Strelka-specific variant calling fields
Returns
-------
VariantStats | cohorts/variant_stats.py | def _strelka_variant_stats(variant, sample_info):
"""Parse a single sample"s variant calling statistics based on Strelka VCF output
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of Strelka-specific variant calling fields
Returns
-------
VariantSt... | def _strelka_variant_stats(variant, sample_info):
"""Parse a single sample"s variant calling statistics based on Strelka VCF output
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of Strelka-specific variant calling fields
Returns
-------
VariantSt... | [
"Parse",
"a",
"single",
"sample",
"s",
"variant",
"calling",
"statistics",
"based",
"on",
"Strelka",
"VCF",
"output"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L46-L77 | [
"def",
"_strelka_variant_stats",
"(",
"variant",
",",
"sample_info",
")",
":",
"if",
"variant",
".",
"is_deletion",
"or",
"variant",
".",
"is_insertion",
":",
"# ref: https://sites.google.com/site/strelkasomaticvariantcaller/home/somatic-variant-output",
"ref_depth",
"=",
"in... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | mutect_somatic_variant_stats | Parse out the variant calling statistics for a given variant from a Mutect VCF
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of sample to variant calling statistics, corresponds to the sample columns
in a Mutect VCF
Returns
-------
SomaticVar... | cohorts/variant_stats.py | def mutect_somatic_variant_stats(variant, variant_metadata):
"""Parse out the variant calling statistics for a given variant from a Mutect VCF
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of sample to variant calling statistics, corresponds to the sample col... | def mutect_somatic_variant_stats(variant, variant_metadata):
"""Parse out the variant calling statistics for a given variant from a Mutect VCF
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of sample to variant calling statistics, corresponds to the sample col... | [
"Parse",
"out",
"the",
"variant",
"calling",
"statistics",
"for",
"a",
"given",
"variant",
"from",
"a",
"Mutect",
"VCF"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L79-L109 | [
"def",
"mutect_somatic_variant_stats",
"(",
"variant",
",",
"variant_metadata",
")",
":",
"sample_info",
"=",
"variant_metadata",
"[",
"\"sample_info\"",
"]",
"# Ensure there are exactly two samples in the VCF, a tumor and normal",
"assert",
"len",
"(",
"sample_info",
")",
"=... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | _mutect_variant_stats | Parse a single sample"s variant calling statistics based on Mutect"s (v1) VCF output
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of Mutect-specific variant calling fields
Returns
-------
VariantStats | cohorts/variant_stats.py | def _mutect_variant_stats(variant, sample_info):
"""Parse a single sample"s variant calling statistics based on Mutect"s (v1) VCF output
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of Mutect-specific variant calling fields
Returns
-------
Varia... | def _mutect_variant_stats(variant, sample_info):
"""Parse a single sample"s variant calling statistics based on Mutect"s (v1) VCF output
Parameters
----------
variant : varcode.Variant
sample_info : dict
Dictionary of Mutect-specific variant calling fields
Returns
-------
Varia... | [
"Parse",
"a",
"single",
"sample",
"s",
"variant",
"calling",
"statistics",
"based",
"on",
"Mutect",
"s",
"(",
"v1",
")",
"VCF",
"output"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L111-L130 | [
"def",
"_mutect_variant_stats",
"(",
"variant",
",",
"sample_info",
")",
":",
"# Parse out the AD (or allele depth field), which is an array of [REF_DEPTH, ALT_DEPTH]",
"ref_depth",
",",
"alt_depth",
"=",
"sample_info",
"[",
"\"AD\"",
"]",
"depth",
"=",
"int",
"(",
"ref_dep... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | maf_somatic_variant_stats | Parse out the variant calling statistics for a given variant from a MAF file
Assumes the MAF format described here: https://www.biostars.org/p/161298/#161777
Parameters
----------
variant : varcode.Variant
variant_metadata : dict
Dictionary of metadata for this variant
Returns
---... | cohorts/variant_stats.py | def maf_somatic_variant_stats(variant, variant_metadata):
"""
Parse out the variant calling statistics for a given variant from a MAF file
Assumes the MAF format described here: https://www.biostars.org/p/161298/#161777
Parameters
----------
variant : varcode.Variant
variant_metadata : dic... | def maf_somatic_variant_stats(variant, variant_metadata):
"""
Parse out the variant calling statistics for a given variant from a MAF file
Assumes the MAF format described here: https://www.biostars.org/p/161298/#161777
Parameters
----------
variant : varcode.Variant
variant_metadata : dic... | [
"Parse",
"out",
"the",
"variant",
"calling",
"statistics",
"for",
"a",
"given",
"variant",
"from",
"a",
"MAF",
"file"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L139-L161 | [
"def",
"maf_somatic_variant_stats",
"(",
"variant",
",",
"variant_metadata",
")",
":",
"tumor_stats",
"=",
"None",
"normal_stats",
"=",
"None",
"if",
"\"t_ref_count\"",
"in",
"variant_metadata",
":",
"tumor_stats",
"=",
"_maf_variant_stats",
"(",
"variant",
",",
"va... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | _vcf_is_strelka | Return True if variant_file given is in strelka format | cohorts/variant_stats.py | def _vcf_is_strelka(variant_file, variant_metadata):
"""Return True if variant_file given is in strelka format
"""
if "strelka" in variant_file.lower():
return True
elif "NORMAL" in variant_metadata["sample_info"].keys():
return True
else:
vcf_reader = vcf.Reader(open(variant... | def _vcf_is_strelka(variant_file, variant_metadata):
"""Return True if variant_file given is in strelka format
"""
if "strelka" in variant_file.lower():
return True
elif "NORMAL" in variant_metadata["sample_info"].keys():
return True
else:
vcf_reader = vcf.Reader(open(variant... | [
"Return",
"True",
"if",
"variant_file",
"given",
"is",
"in",
"strelka",
"format"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L163-L178 | [
"def",
"_vcf_is_strelka",
"(",
"variant_file",
",",
"variant_metadata",
")",
":",
"if",
"\"strelka\"",
"in",
"variant_file",
".",
"lower",
"(",
")",
":",
"return",
"True",
"elif",
"\"NORMAL\"",
"in",
"variant_metadata",
"[",
"\"sample_info\"",
"]",
".",
"keys",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | variant_stats_from_variant | Parse the variant calling stats from a variant called from multiple variant files. The stats are merged
based on `merge_fn`
Parameters
----------
variant : varcode.Variant
metadata : dict
Dictionary of variant file to variant calling metadata from that file
merge_fn : function
F... | cohorts/variant_stats.py | def variant_stats_from_variant(variant,
metadata,
merge_fn=(lambda all_stats: \
max(all_stats, key=(lambda stats: stats.tumor_stats.depth)))):
"""Parse the variant calling stats from a variant called from multiple variant ... | def variant_stats_from_variant(variant,
metadata,
merge_fn=(lambda all_stats: \
max(all_stats, key=(lambda stats: stats.tumor_stats.depth)))):
"""Parse the variant calling stats from a variant called from multiple variant ... | [
"Parse",
"the",
"variant",
"calling",
"stats",
"from",
"a",
"variant",
"called",
"from",
"multiple",
"variant",
"files",
".",
"The",
"stats",
"are",
"merged",
"based",
"on",
"merge_fn"
] | hammerlab/cohorts | python | https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/variant_stats.py#L202-L236 | [
"def",
"variant_stats_from_variant",
"(",
"variant",
",",
"metadata",
",",
"merge_fn",
"=",
"(",
"lambda",
"all_stats",
":",
"max",
"(",
"all_stats",
",",
"key",
"=",
"(",
"lambda",
"stats",
":",
"stats",
".",
"tumor_stats",
".",
"depth",
")",
")",
")",
... | 278b05e609e6c4d4a77c57d49446460be53ea33e |
train | LimitedLifespanQueueWorker._get_and_execute | :return: True if it should continue running, False if it should end its execution. | bot/multithreading/worker/pool/workers/limited_lifespan.py | def _get_and_execute(self):
"""
:return: True if it should continue running, False if it should end its execution.
"""
try:
work = self.queue.get(timeout=self.max_seconds_idle)
except queue.Empty:
# max_seconds_idle has been exhausted, exiting
... | def _get_and_execute(self):
"""
:return: True if it should continue running, False if it should end its execution.
"""
try:
work = self.queue.get(timeout=self.max_seconds_idle)
except queue.Empty:
# max_seconds_idle has been exhausted, exiting
... | [
":",
"return",
":",
"True",
"if",
"it",
"should",
"continue",
"running",
"False",
"if",
"it",
"should",
"end",
"its",
"execution",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/multithreading/worker/pool/workers/limited_lifespan.py#L21-L34 | [
"def",
"_get_and_execute",
"(",
"self",
")",
":",
"try",
":",
"work",
"=",
"self",
".",
"queue",
".",
"get",
"(",
"timeout",
"=",
"self",
".",
"max_seconds_idle",
")",
"except",
"queue",
".",
"Empty",
":",
"# max_seconds_idle has been exhausted, exiting",
"sel... | 7b597a415c1901901c677976cb13100fc3083107 |
train | ChatInfoFormatter.format | :param full_info: If True, adds more info about the chat. Please, note that this additional info requires
to make up to THREE synchronous api calls. | bot/action/standard/info/formatter/chat.py | def format(self, full_info: bool = False):
"""
:param full_info: If True, adds more info about the chat. Please, note that this additional info requires
to make up to THREE synchronous api calls.
"""
chat = self.api_object
if full_info:
self.__format_full(... | def format(self, full_info: bool = False):
"""
:param full_info: If True, adds more info about the chat. Please, note that this additional info requires
to make up to THREE synchronous api calls.
"""
chat = self.api_object
if full_info:
self.__format_full(... | [
":",
"param",
"full_info",
":",
"If",
"True",
"adds",
"more",
"info",
"about",
"the",
"chat",
".",
"Please",
"note",
"that",
"this",
"additional",
"info",
"requires",
"to",
"make",
"up",
"to",
"THREE",
"synchronous",
"api",
"calls",
"."
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/standard/info/formatter/chat.py#L20-L29 | [
"def",
"format",
"(",
"self",
",",
"full_info",
":",
"bool",
"=",
"False",
")",
":",
"chat",
"=",
"self",
".",
"api_object",
"if",
"full_info",
":",
"self",
".",
"__format_full",
"(",
"chat",
")",
"else",
":",
"self",
".",
"__format_simple",
"(",
"chat... | 7b597a415c1901901c677976cb13100fc3083107 |
train | ChatSettings.list | :rtype: list(setting_name, value, default_value, is_set, is_supported) | bot/action/standard/chatsettings/__init__.py | def list(self):
"""
:rtype: list(setting_name, value, default_value, is_set, is_supported)
"""
settings = []
for setting in _SETTINGS:
value = self.get(setting)
is_set = self.is_set(setting)
default_value = self.get_default_value(setting)
... | def list(self):
"""
:rtype: list(setting_name, value, default_value, is_set, is_supported)
"""
settings = []
for setting in _SETTINGS:
value = self.get(setting)
is_set = self.is_set(setting)
default_value = self.get_default_value(setting)
... | [
":",
"rtype",
":",
"list",
"(",
"setting_name",
"value",
"default_value",
"is_set",
"is_supported",
")"
] | alvarogzp/telegram-bot-framework | python | https://github.com/alvarogzp/telegram-bot-framework/blob/7b597a415c1901901c677976cb13100fc3083107/bot/action/standard/chatsettings/__init__.py#L42-L60 | [
"def",
"list",
"(",
"self",
")",
":",
"settings",
"=",
"[",
"]",
"for",
"setting",
"in",
"_SETTINGS",
":",
"value",
"=",
"self",
".",
"get",
"(",
"setting",
")",
"is_set",
"=",
"self",
".",
"is_set",
"(",
"setting",
")",
"default_value",
"=",
"self",... | 7b597a415c1901901c677976cb13100fc3083107 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.