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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | deeplearning | Deep Learning model demo. | h2o-py/h2o/demos.py | def deeplearning(interactive=True, echo=True, testing=False):
"""Deep Learning model demo."""
def demo_body(go):
"""
Demo of H2O's Deep Learning model.
This demo uploads a dataset to h2o, parses it, and shows a description.
Then it divides the dataset into training and test set... | def deeplearning(interactive=True, echo=True, testing=False):
"""Deep Learning model demo."""
def demo_body(go):
"""
Demo of H2O's Deep Learning model.
This demo uploads a dataset to h2o, parses it, and shows a description.
Then it divides the dataset into training and test set... | [
"Deep",
"Learning",
"model",
"demo",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/demos.py#L89-L144 | [
"def",
"deeplearning",
"(",
"interactive",
"=",
"True",
",",
"echo",
"=",
"True",
",",
"testing",
"=",
"False",
")",
":",
"def",
"demo_body",
"(",
"go",
")",
":",
"\"\"\"\n Demo of H2O's Deep Learning model.\n\n This demo uploads a dataset to h2o, parses it,... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | glm | GLM model demo. | h2o-py/h2o/demos.py | def glm(interactive=True, echo=True, testing=False):
"""GLM model demo."""
def demo_body(go):
"""
Demo of H2O's Generalized Linear Estimator.
This demo uploads a dataset to h2o, parses it, and shows a description.
Then it divides the dataset into training and test sets, builds ... | def glm(interactive=True, echo=True, testing=False):
"""GLM model demo."""
def demo_body(go):
"""
Demo of H2O's Generalized Linear Estimator.
This demo uploads a dataset to h2o, parses it, and shows a description.
Then it divides the dataset into training and test sets, builds ... | [
"GLM",
"model",
"demo",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/demos.py#L148-L203 | [
"def",
"glm",
"(",
"interactive",
"=",
"True",
",",
"echo",
"=",
"True",
",",
"testing",
"=",
"False",
")",
":",
"def",
"demo_body",
"(",
"go",
")",
":",
"\"\"\"\n Demo of H2O's Generalized Linear Estimator.\n\n This demo uploads a dataset to h2o, parses it,... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | _run_demo | Execute the demo, echoing commands and pausing for user input.
:param body_fn: function that contains the sequence of demo's commands.
:param interactive: If True, the user will be prompted to continue the demonstration after every segment.
:param echo: If True, the python commands that are executed will b... | h2o-py/h2o/demos.py | def _run_demo(body_fn, interactive, echo, testing):
"""
Execute the demo, echoing commands and pausing for user input.
:param body_fn: function that contains the sequence of demo's commands.
:param interactive: If True, the user will be prompted to continue the demonstration after every segment.
:p... | def _run_demo(body_fn, interactive, echo, testing):
"""
Execute the demo, echoing commands and pausing for user input.
:param body_fn: function that contains the sequence of demo's commands.
:param interactive: If True, the user will be prompted to continue the demonstration after every segment.
:p... | [
"Execute",
"the",
"demo",
"echoing",
"commands",
"and",
"pausing",
"for",
"user",
"input",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/demos.py#L207-L303 | [
"def",
"_run_demo",
"(",
"body_fn",
",",
"interactive",
",",
"echo",
",",
"testing",
")",
":",
"import",
"colorama",
"from",
"colorama",
"import",
"Style",
",",
"Fore",
"colorama",
".",
"init",
"(",
")",
"class",
"StopExecution",
"(",
"Exception",
")",
":"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | _wait_for_keypress | Wait for a key press on the console and return it.
Borrowed from http://stackoverflow.com/questions/983354/how-do-i-make-python-to-wait-for-a-pressed-key | h2o-py/h2o/demos.py | def _wait_for_keypress():
"""
Wait for a key press on the console and return it.
Borrowed from http://stackoverflow.com/questions/983354/how-do-i-make-python-to-wait-for-a-pressed-key
"""
result = None
if os.name == "nt":
# noinspection PyUnresolvedReferences
import msvcrt
... | def _wait_for_keypress():
"""
Wait for a key press on the console and return it.
Borrowed from http://stackoverflow.com/questions/983354/how-do-i-make-python-to-wait-for-a-pressed-key
"""
result = None
if os.name == "nt":
# noinspection PyUnresolvedReferences
import msvcrt
... | [
"Wait",
"for",
"a",
"key",
"press",
"on",
"the",
"console",
"and",
"return",
"it",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/demos.py#L306-L333 | [
"def",
"_wait_for_keypress",
"(",
")",
":",
"result",
"=",
"None",
"if",
"os",
".",
"name",
"==",
"\"nt\"",
":",
"# noinspection PyUnresolvedReferences",
"import",
"msvcrt",
"result",
"=",
"msvcrt",
".",
"getch",
"(",
")",
"else",
":",
"import",
"termios",
"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OTwoDimTable.make | Create new H2OTwoDimTable object from list of (key,value) tuples which are a pre-cursor to JSON dict.
:param keyvals: list of (key, value) tuples
:return: new H2OTwoDimTable object | h2o-py/h2o/two_dim_table.py | def make(keyvals):
"""
Create new H2OTwoDimTable object from list of (key,value) tuples which are a pre-cursor to JSON dict.
:param keyvals: list of (key, value) tuples
:return: new H2OTwoDimTable object
"""
kwargs = {}
for key, value in keyvals:
if k... | def make(keyvals):
"""
Create new H2OTwoDimTable object from list of (key,value) tuples which are a pre-cursor to JSON dict.
:param keyvals: list of (key, value) tuples
:return: new H2OTwoDimTable object
"""
kwargs = {}
for key, value in keyvals:
if k... | [
"Create",
"new",
"H2OTwoDimTable",
"object",
"from",
"list",
"of",
"(",
"key",
"value",
")",
"tuples",
"which",
"are",
"a",
"pre",
"-",
"cursor",
"to",
"JSON",
"dict",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/two_dim_table.py#L45-L62 | [
"def",
"make",
"(",
"keyvals",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"keyvals",
":",
"if",
"key",
"==",
"\"columns\"",
":",
"kwargs",
"[",
"\"col_formats\"",
"]",
"=",
"[",
"c",
"[",
"\"format\"",
"]",
"for",
"c",
"in... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OTwoDimTable.as_data_frame | Convert to a python 'data frame'. | h2o-py/h2o/two_dim_table.py | def as_data_frame(self):
"""Convert to a python 'data frame'."""
if can_use_pandas():
import pandas
pandas.options.display.max_colwidth = 70
return pandas.DataFrame(self._cell_values, columns=self._col_header)
return self | def as_data_frame(self):
"""Convert to a python 'data frame'."""
if can_use_pandas():
import pandas
pandas.options.display.max_colwidth = 70
return pandas.DataFrame(self._cell_values, columns=self._col_header)
return self | [
"Convert",
"to",
"a",
"python",
"data",
"frame",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/two_dim_table.py#L77-L83 | [
"def",
"as_data_frame",
"(",
"self",
")",
":",
"if",
"can_use_pandas",
"(",
")",
":",
"import",
"pandas",
"pandas",
".",
"options",
".",
"display",
".",
"max_colwidth",
"=",
"70",
"return",
"pandas",
".",
"DataFrame",
"(",
"self",
".",
"_cell_values",
",",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OTwoDimTable.show | Print the contents of this table. | h2o-py/h2o/two_dim_table.py | def show(self, header=True):
"""Print the contents of this table."""
# if h2o.can_use_pandas():
# import pandas
# pandas.options.display.max_rows = 20
# print pandas.DataFrame(self._cell_values,columns=self._col_header)
# return
if header and self._table_heade... | def show(self, header=True):
"""Print the contents of this table."""
# if h2o.can_use_pandas():
# import pandas
# pandas.options.display.max_rows = 20
# print pandas.DataFrame(self._cell_values,columns=self._col_header)
# return
if header and self._table_heade... | [
"Print",
"the",
"contents",
"of",
"this",
"table",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/two_dim_table.py#L86-L109 | [
"def",
"show",
"(",
"self",
",",
"header",
"=",
"True",
")",
":",
"# if h2o.can_use_pandas():",
"# import pandas",
"# pandas.options.display.max_rows = 20",
"# print pandas.DataFrame(self._cell_values,columns=self._col_header)",
"# return",
"if",
"header",
"and",
"self",
".... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | reader | r"""CSV reader yielding lists of ``unicode`` strings (PY3: ``str``).
Args:
stream: Iterable of text (``unicode``, PY3: ``str``) lines. If an
``encoding`` is given, iterable of encoded (``str``, PY3: ``bytes``)
lines in the given (8-bit clean) ``encoding``.
dialect: Dialect a... | h2o-py/h2o/utils/csv/readers.py | def reader(stream, dialect=DIALECT, encoding=False, **fmtparams):
r"""CSV reader yielding lists of ``unicode`` strings (PY3: ``str``).
Args:
stream: Iterable of text (``unicode``, PY3: ``str``) lines. If an
``encoding`` is given, iterable of encoded (``str``, PY3: ``bytes``)
lin... | def reader(stream, dialect=DIALECT, encoding=False, **fmtparams):
r"""CSV reader yielding lists of ``unicode`` strings (PY3: ``str``).
Args:
stream: Iterable of text (``unicode``, PY3: ``str``) lines. If an
``encoding`` is given, iterable of encoded (``str``, PY3: ``bytes``)
lin... | [
"r",
"CSV",
"reader",
"yielding",
"lists",
"of",
"unicode",
"strings",
"(",
"PY3",
":",
"str",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/csv/readers.py#L18-L52 | [
"def",
"reader",
"(",
"stream",
",",
"dialect",
"=",
"DIALECT",
",",
"encoding",
"=",
"False",
",",
"*",
"*",
"fmtparams",
")",
":",
"if",
"encoding",
"is",
"False",
":",
"return",
"UnicodeTextReader",
"(",
"stream",
",",
"dialect",
",",
"*",
"*",
"fmt... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer.start | Start new H2O server on the local machine.
:param jar_path: Path to the h2o.jar executable. If not given, then we will search for h2o.jar in the
locations returned by `._jar_paths()`.
:param nthreads: Number of threads in the thread pool. This should be related to the number of CPUs used.
... | h2o-py/h2o/backend/server.py | def start(jar_path=None, nthreads=-1, enable_assertions=True, max_mem_size=None, min_mem_size=None,
ice_root=None, log_dir=None, log_level=None, port="54321+", name=None, extra_classpath=None,
verbose=True, jvm_custom_args=None, bind_to_localhost=True):
"""
Start new H2O serv... | def start(jar_path=None, nthreads=-1, enable_assertions=True, max_mem_size=None, min_mem_size=None,
ice_root=None, log_dir=None, log_level=None, port="54321+", name=None, extra_classpath=None,
verbose=True, jvm_custom_args=None, bind_to_localhost=True):
"""
Start new H2O serv... | [
"Start",
"new",
"H2O",
"server",
"on",
"the",
"local",
"machine",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L64-L141 | [
"def",
"start",
"(",
"jar_path",
"=",
"None",
",",
"nthreads",
"=",
"-",
"1",
",",
"enable_assertions",
"=",
"True",
",",
"max_mem_size",
"=",
"None",
",",
"min_mem_size",
"=",
"None",
",",
"ice_root",
"=",
"None",
",",
"log_dir",
"=",
"None",
",",
"lo... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer.shutdown | Shut down the server by trying to terminate/kill its process.
First we attempt to terminate the server process gracefully (sending SIGTERM signal). However after
_TIME_TO_KILL seconds if the process didn't shutdown, we forcefully kill it with a SIGKILL signal. | h2o-py/h2o/backend/server.py | def shutdown(self):
"""
Shut down the server by trying to terminate/kill its process.
First we attempt to terminate the server process gracefully (sending SIGTERM signal). However after
_TIME_TO_KILL seconds if the process didn't shutdown, we forcefully kill it with a SIGKILL signal.
... | def shutdown(self):
"""
Shut down the server by trying to terminate/kill its process.
First we attempt to terminate the server process gracefully (sending SIGTERM signal). However after
_TIME_TO_KILL seconds if the process didn't shutdown, we forcefully kill it with a SIGKILL signal.
... | [
"Shut",
"down",
"the",
"server",
"by",
"trying",
"to",
"terminate",
"/",
"kill",
"its",
"process",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L149-L169 | [
"def",
"shutdown",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_process",
":",
"return",
"try",
":",
"kill_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"self",
".",
"_TIME_TO_KILL",
"while",
"self",
".",
"_process",
".",
"poll",
"(",
")",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer._find_jar | Return the location of an h2o.jar executable.
:param path0: Explicitly given h2o.jar path. If provided, then we will simply check whether the file is there,
otherwise we will search for an executable in locations returned by ._jar_paths().
:raises H2OStartupError: if no h2o.jar executable ... | h2o-py/h2o/backend/server.py | def _find_jar(self, path0=None):
"""
Return the location of an h2o.jar executable.
:param path0: Explicitly given h2o.jar path. If provided, then we will simply check whether the file is there,
otherwise we will search for an executable in locations returned by ._jar_paths().
... | def _find_jar(self, path0=None):
"""
Return the location of an h2o.jar executable.
:param path0: Explicitly given h2o.jar path. If provided, then we will simply check whether the file is there,
otherwise we will search for an executable in locations returned by ._jar_paths().
... | [
"Return",
"the",
"location",
"of",
"an",
"h2o",
".",
"jar",
"executable",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L212-L228 | [
"def",
"_find_jar",
"(",
"self",
",",
"path0",
"=",
"None",
")",
":",
"jar_paths",
"=",
"[",
"path0",
"]",
"if",
"path0",
"else",
"self",
".",
"_jar_paths",
"(",
")",
"searched_paths",
"=",
"[",
"]",
"for",
"jp",
"in",
"jar_paths",
":",
"searched_paths... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer._jar_paths | Produce potential paths for an h2o.jar executable. | h2o-py/h2o/backend/server.py | def _jar_paths():
"""Produce potential paths for an h2o.jar executable."""
# PUBDEV-3534 hook to use arbitrary h2o.jar
own_jar = os.getenv("H2O_JAR_PATH", "")
if own_jar != "":
if not os.path.isfile(own_jar):
raise H2OStartupError("Environment variable H2O_JA... | def _jar_paths():
"""Produce potential paths for an h2o.jar executable."""
# PUBDEV-3534 hook to use arbitrary h2o.jar
own_jar = os.getenv("H2O_JAR_PATH", "")
if own_jar != "":
if not os.path.isfile(own_jar):
raise H2OStartupError("Environment variable H2O_JA... | [
"Produce",
"potential",
"paths",
"for",
"an",
"h2o",
".",
"jar",
"executable",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L231-L263 | [
"def",
"_jar_paths",
"(",
")",
":",
"# PUBDEV-3534 hook to use arbitrary h2o.jar",
"own_jar",
"=",
"os",
".",
"getenv",
"(",
"\"H2O_JAR_PATH\"",
",",
"\"\"",
")",
"if",
"own_jar",
"!=",
"\"\"",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"own_ja... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer._launch_server | Actually start the h2o.jar executable (helper method for `.start()`). | h2o-py/h2o/backend/server.py | def _launch_server(self, port, baseport, mmax, mmin, ea, nthreads, jvm_custom_args, bind_to_localhost, log_dir=None, log_level=None):
"""Actually start the h2o.jar executable (helper method for `.start()`)."""
self._ip = "127.0.0.1"
# Find Java and check version. (Note that subprocess.check_out... | def _launch_server(self, port, baseport, mmax, mmin, ea, nthreads, jvm_custom_args, bind_to_localhost, log_dir=None, log_level=None):
"""Actually start the h2o.jar executable (helper method for `.start()`)."""
self._ip = "127.0.0.1"
# Find Java and check version. (Note that subprocess.check_out... | [
"Actually",
"start",
"the",
"h2o",
".",
"jar",
"executable",
"(",
"helper",
"method",
"for",
".",
"start",
"()",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L266-L357 | [
"def",
"_launch_server",
"(",
"self",
",",
"port",
",",
"baseport",
",",
"mmax",
",",
"mmin",
",",
"ea",
",",
"nthreads",
",",
"jvm_custom_args",
",",
"bind_to_localhost",
",",
"log_dir",
"=",
"None",
",",
"log_level",
"=",
"None",
")",
":",
"self",
".",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer._find_java | Find location of the java executable (helper for `._launch_server()`).
This method is not particularly robust, and may require additional tweaking for different platforms...
:return: Path to the java executable.
:raises H2OStartupError: if java cannot be found. | h2o-py/h2o/backend/server.py | def _find_java():
"""
Find location of the java executable (helper for `._launch_server()`).
This method is not particularly robust, and may require additional tweaking for different platforms...
:return: Path to the java executable.
:raises H2OStartupError: if java cannot be fo... | def _find_java():
"""
Find location of the java executable (helper for `._launch_server()`).
This method is not particularly robust, and may require additional tweaking for different platforms...
:return: Path to the java executable.
:raises H2OStartupError: if java cannot be fo... | [
"Find",
"location",
"of",
"the",
"java",
"executable",
"(",
"helper",
"for",
".",
"_launch_server",
"()",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L373-L411 | [
"def",
"_find_java",
"(",
")",
":",
"# is java callable directly (doesn't work on windows it seems)?",
"java",
"=",
"\"java.exe\"",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
"else",
"\"java\"",
"if",
"os",
".",
"access",
"(",
"java",
",",
"os",
".",
"X_OK",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer._tmp_file | Generate names for temporary files (helper method for `._launch_server()`).
:param kind: one of "stdout", "stderr" or "salt". The "salt" kind is used for process name, not for a
file, so it doesn't contain a path. All generated names are based on the user name of the currently
logged-in... | h2o-py/h2o/backend/server.py | def _tmp_file(self, kind):
"""
Generate names for temporary files (helper method for `._launch_server()`).
:param kind: one of "stdout", "stderr" or "salt". The "salt" kind is used for process name, not for a
file, so it doesn't contain a path. All generated names are based on the u... | def _tmp_file(self, kind):
"""
Generate names for temporary files (helper method for `._launch_server()`).
:param kind: one of "stdout", "stderr" or "salt". The "salt" kind is used for process name, not for a
file, so it doesn't contain a path. All generated names are based on the u... | [
"Generate",
"names",
"for",
"temporary",
"files",
"(",
"helper",
"method",
"for",
".",
"_launch_server",
"()",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L414-L435 | [
"def",
"_tmp_file",
"(",
"self",
",",
"kind",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"username",
"=",
"os",
".",
"getenv",
"(",
"\"USERNAME\"",
")",
"else",
":",
"username",
"=",
"os",
".",
"getenv",
"(",
"\"USER\"",
")",
"if... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OLocalServer._get_server_info_from_logs | Check server's output log, and determine its scheme / IP / port (helper method for `._launch_server()`).
This method is polled during process startup. It looks at the server output log and checks for a presence of
a particular string ("INFO: Open H2O Flow in your web browser:") which indicates that the... | h2o-py/h2o/backend/server.py | def _get_server_info_from_logs(self):
"""
Check server's output log, and determine its scheme / IP / port (helper method for `._launch_server()`).
This method is polled during process startup. It looks at the server output log and checks for a presence of
a particular string ("INFO: Ope... | def _get_server_info_from_logs(self):
"""
Check server's output log, and determine its scheme / IP / port (helper method for `._launch_server()`).
This method is polled during process startup. It looks at the server output log and checks for a presence of
a particular string ("INFO: Ope... | [
"Check",
"server",
"s",
"output",
"log",
"and",
"determine",
"its",
"scheme",
"/",
"IP",
"/",
"port",
"(",
"helper",
"method",
"for",
".",
"_launch_server",
"()",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/backend/server.py#L438-L458 | [
"def",
"_get_server_info_from_logs",
"(",
"self",
")",
":",
"searchstr",
"=",
"\"INFO: Open H2O Flow in your web browser:\"",
"with",
"open",
"(",
"self",
".",
"_stdout",
",",
"\"rt\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"searchstr",
"in... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OMultinomialModel.confusion_matrix | Returns a confusion matrix based of H2O's default prediction threshold for a dataset.
:param H2OFrame data: the frame with the prediction results for which the confusion matrix should be extracted. | h2o-py/h2o/model/multinomial.py | def confusion_matrix(self, data):
"""
Returns a confusion matrix based of H2O's default prediction threshold for a dataset.
:param H2OFrame data: the frame with the prediction results for which the confusion matrix should be extracted.
"""
assert_is_type(data, H2OFrame)
... | def confusion_matrix(self, data):
"""
Returns a confusion matrix based of H2O's default prediction threshold for a dataset.
:param H2OFrame data: the frame with the prediction results for which the confusion matrix should be extracted.
"""
assert_is_type(data, H2OFrame)
... | [
"Returns",
"a",
"confusion",
"matrix",
"based",
"of",
"H2O",
"s",
"default",
"prediction",
"threshold",
"for",
"a",
"dataset",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/multinomial.py#L18-L26 | [
"def",
"confusion_matrix",
"(",
"self",
",",
"data",
")",
":",
"assert_is_type",
"(",
"data",
",",
"H2OFrame",
")",
"j",
"=",
"h2o",
".",
"api",
"(",
"\"POST /3/Predictions/models/%s/frames/%s\"",
"%",
"(",
"self",
".",
"_id",
",",
"data",
".",
"frame_id",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OMultinomialModel.hit_ratio_table | Retrieve the Hit Ratios.
If all are False (default), then return the training metric value.
If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
"valid", and "xval".
:param train: If train is True, then return the hit ratio value for ... | h2o-py/h2o/model/multinomial.py | def hit_ratio_table(self, train=False, valid=False, xval=False):
"""
Retrieve the Hit Ratios.
If all are False (default), then return the training metric value.
If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
"valid", and ... | def hit_ratio_table(self, train=False, valid=False, xval=False):
"""
Retrieve the Hit Ratios.
If all are False (default), then return the training metric value.
If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
"valid", and ... | [
"Retrieve",
"the",
"Hit",
"Ratios",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/multinomial.py#L29-L45 | [
"def",
"hit_ratio_table",
"(",
"self",
",",
"train",
"=",
"False",
",",
"valid",
"=",
"False",
",",
"xval",
"=",
"False",
")",
":",
"tm",
"=",
"ModelBase",
".",
"_get_metrics",
"(",
"self",
",",
"train",
",",
"valid",
",",
"xval",
")",
"m",
"=",
"{... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | csv_dict_writer | Equivalent of csv.DictWriter, but allows `delimiter` to be a unicode string on Py2. | h2o-py/h2o/utils/compatibility.py | def csv_dict_writer(f, fieldnames, **kwargs):
"""Equivalent of csv.DictWriter, but allows `delimiter` to be a unicode string on Py2."""
import csv
if "delimiter" in kwargs:
kwargs["delimiter"] = str(kwargs["delimiter"])
return csv.DictWriter(f, fieldnames, **kwargs) | def csv_dict_writer(f, fieldnames, **kwargs):
"""Equivalent of csv.DictWriter, but allows `delimiter` to be a unicode string on Py2."""
import csv
if "delimiter" in kwargs:
kwargs["delimiter"] = str(kwargs["delimiter"])
return csv.DictWriter(f, fieldnames, **kwargs) | [
"Equivalent",
"of",
"csv",
".",
"DictWriter",
"but",
"allows",
"delimiter",
"to",
"be",
"a",
"unicode",
"string",
"on",
"Py2",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/compatibility.py#L136-L141 | [
"def",
"csv_dict_writer",
"(",
"f",
",",
"fieldnames",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"csv",
"if",
"\"delimiter\"",
"in",
"kwargs",
":",
"kwargs",
"[",
"\"delimiter\"",
"]",
"=",
"str",
"(",
"kwargs",
"[",
"\"delimiter\"",
"]",
")",
"return... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | bytes_iterator | Given a string, return an iterator over this string's bytes (as ints). | h2o-py/h2o/utils/compatibility.py | def bytes_iterator(s):
"""Given a string, return an iterator over this string's bytes (as ints)."""
if s is None: return
if PY2 or PY3 and isinstance(s, str):
for ch in s:
yield ord(ch)
elif PY3 and isinstance(s, bytes):
for ch in s:
yield ch
else:
rai... | def bytes_iterator(s):
"""Given a string, return an iterator over this string's bytes (as ints)."""
if s is None: return
if PY2 or PY3 and isinstance(s, str):
for ch in s:
yield ord(ch)
elif PY3 and isinstance(s, bytes):
for ch in s:
yield ch
else:
rai... | [
"Given",
"a",
"string",
"return",
"an",
"iterator",
"over",
"this",
"string",
"s",
"bytes",
"(",
"as",
"ints",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/compatibility.py#L144-L154 | [
"def",
"bytes_iterator",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"if",
"PY2",
"or",
"PY3",
"and",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"for",
"ch",
"in",
"s",
":",
"yield",
"ord",
"(",
"ch",
")",
"elif",
"PY3",
"and... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | repr2 | Analogous to repr(), but will suppress 'u' prefix when repr-ing a unicode string. | h2o-py/h2o/utils/compatibility.py | def repr2(x):
"""Analogous to repr(), but will suppress 'u' prefix when repr-ing a unicode string."""
s = repr(x)
if len(s) >= 2 and s[0] == "u" and (s[1] == "'" or s[1] == '"'):
s = s[1:]
return s | def repr2(x):
"""Analogous to repr(), but will suppress 'u' prefix when repr-ing a unicode string."""
s = repr(x)
if len(s) >= 2 and s[0] == "u" and (s[1] == "'" or s[1] == '"'):
s = s[1:]
return s | [
"Analogous",
"to",
"repr",
"()",
"but",
"will",
"suppress",
"u",
"prefix",
"when",
"repr",
"-",
"ing",
"a",
"unicode",
"string",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/compatibility.py#L156-L161 | [
"def",
"repr2",
"(",
"x",
")",
":",
"s",
"=",
"repr",
"(",
"x",
")",
"if",
"len",
"(",
"s",
")",
">=",
"2",
"and",
"s",
"[",
"0",
"]",
"==",
"\"u\"",
"and",
"(",
"s",
"[",
"1",
"]",
"==",
"\"'\"",
"or",
"s",
"[",
"1",
"]",
"==",
"'\"'",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter._get_object_name | Get second token in line
>>> docwriter = ApiDocWriter('sphinx')
>>> docwriter._get_object_name(" def func(): ")
'func'
>>> docwriter._get_object_name(" class Klass(object): ")
'Klass'
>>> docwriter._get_object_name(" class Klass: ")
'Klass' | h2o-docs/src/product/sphinxext/apigen.py | def _get_object_name(self, line):
''' Get second token in line
>>> docwriter = ApiDocWriter('sphinx')
>>> docwriter._get_object_name(" def func(): ")
'func'
>>> docwriter._get_object_name(" class Klass(object): ")
'Klass'
>>> docwriter._get_object_name(" clas... | def _get_object_name(self, line):
''' Get second token in line
>>> docwriter = ApiDocWriter('sphinx')
>>> docwriter._get_object_name(" def func(): ")
'func'
>>> docwriter._get_object_name(" class Klass(object): ")
'Klass'
>>> docwriter._get_object_name(" clas... | [
"Get",
"second",
"token",
"in",
"line",
">>>",
"docwriter",
"=",
"ApiDocWriter",
"(",
"sphinx",
")",
">>>",
"docwriter",
".",
"_get_object_name",
"(",
"def",
"func",
"()",
":",
")",
"func",
">>>",
"docwriter",
".",
"_get_object_name",
"(",
"class",
"Klass",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L97-L110 | [
"def",
"_get_object_name",
"(",
"self",
",",
"line",
")",
":",
"name",
"=",
"line",
".",
"split",
"(",
")",
"[",
"1",
"]",
".",
"split",
"(",
"'('",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"# in case we have classes which are not derived from object",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter._uri2path | Convert uri to absolute filepath
Parameters
----------
uri : string
URI of python module to return path for
Returns
-------
path : None or string
Returns None if there is no valid path for this URI
Otherwise returns absolute file syst... | h2o-docs/src/product/sphinxext/apigen.py | def _uri2path(self, uri):
''' Convert uri to absolute filepath
Parameters
----------
uri : string
URI of python module to return path for
Returns
-------
path : None or string
Returns None if there is no valid path for this URI
... | def _uri2path(self, uri):
''' Convert uri to absolute filepath
Parameters
----------
uri : string
URI of python module to return path for
Returns
-------
path : None or string
Returns None if there is no valid path for this URI
... | [
"Convert",
"uri",
"to",
"absolute",
"filepath"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L112-L152 | [
"def",
"_uri2path",
"(",
"self",
",",
"uri",
")",
":",
"if",
"uri",
"==",
"self",
".",
"package_name",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"root_path",
",",
"'__init__.py'",
")",
"path",
"=",
"uri",
".",
"replace",
"(",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter._path2uri | Convert directory path to uri | h2o-docs/src/product/sphinxext/apigen.py | def _path2uri(self, dirpath):
''' Convert directory path to uri '''
relpath = dirpath.replace(self.root_path, self.package_name)
if relpath.startswith(os.path.sep):
relpath = relpath[1:]
return relpath.replace(os.path.sep, '.') | def _path2uri(self, dirpath):
''' Convert directory path to uri '''
relpath = dirpath.replace(self.root_path, self.package_name)
if relpath.startswith(os.path.sep):
relpath = relpath[1:]
return relpath.replace(os.path.sep, '.') | [
"Convert",
"directory",
"path",
"to",
"uri"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L154-L159 | [
"def",
"_path2uri",
"(",
"self",
",",
"dirpath",
")",
":",
"relpath",
"=",
"dirpath",
".",
"replace",
"(",
"self",
".",
"root_path",
",",
"self",
".",
"package_name",
")",
"if",
"relpath",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"sep",
")",
"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter._parse_module | Parse module defined in *uri* | h2o-docs/src/product/sphinxext/apigen.py | def _parse_module(self, uri):
''' Parse module defined in *uri* '''
filename = self._uri2path(uri)
if filename is None:
# nothing that we could handle here.
return ([],[])
f = open(filename, 'rt')
functions, classes = self._parse_lines(f)
f.close()... | def _parse_module(self, uri):
''' Parse module defined in *uri* '''
filename = self._uri2path(uri)
if filename is None:
# nothing that we could handle here.
return ([],[])
f = open(filename, 'rt')
functions, classes = self._parse_lines(f)
f.close()... | [
"Parse",
"module",
"defined",
"in",
"*",
"uri",
"*"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L161-L170 | [
"def",
"_parse_module",
"(",
"self",
",",
"uri",
")",
":",
"filename",
"=",
"self",
".",
"_uri2path",
"(",
"uri",
")",
"if",
"filename",
"is",
"None",
":",
"# nothing that we could handle here.",
"return",
"(",
"[",
"]",
",",
"[",
"]",
")",
"f",
"=",
"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter._parse_lines | Parse lines of text for functions and classes | h2o-docs/src/product/sphinxext/apigen.py | def _parse_lines(self, linesource):
''' Parse lines of text for functions and classes '''
functions = []
classes = []
for line in linesource:
if line.startswith('def ') and line.count('('):
# exclude private stuff
name = self._get_object_name(l... | def _parse_lines(self, linesource):
''' Parse lines of text for functions and classes '''
functions = []
classes = []
for line in linesource:
if line.startswith('def ') and line.count('('):
# exclude private stuff
name = self._get_object_name(l... | [
"Parse",
"lines",
"of",
"text",
"for",
"functions",
"and",
"classes"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L172-L191 | [
"def",
"_parse_lines",
"(",
"self",
",",
"linesource",
")",
":",
"functions",
"=",
"[",
"]",
"classes",
"=",
"[",
"]",
"for",
"line",
"in",
"linesource",
":",
"if",
"line",
".",
"startswith",
"(",
"'def '",
")",
"and",
"line",
".",
"count",
"(",
"'('... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter.generate_api_doc | Make autodoc documentation template string for a module
Parameters
----------
uri : string
python location of module - e.g 'sphinx.builder'
Returns
-------
S : string
Contents of API doc | h2o-docs/src/product/sphinxext/apigen.py | def generate_api_doc(self, uri):
'''Make autodoc documentation template string for a module
Parameters
----------
uri : string
python location of module - e.g 'sphinx.builder'
Returns
-------
S : string
Contents of API doc
'''
... | def generate_api_doc(self, uri):
'''Make autodoc documentation template string for a module
Parameters
----------
uri : string
python location of module - e.g 'sphinx.builder'
Returns
-------
S : string
Contents of API doc
'''
... | [
"Make",
"autodoc",
"documentation",
"template",
"string",
"for",
"a",
"module"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L193-L266 | [
"def",
"generate_api_doc",
"(",
"self",
",",
"uri",
")",
":",
"# get the names of all classes and functions",
"functions",
",",
"classes",
"=",
"self",
".",
"_parse_module",
"(",
"uri",
")",
"if",
"not",
"len",
"(",
"functions",
")",
"and",
"not",
"len",
"(",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter._survives_exclude | Returns True if *matchstr* does not match patterns
``self.package_name`` removed from front of string if present
Examples
--------
>>> dw = ApiDocWriter('sphinx')
>>> dw._survives_exclude('sphinx.okpkg', 'package')
True
>>> dw.package_skip_patterns.append('^\\.b... | h2o-docs/src/product/sphinxext/apigen.py | def _survives_exclude(self, matchstr, match_type):
''' Returns True if *matchstr* does not match patterns
``self.package_name`` removed from front of string if present
Examples
--------
>>> dw = ApiDocWriter('sphinx')
>>> dw._survives_exclude('sphinx.okpkg', 'package')
... | def _survives_exclude(self, matchstr, match_type):
''' Returns True if *matchstr* does not match patterns
``self.package_name`` removed from front of string if present
Examples
--------
>>> dw = ApiDocWriter('sphinx')
>>> dw._survives_exclude('sphinx.okpkg', 'package')
... | [
"Returns",
"True",
"if",
"*",
"matchstr",
"*",
"does",
"not",
"match",
"patterns"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L268-L307 | [
"def",
"_survives_exclude",
"(",
"self",
",",
"matchstr",
",",
"match_type",
")",
":",
"if",
"match_type",
"==",
"'module'",
":",
"patterns",
"=",
"self",
".",
"module_skip_patterns",
"elif",
"match_type",
"==",
"'package'",
":",
"patterns",
"=",
"self",
".",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter.discover_modules | Return module sequence discovered from ``self.package_name``
Parameters
----------
None
Returns
-------
mods : sequence
Sequence of module names within ``self.package_name``
Examples
--------
>>> dw = ApiDocWriter('sphinx')
... | h2o-docs/src/product/sphinxext/apigen.py | def discover_modules(self):
''' Return module sequence discovered from ``self.package_name``
Parameters
----------
None
Returns
-------
mods : sequence
Sequence of module names within ``self.package_name``
Examples
--------
... | def discover_modules(self):
''' Return module sequence discovered from ``self.package_name``
Parameters
----------
None
Returns
-------
mods : sequence
Sequence of module names within ``self.package_name``
Examples
--------
... | [
"Return",
"module",
"sequence",
"discovered",
"from",
"self",
".",
"package_name"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L309-L353 | [
"def",
"discover_modules",
"(",
"self",
")",
":",
"modules",
"=",
"[",
"self",
".",
"package_name",
"]",
"# raw directory parsing",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"root_path",
")",
":",
"# Ch... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter.write_api_docs | Generate API reST files.
Parameters
----------
outdir : string
Directory name in which to store files
We create automatic filenames for each module
Returns
-------
None
Notes
-----
Sets self.written_modules to... | h2o-docs/src/product/sphinxext/apigen.py | def write_api_docs(self, outdir):
"""Generate API reST files.
Parameters
----------
outdir : string
Directory name in which to store files
We create automatic filenames for each module
Returns
-------
None
Notes
... | def write_api_docs(self, outdir):
"""Generate API reST files.
Parameters
----------
outdir : string
Directory name in which to store files
We create automatic filenames for each module
Returns
-------
None
Notes
... | [
"Generate",
"API",
"reST",
"files",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L371-L392 | [
"def",
"write_api_docs",
"(",
"self",
",",
"outdir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"outdir",
")",
":",
"os",
".",
"mkdir",
"(",
"outdir",
")",
"# compose list of modules",
"modules",
"=",
"self",
".",
"discover_modules",
"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ApiDocWriter.write_index | Make a reST API index file from written files
Parameters
----------
path : string
Filename to write index to
outdir : string
Directory to which to write generated index file
froot : string, optional
root (filename without extension) of filenam... | h2o-docs/src/product/sphinxext/apigen.py | def write_index(self, outdir, froot='gen', relative_to=None):
"""Make a reST API index file from written files
Parameters
----------
path : string
Filename to write index to
outdir : string
Directory to which to write generated index file
froot : ... | def write_index(self, outdir, froot='gen', relative_to=None):
"""Make a reST API index file from written files
Parameters
----------
path : string
Filename to write index to
outdir : string
Directory to which to write generated index file
froot : ... | [
"Make",
"a",
"reST",
"API",
"index",
"file",
"from",
"written",
"files"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-docs/src/product/sphinxext/apigen.py#L394-L427 | [
"def",
"write_index",
"(",
"self",
",",
"outdir",
",",
"froot",
"=",
"'gen'",
",",
"relative_to",
"=",
"None",
")",
":",
"if",
"self",
".",
"written_modules",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'No modules written'",
")",
"# Get full filename path... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | main | Main program.
@return: none | scripts/jira.py | def main(argv):
"""
Main program.
@return: none
"""
global g_script_name
g_script_name = os.path.basename(argv[0])
parse_config_file()
parse_args(argv)
url = 'https://0xdata.atlassian.net/rest/api/2/search?jql=sprint="' + urllib.quote(g_sprint) + '"&maxResults=1000'
r = reques... | def main(argv):
"""
Main program.
@return: none
"""
global g_script_name
g_script_name = os.path.basename(argv[0])
parse_config_file()
parse_args(argv)
url = 'https://0xdata.atlassian.net/rest/api/2/search?jql=sprint="' + urllib.quote(g_sprint) + '"&maxResults=1000'
r = reques... | [
"Main",
"program",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/jira.py#L313-L337 | [
"def",
"main",
"(",
"argv",
")",
":",
"global",
"g_script_name",
"g_script_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"argv",
"[",
"0",
"]",
")",
"parse_config_file",
"(",
")",
"parse_args",
"(",
"argv",
")",
"url",
"=",
"'https://0xdata.atlassia... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ConfusionMatrix.to_list | Convert this confusion matrix into a 2x2 plain list of values. | h2o-py/h2o/model/confusion_matrix.py | def to_list(self):
"""Convert this confusion matrix into a 2x2 plain list of values."""
return [[int(self.table.cell_values[0][1]), int(self.table.cell_values[0][2])],
[int(self.table.cell_values[1][1]), int(self.table.cell_values[1][2])]] | def to_list(self):
"""Convert this confusion matrix into a 2x2 plain list of values."""
return [[int(self.table.cell_values[0][1]), int(self.table.cell_values[0][2])],
[int(self.table.cell_values[1][1]), int(self.table.cell_values[1][2])]] | [
"Convert",
"this",
"confusion",
"matrix",
"into",
"a",
"2x2",
"plain",
"list",
"of",
"values",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/confusion_matrix.py#L73-L76 | [
"def",
"to_list",
"(",
"self",
")",
":",
"return",
"[",
"[",
"int",
"(",
"self",
".",
"table",
".",
"cell_values",
"[",
"0",
"]",
"[",
"1",
"]",
")",
",",
"int",
"(",
"self",
".",
"table",
".",
"cell_values",
"[",
"0",
"]",
"[",
"2",
"]",
")"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | ConfusionMatrix.read_cms | Read confusion matrices from the list of sources (?). | h2o-py/h2o/model/confusion_matrix.py | def read_cms(cms=None, domains=None):
"""Read confusion matrices from the list of sources (?)."""
assert_is_type(cms, [list])
return [ConfusionMatrix(cm, domains) for cm in cms] | def read_cms(cms=None, domains=None):
"""Read confusion matrices from the list of sources (?)."""
assert_is_type(cms, [list])
return [ConfusionMatrix(cm, domains) for cm in cms] | [
"Read",
"confusion",
"matrices",
"from",
"the",
"list",
"of",
"sources",
"(",
"?",
")",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/confusion_matrix.py#L80-L83 | [
"def",
"read_cms",
"(",
"cms",
"=",
"None",
",",
"domains",
"=",
"None",
")",
":",
"assert_is_type",
"(",
"cms",
",",
"[",
"list",
"]",
")",
"return",
"[",
"ConfusionMatrix",
"(",
"cm",
",",
"domains",
")",
"for",
"cm",
"in",
"cms",
"]"
] | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | load_dict | Load java messages that can be ignored pickle file into a dict structure g_ok_java_messages.
:return: none | scripts/addjavamessage2ignore.py | def load_dict():
"""
Load java messages that can be ignored pickle file into a dict structure g_ok_java_messages.
:return: none
"""
global g_load_java_message_filename
global g_ok_java_messages
if os.path.isfile(g_load_java_message_filename):
# only load dict from file if it ex... | def load_dict():
"""
Load java messages that can be ignored pickle file into a dict structure g_ok_java_messages.
:return: none
"""
global g_load_java_message_filename
global g_ok_java_messages
if os.path.isfile(g_load_java_message_filename):
# only load dict from file if it ex... | [
"Load",
"java",
"messages",
"that",
"can",
"be",
"ignored",
"pickle",
"file",
"into",
"a",
"dict",
"structure",
"g_ok_java_messages",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L87-L101 | [
"def",
"load_dict",
"(",
")",
":",
"global",
"g_load_java_message_filename",
"global",
"g_ok_java_messages",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"g_load_java_message_filename",
")",
":",
"# only load dict from file if it exists.",
"with",
"open",
"(",
"g_load_j... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | add_new_message | Add new java messages to ignore from user text file. It first reads in the new java ignored messages
from the user text file and generate a dict structure to out of the new java ignored messages. This
is achieved by function extract_message_to_dict. Next, new java messages will be added to the original
i... | scripts/addjavamessage2ignore.py | def add_new_message():
"""
Add new java messages to ignore from user text file. It first reads in the new java ignored messages
from the user text file and generate a dict structure to out of the new java ignored messages. This
is achieved by function extract_message_to_dict. Next, new java messages ... | def add_new_message():
"""
Add new java messages to ignore from user text file. It first reads in the new java ignored messages
from the user text file and generate a dict structure to out of the new java ignored messages. This
is achieved by function extract_message_to_dict. Next, new java messages ... | [
"Add",
"new",
"java",
"messages",
"to",
"ignore",
"from",
"user",
"text",
"file",
".",
"It",
"first",
"reads",
"in",
"the",
"new",
"java",
"ignored",
"messages",
"from",
"the",
"user",
"text",
"file",
"and",
"generate",
"a",
"dict",
"structure",
"to",
"o... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L103-L119 | [
"def",
"add_new_message",
"(",
")",
":",
"global",
"g_new_messages_to_exclude",
"# filename containing text file from user containing new java ignored messages",
"global",
"g_dict_changed",
"# True if new ignored java messages are added.",
"new_message_dict",
"=",
"extract_message_to_dict"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | remove_old_message | Remove java messages from ignored list if users desired it. It first reads in the java ignored messages
from user stored in g_old_messages_to_remove and build a dict structure (old_message_dict) out of it. Next, it removes the
java messages contained in old_message_dict from g_ok_java_messages.
:return: n... | scripts/addjavamessage2ignore.py | def remove_old_message():
"""
Remove java messages from ignored list if users desired it. It first reads in the java ignored messages
from user stored in g_old_messages_to_remove and build a dict structure (old_message_dict) out of it. Next, it removes the
java messages contained in old_message_dict f... | def remove_old_message():
"""
Remove java messages from ignored list if users desired it. It first reads in the java ignored messages
from user stored in g_old_messages_to_remove and build a dict structure (old_message_dict) out of it. Next, it removes the
java messages contained in old_message_dict f... | [
"Remove",
"java",
"messages",
"from",
"ignored",
"list",
"if",
"users",
"desired",
"it",
".",
"It",
"first",
"reads",
"in",
"the",
"java",
"ignored",
"messages",
"from",
"user",
"stored",
"in",
"g_old_messages_to_remove",
"and",
"build",
"a",
"dict",
"structur... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L122-L137 | [
"def",
"remove_old_message",
"(",
")",
":",
"global",
"g_old_messages_to_remove",
"global",
"g_dict_changed",
"# extract old java ignored messages to be removed in old_message_dict",
"old_message_dict",
"=",
"extract_message_to_dict",
"(",
"g_old_messages_to_remove",
")",
"if",
"ol... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | update_message_dict | Update the g_ok_java_messages dict structure by
1. add the new java ignored messages stored in message_dict if action == 1
2. remove the java ignored messages stired in message_dict if action == 2.
Parameters
----------
message_dict : Python dict
key: unit test name or "general"
value... | scripts/addjavamessage2ignore.py | def update_message_dict(message_dict,action):
"""
Update the g_ok_java_messages dict structure by
1. add the new java ignored messages stored in message_dict if action == 1
2. remove the java ignored messages stired in message_dict if action == 2.
Parameters
----------
message_dict : Pyth... | def update_message_dict(message_dict,action):
"""
Update the g_ok_java_messages dict structure by
1. add the new java ignored messages stored in message_dict if action == 1
2. remove the java ignored messages stired in message_dict if action == 2.
Parameters
----------
message_dict : Pyth... | [
"Update",
"the",
"g_ok_java_messages",
"dict",
"structure",
"by",
"1",
".",
"add",
"the",
"new",
"java",
"ignored",
"messages",
"stored",
"in",
"message_dict",
"if",
"action",
"==",
"1",
"2",
".",
"remove",
"the",
"java",
"ignored",
"messages",
"stired",
"in... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L140-L176 | [
"def",
"update_message_dict",
"(",
"message_dict",
",",
"action",
")",
":",
"global",
"g_ok_java_messages",
"allKeys",
"=",
"g_ok_java_messages",
".",
"keys",
"(",
")",
"for",
"key",
"in",
"message_dict",
".",
"keys",
"(",
")",
":",
"if",
"key",
"in",
"allKe... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | extract_message_to_dict | Read in a text file that java messages to be ignored and generate a dictionary structure out of
it with key and value pairs. The keys are test names and the values are lists of java message
strings associated with that test name where we are either going to add to the existing java messages
to ignore or re... | scripts/addjavamessage2ignore.py | def extract_message_to_dict(filename):
"""
Read in a text file that java messages to be ignored and generate a dictionary structure out of
it with key and value pairs. The keys are test names and the values are lists of java message
strings associated with that test name where we are either going to ad... | def extract_message_to_dict(filename):
"""
Read in a text file that java messages to be ignored and generate a dictionary structure out of
it with key and value pairs. The keys are test names and the values are lists of java message
strings associated with that test name where we are either going to ad... | [
"Read",
"in",
"a",
"text",
"file",
"that",
"java",
"messages",
"to",
"be",
"ignored",
"and",
"generate",
"a",
"dictionary",
"structure",
"out",
"of",
"it",
"with",
"key",
"and",
"value",
"pairs",
".",
"The",
"keys",
"are",
"test",
"names",
"and",
"the",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L179-L245 | [
"def",
"extract_message_to_dict",
"(",
"filename",
")",
":",
"message_dict",
"=",
"{",
"}",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"# open file to read in new exclude messages if it exists",
"with",
"open",
"(",
"filename",
",",
"'r'",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | add_to_dict | Add new key, val (ignored java message) to dict message_dict.
Parameters
----------
val : Str
contains ignored java messages.
key : Str
key for the ignored java messages. It can be "general" or any R or Python unit
test names
message_dict : dict
stored ignored ja... | scripts/addjavamessage2ignore.py | def add_to_dict(val,key,message_dict):
"""
Add new key, val (ignored java message) to dict message_dict.
Parameters
----------
val : Str
contains ignored java messages.
key : Str
key for the ignored java messages. It can be "general" or any R or Python unit
test names... | def add_to_dict(val,key,message_dict):
"""
Add new key, val (ignored java message) to dict message_dict.
Parameters
----------
val : Str
contains ignored java messages.
key : Str
key for the ignored java messages. It can be "general" or any R or Python unit
test names... | [
"Add",
"new",
"key",
"val",
"(",
"ignored",
"java",
"message",
")",
"to",
"dict",
"message_dict",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L248-L270 | [
"def",
"add_to_dict",
"(",
"val",
",",
"key",
",",
"message_dict",
")",
":",
"allKeys",
"=",
"message_dict",
".",
"keys",
"(",
")",
"if",
"(",
"len",
"(",
"val",
")",
">",
"0",
")",
":",
"# got a valid message here",
"if",
"(",
"key",
"in",
"allKeys",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | save_dict | Save the ignored java message dict stored in g_ok_java_messages into a pickle file for future use.
:return: none | scripts/addjavamessage2ignore.py | def save_dict():
"""
Save the ignored java message dict stored in g_ok_java_messages into a pickle file for future use.
:return: none
"""
global g_ok_java_messages
global g_save_java_message_filename
global g_dict_changed
if g_dict_changed:
with open(g_save_java_message_filenam... | def save_dict():
"""
Save the ignored java message dict stored in g_ok_java_messages into a pickle file for future use.
:return: none
"""
global g_ok_java_messages
global g_save_java_message_filename
global g_dict_changed
if g_dict_changed:
with open(g_save_java_message_filenam... | [
"Save",
"the",
"ignored",
"java",
"message",
"dict",
"stored",
"in",
"g_ok_java_messages",
"into",
"a",
"pickle",
"file",
"for",
"future",
"use",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L273-L285 | [
"def",
"save_dict",
"(",
")",
":",
"global",
"g_ok_java_messages",
"global",
"g_save_java_message_filename",
"global",
"g_dict_changed",
"if",
"g_dict_changed",
":",
"with",
"open",
"(",
"g_save_java_message_filename",
",",
"'wb'",
")",
"as",
"ofile",
":",
"pickle",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | print_dict | Write the java ignored messages in g_ok_java_messages into a text file for humans to read.
:return: none | scripts/addjavamessage2ignore.py | def print_dict():
"""
Write the java ignored messages in g_ok_java_messages into a text file for humans to read.
:return: none
"""
global g_ok_java_messages
global g_java_messages_to_ignore_text_filename
allKeys = sorted(g_ok_java_messages.keys())
with open(g_java_messages_to_ignore_t... | def print_dict():
"""
Write the java ignored messages in g_ok_java_messages into a text file for humans to read.
:return: none
"""
global g_ok_java_messages
global g_java_messages_to_ignore_text_filename
allKeys = sorted(g_ok_java_messages.keys())
with open(g_java_messages_to_ignore_t... | [
"Write",
"the",
"java",
"ignored",
"messages",
"in",
"g_ok_java_messages",
"into",
"a",
"text",
"file",
"for",
"humans",
"to",
"read",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L287-L307 | [
"def",
"print_dict",
"(",
")",
":",
"global",
"g_ok_java_messages",
"global",
"g_java_messages_to_ignore_text_filename",
"allKeys",
"=",
"sorted",
"(",
"g_ok_java_messages",
".",
"keys",
"(",
")",
")",
"with",
"open",
"(",
"g_java_messages_to_ignore_text_filename",
",",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | parse_args | Parse user inputs and set the corresponing global variables to perform the
necessary tasks.
Parameters
----------
argv : string array
contains flags and input options from users
:return: | scripts/addjavamessage2ignore.py | def parse_args(argv):
"""
Parse user inputs and set the corresponing global variables to perform the
necessary tasks.
Parameters
----------
argv : string array
contains flags and input options from users
:return:
"""
global g_new_messages_to_exclude
global g_old_messag... | def parse_args(argv):
"""
Parse user inputs and set the corresponing global variables to perform the
necessary tasks.
Parameters
----------
argv : string array
contains flags and input options from users
:return:
"""
global g_new_messages_to_exclude
global g_old_messag... | [
"Parse",
"user",
"inputs",
"and",
"set",
"the",
"corresponing",
"global",
"variables",
"to",
"perform",
"the",
"necessary",
"tasks",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L311-L367 | [
"def",
"parse_args",
"(",
"argv",
")",
":",
"global",
"g_new_messages_to_exclude",
"global",
"g_old_messages_to_remove",
"global",
"g_load_java_message_filename",
"global",
"g_save_java_message_filename",
"global",
"g_print_java_messages",
"if",
"len",
"(",
"argv",
")",
"<"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | usage | Illustrate what the various input flags are and the options should be.
:return: none | scripts/addjavamessage2ignore.py | def usage():
"""
Illustrate what the various input flags are and the options should be.
:return: none
"""
global g_script_name # name of the script being run.
print("")
print("Usage: " + g_script_name + " [...options...]")
print("")
print(" --help print out this help menu a... | def usage():
"""
Illustrate what the various input flags are and the options should be.
:return: none
"""
global g_script_name # name of the script being run.
print("")
print("Usage: " + g_script_name + " [...options...]")
print("")
print(" --help print out this help menu a... | [
"Illustrate",
"what",
"the",
"various",
"input",
"flags",
"are",
"and",
"the",
"options",
"should",
"be",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L370-L393 | [
"def",
"usage",
"(",
")",
":",
"global",
"g_script_name",
"# name of the script being run.",
"print",
"(",
"\"\"",
")",
"print",
"(",
"\"Usage: \"",
"+",
"g_script_name",
"+",
"\" [...options...]\"",
")",
"print",
"(",
"\"\"",
")",
"print",
"(",
"\" --help pr... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | main | Main program.
@return: none | scripts/addjavamessage2ignore.py | def main(argv):
"""
Main program.
@return: none
"""
global g_script_name
global g_test_root_dir
global g_new_messages_to_exclude
global g_old_messages_to_remove
global g_load_java_message_filename
global g_save_java_message_filename
global g_print_java_messages
global g_... | def main(argv):
"""
Main program.
@return: none
"""
global g_script_name
global g_test_root_dir
global g_new_messages_to_exclude
global g_old_messages_to_remove
global g_load_java_message_filename
global g_save_java_message_filename
global g_print_java_messages
global g_... | [
"Main",
"program",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/addjavamessage2ignore.py#L402-L440 | [
"def",
"main",
"(",
"argv",
")",
":",
"global",
"g_script_name",
"global",
"g_test_root_dir",
"global",
"g_new_messages_to_exclude",
"global",
"g_old_messages_to_remove",
"global",
"g_load_java_message_filename",
"global",
"g_save_java_message_filename",
"global",
"g_print_java... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | locate_files | Find all python files in the given directory and all subfolders. | h2o-bindings/bin/pymagic.py | def locate_files(root_dir):
"""Find all python files in the given directory and all subfolders."""
all_files = []
root_dir = os.path.abspath(root_dir)
for dir_name, subdirs, files in os.walk(root_dir):
for f in files:
if f.endswith(".py"):
all_files.append(os.path.joi... | def locate_files(root_dir):
"""Find all python files in the given directory and all subfolders."""
all_files = []
root_dir = os.path.abspath(root_dir)
for dir_name, subdirs, files in os.walk(root_dir):
for f in files:
if f.endswith(".py"):
all_files.append(os.path.joi... | [
"Find",
"all",
"python",
"files",
"in",
"the",
"given",
"directory",
"and",
"all",
"subfolders",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/pymagic.py#L24-L32 | [
"def",
"locate_files",
"(",
"root_dir",
")",
":",
"all_files",
"=",
"[",
"]",
"root_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"root_dir",
")",
"for",
"dir_name",
",",
"subdirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"root_dir",
")",
":... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | find_magic_in_file | Search the file for any magic incantations.
:param filename: file to search
:returns: a tuple containing the spell and then maybe some extra words (or None if no magic present) | h2o-bindings/bin/pymagic.py | def find_magic_in_file(filename):
"""
Search the file for any magic incantations.
:param filename: file to search
:returns: a tuple containing the spell and then maybe some extra words (or None if no magic present)
"""
with open(filename, "rt", encoding="utf-8") as f:
for line in f:
... | def find_magic_in_file(filename):
"""
Search the file for any magic incantations.
:param filename: file to search
:returns: a tuple containing the spell and then maybe some extra words (or None if no magic present)
"""
with open(filename, "rt", encoding="utf-8") as f:
for line in f:
... | [
"Search",
"the",
"file",
"for",
"any",
"magic",
"incantations",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/pymagic.py#L36-L52 | [
"def",
"find_magic_in_file",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"rt\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"c... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | parse_python_file | Parse file into chunks / objects. | h2o-bindings/bin/pymagic.py | def parse_python_file(filename):
"""Parse file into chunks / objects."""
with open(filename, "rt", encoding="utf-8") as f:
tokens = list(tokenize.generate_tokens(f.readline))
tokens = normalize_tokens(tokens)
module = ChunkCode(tokens, 0, len(tokens))
module.parse()
pr... | def parse_python_file(filename):
"""Parse file into chunks / objects."""
with open(filename, "rt", encoding="utf-8") as f:
tokens = list(tokenize.generate_tokens(f.readline))
tokens = normalize_tokens(tokens)
module = ChunkCode(tokens, 0, len(tokens))
module.parse()
pr... | [
"Parse",
"file",
"into",
"chunks",
"/",
"objects",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/pymagic.py#L56-L66 | [
"def",
"parse_python_file",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"rt\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"tokens",
"=",
"list",
"(",
"tokenize",
".",
"generate_tokens",
"(",
"f",
".",
"readline",
")",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | main | Executed when script is run as-is. | h2o-bindings/bin/pymagic.py | def main():
"""Executed when script is run as-is."""
# magic_files = {}
for filename in locate_files(ROOT_DIR):
print("Processing %s" % filename)
with open(filename, "rt") as f:
tokens = list(tokenize.generate_tokens(f.readline))
text1 = tokenize.untokenize(tokens)
... | def main():
"""Executed when script is run as-is."""
# magic_files = {}
for filename in locate_files(ROOT_DIR):
print("Processing %s" % filename)
with open(filename, "rt") as f:
tokens = list(tokenize.generate_tokens(f.readline))
text1 = tokenize.untokenize(tokens)
... | [
"Executed",
"when",
"script",
"is",
"run",
"as",
"-",
"is",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/pymagic.py#L70-L80 | [
"def",
"main",
"(",
")",
":",
"# magic_files = {}",
"for",
"filename",
"in",
"locate_files",
"(",
"ROOT_DIR",
")",
":",
"print",
"(",
"\"Processing %s\"",
"%",
"filename",
")",
"with",
"open",
"(",
"filename",
",",
"\"rt\"",
")",
"as",
"f",
":",
"tokens",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OPrincipalComponentAnalysisEstimator.init_for_pipeline | Returns H2OPCA object which implements fit and transform method to be used in sklearn.Pipeline properly.
All parameters defined in self.__params, should be input parameters in H2OPCA.__init__ method.
:returns: H2OPCA object | h2o-py/h2o/estimators/pca.py | def init_for_pipeline(self):
"""
Returns H2OPCA object which implements fit and transform method to be used in sklearn.Pipeline properly.
All parameters defined in self.__params, should be input parameters in H2OPCA.__init__ method.
:returns: H2OPCA object
"""
import ins... | def init_for_pipeline(self):
"""
Returns H2OPCA object which implements fit and transform method to be used in sklearn.Pipeline properly.
All parameters defined in self.__params, should be input parameters in H2OPCA.__init__ method.
:returns: H2OPCA object
"""
import ins... | [
"Returns",
"H2OPCA",
"object",
"which",
"implements",
"fit",
"and",
"transform",
"method",
"to",
"be",
"used",
"in",
"sklearn",
".",
"Pipeline",
"properly",
".",
"All",
"parameters",
"defined",
"in",
"self",
".",
"__params",
"should",
"be",
"input",
"parameter... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/estimators/pca.py#L289-L301 | [
"def",
"init_for_pipeline",
"(",
"self",
")",
":",
"import",
"inspect",
"from",
"h2o",
".",
"transforms",
".",
"decomposition",
"import",
"H2OPCA",
"# check which parameters can be passed to H2OPCA init",
"var_names",
"=",
"list",
"(",
"dict",
"(",
"inspect",
".",
"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OMojoPipeline.transform | Transform H2OFrame using a MOJO Pipeline.
:param data: Frame to be transformed.
:param allow_timestamps: Allows datetime columns to be used directly with MOJO pipelines. It is recommended
to parse your datetime columns as Strings when using pipelines because pipelines can interpret certain date... | h2o-py/h2o/pipeline/mojo_pipeline.py | def transform(self, data, allow_timestamps=False):
"""
Transform H2OFrame using a MOJO Pipeline.
:param data: Frame to be transformed.
:param allow_timestamps: Allows datetime columns to be used directly with MOJO pipelines. It is recommended
to parse your datetime columns as St... | def transform(self, data, allow_timestamps=False):
"""
Transform H2OFrame using a MOJO Pipeline.
:param data: Frame to be transformed.
:param allow_timestamps: Allows datetime columns to be used directly with MOJO pipelines. It is recommended
to parse your datetime columns as St... | [
"Transform",
"H2OFrame",
"using",
"a",
"MOJO",
"Pipeline",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/pipeline/mojo_pipeline.py#L39-L53 | [
"def",
"transform",
"(",
"self",
",",
"data",
",",
"allow_timestamps",
"=",
"False",
")",
":",
"assert_is_type",
"(",
"data",
",",
"H2OFrame",
")",
"assert_is_type",
"(",
"allow_timestamps",
",",
"bool",
")",
"return",
"H2OFrame",
".",
"_expr",
"(",
"ExprNod... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | summarizeFailedRuns | This function will look at the local directory and pick out files that have the correct start name and
summarize the results into one giant dict.
:return: None | scripts/summarizeIntermittens.py | def summarizeFailedRuns():
"""
This function will look at the local directory and pick out files that have the correct start name and
summarize the results into one giant dict.
:return: None
"""
global g_summary_dict_all
onlyFiles = [x for x in listdir(g_test_root_dir) if isfile(join(g_tes... | def summarizeFailedRuns():
"""
This function will look at the local directory and pick out files that have the correct start name and
summarize the results into one giant dict.
:return: None
"""
global g_summary_dict_all
onlyFiles = [x for x in listdir(g_test_root_dir) if isfile(join(g_tes... | [
"This",
"function",
"will",
"look",
"at",
"the",
"local",
"directory",
"and",
"pick",
"out",
"files",
"that",
"have",
"the",
"correct",
"start",
"name",
"and",
"summarize",
"the",
"results",
"into",
"one",
"giant",
"dict",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/summarizeIntermittens.py#L69-L92 | [
"def",
"summarizeFailedRuns",
"(",
")",
":",
"global",
"g_summary_dict_all",
"onlyFiles",
"=",
"[",
"x",
"for",
"x",
"in",
"listdir",
"(",
"g_test_root_dir",
")",
"if",
"isfile",
"(",
"join",
"(",
"g_test_root_dir",
",",
"x",
")",
")",
"]",
"# grab files",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | extractPrintSaveIntermittens | This function will print out the intermittents onto the screen for casual viewing. It will also print out
where the giant summary dictionary is going to be stored.
:return: None | scripts/summarizeIntermittens.py | def extractPrintSaveIntermittens():
"""
This function will print out the intermittents onto the screen for casual viewing. It will also print out
where the giant summary dictionary is going to be stored.
:return: None
"""
# extract intermittents from collected failed tests
global g_summary... | def extractPrintSaveIntermittens():
"""
This function will print out the intermittents onto the screen for casual viewing. It will also print out
where the giant summary dictionary is going to be stored.
:return: None
"""
# extract intermittents from collected failed tests
global g_summary... | [
"This",
"function",
"will",
"print",
"out",
"the",
"intermittents",
"onto",
"the",
"screen",
"for",
"casual",
"viewing",
".",
"It",
"will",
"also",
"print",
"out",
"where",
"the",
"giant",
"summary",
"dictionary",
"is",
"going",
"to",
"be",
"stored",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/summarizeIntermittens.py#L144-L179 | [
"def",
"extractPrintSaveIntermittens",
"(",
")",
":",
"# extract intermittents from collected failed tests",
"global",
"g_summary_dict_intermittents",
"localtz",
"=",
"time",
".",
"tzname",
"[",
"0",
"]",
"for",
"ind",
"in",
"range",
"(",
"len",
"(",
"g_summary_dict_all... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | main | Main program. Expect script name plus inputs in the following order:
- This script name
1. threshold: integer that will denote when a failed test will be declared an intermittent
2. string denote filename of where our final dict structure will be stored.
3. string that denote the beginning of a file c... | scripts/summarizeIntermittens.py | def main(argv):
"""
Main program. Expect script name plus inputs in the following order:
- This script name
1. threshold: integer that will denote when a failed test will be declared an intermittent
2. string denote filename of where our final dict structure will be stored.
3. string that deno... | def main(argv):
"""
Main program. Expect script name plus inputs in the following order:
- This script name
1. threshold: integer that will denote when a failed test will be declared an intermittent
2. string denote filename of where our final dict structure will be stored.
3. string that deno... | [
"Main",
"program",
".",
"Expect",
"script",
"name",
"plus",
"inputs",
"in",
"the",
"following",
"order",
":",
"-",
"This",
"script",
"name",
"1",
".",
"threshold",
":",
"integer",
"that",
"will",
"denote",
"when",
"a",
"failed",
"test",
"will",
"be",
"de... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/summarizeIntermittens.py#L181-L216 | [
"def",
"main",
"(",
"argv",
")",
":",
"global",
"g_script_name",
"global",
"g_test_root_dir",
"global",
"g_threshold_failure",
"global",
"g_file_start",
"global",
"g_summary_dict_name",
"global",
"g_summary_dict_all",
"global",
"g_summary_dict_intermittents",
"global",
"g_s... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | MetricsBase.show | Display a short summary of the metrics. | h2o-py/h2o/model/metrics_base.py | def show(self):
"""Display a short summary of the metrics."""
if self._metric_json==None:
print("WARNING: Model metrics cannot be calculated and metric_json is empty due to the absence of the response column in your dataset.")
return
metric_type = self._metric_json['__met... | def show(self):
"""Display a short summary of the metrics."""
if self._metric_json==None:
print("WARNING: Model metrics cannot be calculated and metric_json is empty due to the absence of the response column in your dataset.")
return
metric_type = self._metric_json['__met... | [
"Display",
"a",
"short",
"summary",
"of",
"the",
"metrics",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L65-L142 | [
"def",
"show",
"(",
"self",
")",
":",
"if",
"self",
".",
"_metric_json",
"==",
"None",
":",
"print",
"(",
"\"WARNING: Model metrics cannot be calculated and metric_json is empty due to the absence of the response column in your dataset.\"",
")",
"return",
"metric_type",
"=",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OBinomialModelMetrics.mean_per_class_error | :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the
thresholds in this set of metrics will be used.
:returns: mean per class error. | h2o-py/h2o/model/metrics_base.py | def mean_per_class_error(self, thresholds=None):
"""
:param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the
thresholds in this set of metrics will be used.
:returns: mean per class error.
"""
return [[x[0], 1 - x[1]] for x i... | def mean_per_class_error(self, thresholds=None):
"""
:param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the
thresholds in this set of metrics will be used.
:returns: mean per class error.
"""
return [[x[0], 1 - x[1]] for x i... | [
":",
"param",
"thresholds",
":",
"thresholds",
"parameter",
"must",
"be",
"a",
"list",
"(",
"i",
".",
"e",
".",
"[",
"0",
".",
"01",
"0",
".",
"5",
"0",
".",
"99",
"]",
")",
".",
"If",
"None",
"then",
"the",
"thresholds",
"in",
"this",
"set",
"... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L501-L507 | [
"def",
"mean_per_class_error",
"(",
"self",
",",
"thresholds",
"=",
"None",
")",
":",
"return",
"[",
"[",
"x",
"[",
"0",
"]",
",",
"1",
"-",
"x",
"[",
"1",
"]",
"]",
"for",
"x",
"in",
"self",
".",
"metric",
"(",
"\"mean_per_class_accuracy\"",
",",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OBinomialModelMetrics.metric | :param str metric: The desired metric.
:param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then
the thresholds in this set of metrics will be used.
:returns: The set of metrics for the list of thresholds. | h2o-py/h2o/model/metrics_base.py | def metric(self, metric, thresholds=None):
"""
:param str metric: The desired metric.
:param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then
the thresholds in this set of metrics will be used.
:returns: The set of metrics for the list o... | def metric(self, metric, thresholds=None):
"""
:param str metric: The desired metric.
:param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then
the thresholds in this set of metrics will be used.
:returns: The set of metrics for the list o... | [
":",
"param",
"str",
"metric",
":",
"The",
"desired",
"metric",
".",
":",
"param",
"thresholds",
":",
"thresholds",
"parameter",
"must",
"be",
"a",
"list",
"(",
"i",
".",
"e",
".",
"[",
"0",
".",
"01",
"0",
".",
"5",
"0",
".",
"99",
"]",
")",
"... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L510-L524 | [
"def",
"metric",
"(",
"self",
",",
"metric",
",",
"thresholds",
"=",
"None",
")",
":",
"assert_is_type",
"(",
"thresholds",
",",
"None",
",",
"[",
"numeric",
"]",
")",
"if",
"not",
"thresholds",
":",
"thresholds",
"=",
"[",
"self",
".",
"find_threshold_b... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OBinomialModelMetrics.plot | Produce the desired metric plot.
:param type: the type of metric plot (currently, only ROC supported).
:param server: if True, generate plot inline using matplotlib's "Agg" backend.
:returns: None | h2o-py/h2o/model/metrics_base.py | def plot(self, type="roc", server=False):
"""
Produce the desired metric plot.
:param type: the type of metric plot (currently, only ROC supported).
:param server: if True, generate plot inline using matplotlib's "Agg" backend.
:returns: None
"""
# TODO: add more... | def plot(self, type="roc", server=False):
"""
Produce the desired metric plot.
:param type: the type of metric plot (currently, only ROC supported).
:param server: if True, generate plot inline using matplotlib's "Agg" backend.
:returns: None
"""
# TODO: add more... | [
"Produce",
"the",
"desired",
"metric",
"plot",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L527-L554 | [
"def",
"plot",
"(",
"self",
",",
"type",
"=",
"\"roc\"",
",",
"server",
"=",
"False",
")",
":",
"# TODO: add more types (i.e. cutoffs)",
"assert_is_type",
"(",
"type",
",",
"\"roc\"",
")",
"# check for matplotlib. exit if absent.",
"try",
":",
"imp",
".",
"find_mo... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OBinomialModelMetrics.confusion_matrix | Get the confusion matrix for the specified metric
:param metrics: A string (or list of strings) among metrics listed in :const:`max_metrics`. Defaults to 'f1'.
:param thresholds: A value (or list of values) between 0 and 1.
:returns: a list of ConfusionMatrix objects (if there are more than one... | h2o-py/h2o/model/metrics_base.py | def confusion_matrix(self, metrics=None, thresholds=None):
"""
Get the confusion matrix for the specified metric
:param metrics: A string (or list of strings) among metrics listed in :const:`max_metrics`. Defaults to 'f1'.
:param thresholds: A value (or list of values) between 0 and 1.
... | def confusion_matrix(self, metrics=None, thresholds=None):
"""
Get the confusion matrix for the specified metric
:param metrics: A string (or list of strings) among metrics listed in :const:`max_metrics`. Defaults to 'f1'.
:param thresholds: A value (or list of values) between 0 and 1.
... | [
"Get",
"the",
"confusion",
"matrix",
"for",
"the",
"specified",
"metric"
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L588-L653 | [
"def",
"confusion_matrix",
"(",
"self",
",",
"metrics",
"=",
"None",
",",
"thresholds",
"=",
"None",
")",
":",
"# make lists out of metrics and thresholds arguments",
"if",
"metrics",
"is",
"None",
"and",
"thresholds",
"is",
"None",
":",
"metrics",
"=",
"[",
"'f... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OBinomialModelMetrics.find_threshold_by_max_metric | :param metrics: A string among the metrics listed in :const:`max_metrics`.
:returns: the threshold at which the given metric is maximal. | h2o-py/h2o/model/metrics_base.py | def find_threshold_by_max_metric(self, metric):
"""
:param metrics: A string among the metrics listed in :const:`max_metrics`.
:returns: the threshold at which the given metric is maximal.
"""
crit2d = self._metric_json['max_criteria_and_metric_scores']
for e in crit2d.c... | def find_threshold_by_max_metric(self, metric):
"""
:param metrics: A string among the metrics listed in :const:`max_metrics`.
:returns: the threshold at which the given metric is maximal.
"""
crit2d = self._metric_json['max_criteria_and_metric_scores']
for e in crit2d.c... | [
":",
"param",
"metrics",
":",
"A",
"string",
"among",
"the",
"metrics",
"listed",
"in",
":",
"const",
":",
"max_metrics",
".",
":",
"returns",
":",
"the",
"threshold",
"at",
"which",
"the",
"given",
"metric",
"is",
"maximal",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L656-L666 | [
"def",
"find_threshold_by_max_metric",
"(",
"self",
",",
"metric",
")",
":",
"crit2d",
"=",
"self",
".",
"_metric_json",
"[",
"'max_criteria_and_metric_scores'",
"]",
"for",
"e",
"in",
"crit2d",
".",
"cell_values",
":",
"if",
"e",
"[",
"0",
"]",
"==",
"\"max... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2OBinomialModelMetrics.find_idx_by_threshold | Retrieve the index in this metric's threshold list at which the given threshold is located.
:param threshold: Find the index of this input threshold.
:returns: the index
:raises ValueError: if no such index can be found. | h2o-py/h2o/model/metrics_base.py | def find_idx_by_threshold(self, threshold):
"""
Retrieve the index in this metric's threshold list at which the given threshold is located.
:param threshold: Find the index of this input threshold.
:returns: the index
:raises ValueError: if no such index can be found.
""... | def find_idx_by_threshold(self, threshold):
"""
Retrieve the index in this metric's threshold list at which the given threshold is located.
:param threshold: Find the index of this input threshold.
:returns: the index
:raises ValueError: if no such index can be found.
""... | [
"Retrieve",
"the",
"index",
"in",
"this",
"metric",
"s",
"threshold",
"list",
"at",
"which",
"the",
"given",
"threshold",
"is",
"located",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/metrics_base.py#L669-L691 | [
"def",
"find_idx_by_threshold",
"(",
"self",
",",
"threshold",
")",
":",
"assert_is_type",
"(",
"threshold",
",",
"numeric",
")",
"thresh2d",
"=",
"self",
".",
"_metric_json",
"[",
"'thresholds_and_metric_scores'",
"]",
"for",
"i",
",",
"e",
"in",
"enumerate",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | generate_schema | Generate C# declaration file for a schema. | h2o-bindings/bin/gen_csharp.py | def generate_schema(class_name, schema):
"""
Generate C# declaration file for a schema.
"""
has_map = False
for field in schema["fields"]:
if field["type"].startswith("Map"): has_map = True
superclass = schema["superclass"]
if superclass == "Iced": superclass = "Object"
yield "... | def generate_schema(class_name, schema):
"""
Generate C# declaration file for a schema.
"""
has_map = False
for field in schema["fields"]:
if field["type"].startswith("Map"): has_map = True
superclass = schema["superclass"]
if superclass == "Iced": superclass = "Object"
yield "... | [
"Generate",
"C#",
"declaration",
"file",
"for",
"a",
"schema",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/gen_csharp.py#L24-L56 | [
"def",
"generate_schema",
"(",
"class_name",
",",
"schema",
")",
":",
"has_map",
"=",
"False",
"for",
"field",
"in",
"schema",
"[",
"\"fields\"",
"]",
":",
"if",
"field",
"[",
"\"type\"",
"]",
".",
"startswith",
"(",
"\"Map\"",
")",
":",
"has_map",
"=",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | H2ODeepWaterEstimator.available | Returns True if a deep water model can be built, or False otherwise. | h2o-py/h2o/estimators/deepwater.py | def available():
"""Returns True if a deep water model can be built, or False otherwise."""
builder_json = h2o.api("GET /3/ModelBuilders", data={"algo": "deepwater"})
visibility = builder_json["model_builders"]["deepwater"]["visibility"]
if visibility == "Experimental":
print... | def available():
"""Returns True if a deep water model can be built, or False otherwise."""
builder_json = h2o.api("GET /3/ModelBuilders", data={"algo": "deepwater"})
visibility = builder_json["model_builders"]["deepwater"]["visibility"]
if visibility == "Experimental":
print... | [
"Returns",
"True",
"if",
"a",
"deep",
"water",
"model",
"can",
"be",
"built",
"or",
"False",
"otherwise",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/estimators/deepwater.py#L1024-L1032 | [
"def",
"available",
"(",
")",
":",
"builder_json",
"=",
"h2o",
".",
"api",
"(",
"\"GET /3/ModelBuilders\"",
",",
"data",
"=",
"{",
"\"algo\"",
":",
"\"deepwater\"",
"}",
")",
"visibility",
"=",
"builder_json",
"[",
"\"model_builders\"",
"]",
"[",
"\"deepwater\... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | get_console_out | Grab the console output from Jenkins and save the content into a temp file
(g_temp_filename). From the saved text file, we can grab the names of
failed tests.
Parameters
----------
url_string : str
contains information on the jenkins job whose console output we are interested in. It is... | scripts/scrapeForIntermittents.py | def get_console_out(url_string):
"""
Grab the console output from Jenkins and save the content into a temp file
(g_temp_filename). From the saved text file, we can grab the names of
failed tests.
Parameters
----------
url_string : str
contains information on the jenkins job whos... | def get_console_out(url_string):
"""
Grab the console output from Jenkins and save the content into a temp file
(g_temp_filename). From the saved text file, we can grab the names of
failed tests.
Parameters
----------
url_string : str
contains information on the jenkins job whos... | [
"Grab",
"the",
"console",
"output",
"from",
"Jenkins",
"and",
"save",
"the",
"content",
"into",
"a",
"temp",
"file",
"(",
"g_temp_filename",
")",
".",
"From",
"the",
"saved",
"text",
"file",
"we",
"can",
"grab",
"the",
"names",
"of",
"failed",
"tests",
"... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/scrapeForIntermittents.py#L123-L138 | [
"def",
"get_console_out",
"(",
"url_string",
")",
":",
"full_command",
"=",
"'curl '",
"+",
"'\"'",
"+",
"url_string",
"+",
"'\"'",
"+",
"' --user '",
"+",
"'\"admin:admin\"'",
"+",
"' > '",
"+",
"g_temp_filename",
"subprocess",
".",
"call",
"(",
"full_command",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | trim_data_back_to | This method will remove data from the summary text file and the dictionary file for tests that occurs before
the number of months specified by monthToKeep.
:param monthToKeep:
:return: | scripts/scrapeForIntermittents.py | def trim_data_back_to(monthToKeep):
"""
This method will remove data from the summary text file and the dictionary file for tests that occurs before
the number of months specified by monthToKeep.
:param monthToKeep:
:return:
"""
global g_failed_tests_info_dict
current_time = time.time()... | def trim_data_back_to(monthToKeep):
"""
This method will remove data from the summary text file and the dictionary file for tests that occurs before
the number of months specified by monthToKeep.
:param monthToKeep:
:return:
"""
global g_failed_tests_info_dict
current_time = time.time()... | [
"This",
"method",
"will",
"remove",
"data",
"from",
"the",
"summary",
"text",
"file",
"and",
"the",
"dictionary",
"file",
"for",
"tests",
"that",
"occurs",
"before",
"the",
"number",
"of",
"months",
"specified",
"by",
"monthToKeep",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/scrapeForIntermittents.py#L231-L245 | [
"def",
"trim_data_back_to",
"(",
"monthToKeep",
")",
":",
"global",
"g_failed_tests_info_dict",
"current_time",
"=",
"time",
".",
"time",
"(",
")",
"# unit in seconds",
"oldest_time_allowed",
"=",
"current_time",
"-",
"monthToKeep",
"*",
"30",
"*",
"24",
"*",
"360... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | main | Main program. Expect script name plus 7 inputs in the following order:
- This script name
1. timestamp: time in s
2. jenkins_job_name (JOB_NAME)
3. build_id (BUILD_ID)
4. git hash (GIT_COMMIT)
5. node name (NODE_NAME)
6. unit test category (JUnit, PyUnit, RUnit, Hadoop)
7. Jenkins URL (... | scripts/scrapeForIntermittents.py | def main(argv):
"""
Main program. Expect script name plus 7 inputs in the following order:
- This script name
1. timestamp: time in s
2. jenkins_job_name (JOB_NAME)
3. build_id (BUILD_ID)
4. git hash (GIT_COMMIT)
5. node name (NODE_NAME)
6. unit test category (JUnit, PyUnit, RUnit, ... | def main(argv):
"""
Main program. Expect script name plus 7 inputs in the following order:
- This script name
1. timestamp: time in s
2. jenkins_job_name (JOB_NAME)
3. build_id (BUILD_ID)
4. git hash (GIT_COMMIT)
5. node name (NODE_NAME)
6. unit test category (JUnit, PyUnit, RUnit, ... | [
"Main",
"program",
".",
"Expect",
"script",
"name",
"plus",
"7",
"inputs",
"in",
"the",
"following",
"order",
":",
"-",
"This",
"script",
"name",
"1",
".",
"timestamp",
":",
"time",
"in",
"s",
"2",
".",
"jenkins_job_name",
"(",
"JOB_NAME",
")",
"3",
".... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/scrapeForIntermittents.py#L301-L362 | [
"def",
"main",
"(",
"argv",
")",
":",
"global",
"g_script_name",
"global",
"g_test_root_dir",
"global",
"g_timestamp",
"global",
"g_job_name",
"global",
"g_build_id",
"global",
"g_git_hash",
"global",
"g_node_name",
"global",
"g_unit_test_type",
"global",
"g_jenkins_url... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | init | Entry point for the bindings module. It parses the command line arguments and verifies their
correctness.
:param language -- name of the target language (used to show the command-line description).
:param output_dir -- folder where the bindings files will be generated. If the folder does
not exi... | h2o-bindings/bin/bindings.py | def init(language, output_dir, clear_dir=True):
"""
Entry point for the bindings module. It parses the command line arguments and verifies their
correctness.
:param language -- name of the target language (used to show the command-line description).
:param output_dir -- folder where the bindings... | def init(language, output_dir, clear_dir=True):
"""
Entry point for the bindings module. It parses the command line arguments and verifies their
correctness.
:param language -- name of the target language (used to show the command-line description).
:param output_dir -- folder where the bindings... | [
"Entry",
"point",
"for",
"the",
"bindings",
"module",
".",
"It",
"parses",
"the",
"command",
"line",
"arguments",
"and",
"verifies",
"their",
"correctness",
".",
":",
"param",
"language",
"--",
"name",
"of",
"the",
"target",
"language",
"(",
"used",
"to",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L83-L162 | [
"def",
"init",
"(",
"language",
",",
"output_dir",
",",
"clear_dir",
"=",
"True",
")",
":",
"if",
"config",
"[",
"\"start_time\"",
"]",
":",
"done",
"(",
")",
"config",
"[",
"\"start_time\"",
"]",
"=",
"time",
".",
"time",
"(",
")",
"print",
"(",
"\"... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | vprint | Print the provided string {msg}, but only when the --verbose option is on.
:param msg String to print.
:param pretty If on, then pprint() will be used instead of the regular print function. | h2o-bindings/bin/bindings.py | def vprint(msg, pretty=False):
"""
Print the provided string {msg}, but only when the --verbose option is on.
:param msg String to print.
:param pretty If on, then pprint() will be used instead of the regular print function.
"""
if not config["verbose"]:
return
if pretty:
... | def vprint(msg, pretty=False):
"""
Print the provided string {msg}, but only when the --verbose option is on.
:param msg String to print.
:param pretty If on, then pprint() will be used instead of the regular print function.
"""
if not config["verbose"]:
return
if pretty:
... | [
"Print",
"the",
"provided",
"string",
"{",
"msg",
"}",
"but",
"only",
"when",
"the",
"--",
"verbose",
"option",
"is",
"on",
".",
":",
"param",
"msg",
"String",
"to",
"print",
".",
":",
"param",
"pretty",
"If",
"on",
"then",
"pprint",
"()",
"will",
"b... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L170-L181 | [
"def",
"vprint",
"(",
"msg",
",",
"pretty",
"=",
"False",
")",
":",
"if",
"not",
"config",
"[",
"\"verbose\"",
"]",
":",
"return",
"if",
"pretty",
":",
"pp",
"(",
"msg",
")",
"else",
":",
"print",
"(",
"msg",
")"
] | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | wrap | Helper function that wraps msg to 120-chars page width. All lines (except maybe 1st) will be prefixed with
string {indent}. First line is prefixed only if {indent_first} is True.
:param msg: string to indent
:param indent: string that will be used for indentation
:param indent_first: if True then ... | h2o-bindings/bin/bindings.py | def wrap(msg, indent, indent_first=True):
"""
Helper function that wraps msg to 120-chars page width. All lines (except maybe 1st) will be prefixed with
string {indent}. First line is prefixed only if {indent_first} is True.
:param msg: string to indent
:param indent: string that will be used fo... | def wrap(msg, indent, indent_first=True):
"""
Helper function that wraps msg to 120-chars page width. All lines (except maybe 1st) will be prefixed with
string {indent}. First line is prefixed only if {indent_first} is True.
:param msg: string to indent
:param indent: string that will be used fo... | [
"Helper",
"function",
"that",
"wraps",
"msg",
"to",
"120",
"-",
"chars",
"page",
"width",
".",
"All",
"lines",
"(",
"except",
"maybe",
"1st",
")",
"will",
"be",
"prefixed",
"with",
"string",
"{",
"indent",
"}",
".",
"First",
"line",
"is",
"prefixed",
"... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L184-L196 | [
"def",
"wrap",
"(",
"msg",
",",
"indent",
",",
"indent_first",
"=",
"True",
")",
":",
"wrapper",
".",
"width",
"=",
"120",
"wrapper",
".",
"initial_indent",
"=",
"indent",
"wrapper",
".",
"subsequent_indent",
"=",
"indent",
"msg",
"=",
"wrapper",
".",
"f... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | endpoints | Return the list of REST API endpoints. The data is enriched with the following fields:
class_name: which back-end class handles this endpoint (the class is derived from the URL);
ischema: input schema object (input_schema is the schema's name)
oschema: output schema object (output_schema is the schema... | h2o-bindings/bin/bindings.py | def endpoints(raw=False):
"""
Return the list of REST API endpoints. The data is enriched with the following fields:
class_name: which back-end class handles this endpoint (the class is derived from the URL);
ischema: input schema object (input_schema is the schema's name)
oschema: output sche... | def endpoints(raw=False):
"""
Return the list of REST API endpoints. The data is enriched with the following fields:
class_name: which back-end class handles this endpoint (the class is derived from the URL);
ischema: input schema object (input_schema is the schema's name)
oschema: output sche... | [
"Return",
"the",
"list",
"of",
"REST",
"API",
"endpoints",
".",
"The",
"data",
"is",
"enriched",
"with",
"the",
"following",
"fields",
":",
"class_name",
":",
"which",
"back",
"-",
"end",
"class",
"handles",
"this",
"endpoint",
"(",
"the",
"class",
"is",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L199-L295 | [
"def",
"endpoints",
"(",
"raw",
"=",
"False",
")",
":",
"json",
"=",
"_request_or_exit",
"(",
"\"/3/Metadata/endpoints\"",
")",
"if",
"raw",
":",
"return",
"json",
"schmap",
"=",
"schemas_map",
"(",
")",
"apinames",
"=",
"{",
"}",
"# Used for checking for api ... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | endpoint_groups | Return endpoints, grouped by the class which handles them. | h2o-bindings/bin/bindings.py | def endpoint_groups():
"""Return endpoints, grouped by the class which handles them."""
groups = defaultdict(list)
for e in endpoints():
groups[e["class_name"]].append(e)
return groups | def endpoint_groups():
"""Return endpoints, grouped by the class which handles them."""
groups = defaultdict(list)
for e in endpoints():
groups[e["class_name"]].append(e)
return groups | [
"Return",
"endpoints",
"grouped",
"by",
"the",
"class",
"which",
"handles",
"them",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L298-L303 | [
"def",
"endpoint_groups",
"(",
")",
":",
"groups",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"e",
"in",
"endpoints",
"(",
")",
":",
"groups",
"[",
"e",
"[",
"\"class_name\"",
"]",
"]",
".",
"append",
"(",
"e",
")",
"return",
"groups"
] | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | schemas | Return the list of H₂O schemas.
:param raw: if True, then the complete response to .../schemas is returned (including the metadata) | h2o-bindings/bin/bindings.py | def schemas(raw=False):
"""
Return the list of H₂O schemas.
:param raw: if True, then the complete response to .../schemas is returned (including the metadata)
"""
json = _request_or_exit("/3/Metadata/schemas")
if raw: return json
assert "schemas" in json, "Unexpected result from /3/Metadat... | def schemas(raw=False):
"""
Return the list of H₂O schemas.
:param raw: if True, then the complete response to .../schemas is returned (including the metadata)
"""
json = _request_or_exit("/3/Metadata/schemas")
if raw: return json
assert "schemas" in json, "Unexpected result from /3/Metadat... | [
"Return",
"the",
"list",
"of",
"H₂O",
"schemas",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L306-L338 | [
"def",
"schemas",
"(",
"raw",
"=",
"False",
")",
":",
"json",
"=",
"_request_or_exit",
"(",
"\"/3/Metadata/schemas\"",
")",
"if",
"raw",
":",
"return",
"json",
"assert",
"\"schemas\"",
"in",
"json",
",",
"\"Unexpected result from /3/Metadata/schemas call\"",
"# Simp... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | schemas_map | Returns a dictionary of H₂O schemas, indexed by their name. | h2o-bindings/bin/bindings.py | def schemas_map(add_generics=False):
"""
Returns a dictionary of H₂O schemas, indexed by their name.
"""
m = {}
for schema in schemas():
if schema["name"].startswith('AutoML'): continue # Generation code doesn't know how to deal with defaults for complex objects yet
if schema["name"... | def schemas_map(add_generics=False):
"""
Returns a dictionary of H₂O schemas, indexed by their name.
"""
m = {}
for schema in schemas():
if schema["name"].startswith('AutoML'): continue # Generation code doesn't know how to deal with defaults for complex objects yet
if schema["name"... | [
"Returns",
"a",
"dictionary",
"of",
"H₂O",
"schemas",
"indexed",
"by",
"their",
"name",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L341-L395 | [
"def",
"schemas_map",
"(",
"add_generics",
"=",
"False",
")",
":",
"m",
"=",
"{",
"}",
"for",
"schema",
"in",
"schemas",
"(",
")",
":",
"if",
"schema",
"[",
"\"name\"",
"]",
".",
"startswith",
"(",
"'AutoML'",
")",
":",
"continue",
"# Generation code doe... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | enums | Return the dictionary of H₂O enums, retrieved from data in schemas(). For each entry in the dictionary its key is
the name of the enum, and the value is the set of all enum values. | h2o-bindings/bin/bindings.py | def enums():
"""
Return the dictionary of H₂O enums, retrieved from data in schemas(). For each entry in the dictionary its key is
the name of the enum, and the value is the set of all enum values.
"""
enumset = defaultdict(set)
for schema in schemas():
for field in schema["fields"]:
... | def enums():
"""
Return the dictionary of H₂O enums, retrieved from data in schemas(). For each entry in the dictionary its key is
the name of the enum, and the value is the set of all enum values.
"""
enumset = defaultdict(set)
for schema in schemas():
for field in schema["fields"]:
... | [
"Return",
"the",
"dictionary",
"of",
"H₂O",
"enums",
"retrieved",
"from",
"data",
"in",
"schemas",
"()",
".",
"For",
"each",
"entry",
"in",
"the",
"dictionary",
"its",
"key",
"is",
"the",
"name",
"of",
"the",
"enum",
"and",
"the",
"value",
"is",
"the",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L407-L417 | [
"def",
"enums",
"(",
")",
":",
"enumset",
"=",
"defaultdict",
"(",
"set",
")",
"for",
"schema",
"in",
"schemas",
"(",
")",
":",
"for",
"field",
"in",
"schema",
"[",
"\"fields\"",
"]",
":",
"if",
"field",
"[",
"\"type\"",
"]",
"==",
"\"enum\"",
":",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | write_to_file | Writes content to the given file. The file's directory will be created if needed.
:param filename: name of the output file, relative to the "destination folder" provided by the user
:param content: iterable (line-by-line) that should be written to the file. Either a list or a generator. Each
... | h2o-bindings/bin/bindings.py | def write_to_file(filename, content):
"""
Writes content to the given file. The file's directory will be created if needed.
:param filename: name of the output file, relative to the "destination folder" provided by the user
:param content: iterable (line-by-line) that should be written to the file. ... | def write_to_file(filename, content):
"""
Writes content to the given file. The file's directory will be created if needed.
:param filename: name of the output file, relative to the "destination folder" provided by the user
:param content: iterable (line-by-line) that should be written to the file. ... | [
"Writes",
"content",
"to",
"the",
"given",
"file",
".",
"The",
"file",
"s",
"directory",
"will",
"be",
"created",
"if",
"needed",
".",
":",
"param",
"filename",
":",
"name",
"of",
"the",
"output",
"file",
"relative",
"to",
"the",
"destination",
"folder",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L420-L444 | [
"def",
"write_to_file",
"(",
"filename",
",",
"content",
")",
":",
"if",
"not",
"config",
"[",
"\"destdir\"",
"]",
":",
"print",
"(",
"\"{destdir} config variable not present. Did you forget to run init()?\"",
")",
"sys",
".",
"exit",
"(",
"8",
")",
"abs_filename",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | _request_or_exit | Internal function: retrieve and return json data from the provided endpoint, or die with an error message if the
URL cannot be retrieved. | h2o-bindings/bin/bindings.py | def _request_or_exit(endpoint):
"""
Internal function: retrieve and return json data from the provided endpoint, or die with an error message if the
URL cannot be retrieved.
"""
if endpoint[0] == "/":
endpoint = endpoint[1:]
if endpoint in requests_memo:
return requests_memo[endp... | def _request_or_exit(endpoint):
"""
Internal function: retrieve and return json data from the provided endpoint, or die with an error message if the
URL cannot be retrieved.
"""
if endpoint[0] == "/":
endpoint = endpoint[1:]
if endpoint in requests_memo:
return requests_memo[endp... | [
"Internal",
"function",
":",
"retrieve",
"and",
"return",
"json",
"data",
"from",
"the",
"provided",
"endpoint",
"or",
"die",
"with",
"an",
"error",
"message",
"if",
"the",
"URL",
"cannot",
"be",
"retrieved",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/bindings.py#L458-L505 | [
"def",
"_request_or_exit",
"(",
"endpoint",
")",
":",
"if",
"endpoint",
"[",
"0",
"]",
"==",
"\"/\"",
":",
"endpoint",
"=",
"endpoint",
"[",
"1",
":",
"]",
"if",
"endpoint",
"in",
"requests_memo",
":",
"return",
"requests_memo",
"[",
"endpoint",
"]",
"if... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | set_s3_credentials | Creates a new Amazon S3 client internally with specified credentials.
There are no validations done to the credentials. Incorrect credentials are thus revealed with first S3 import call.
secretKeyId Amazon S3 Secret Key ID (provided by Amazon)
secretAccessKey Amazon S3 Secret Access Key (provided by Am... | h2o-py/h2o/persist/persist.py | def set_s3_credentials(secret_key_id, secret_access_key):
"""Creates a new Amazon S3 client internally with specified credentials.
There are no validations done to the credentials. Incorrect credentials are thus revealed with first S3 import call.
secretKeyId Amazon S3 Secret Key ID (provided by Amazon... | def set_s3_credentials(secret_key_id, secret_access_key):
"""Creates a new Amazon S3 client internally with specified credentials.
There are no validations done to the credentials. Incorrect credentials are thus revealed with first S3 import call.
secretKeyId Amazon S3 Secret Key ID (provided by Amazon... | [
"Creates",
"a",
"new",
"Amazon",
"S3",
"client",
"internally",
"with",
"specified",
"credentials",
".",
"There",
"are",
"no",
"validations",
"done",
"to",
"the",
"credentials",
".",
"Incorrect",
"credentials",
"are",
"thus",
"revealed",
"with",
"first",
"S3",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/persist/persist.py#L5-L30 | [
"def",
"set_s3_credentials",
"(",
"secret_key_id",
",",
"secret_access_key",
")",
":",
"if",
"(",
"secret_key_id",
"is",
"None",
")",
":",
"raise",
"H2OValueError",
"(",
"\"Secret key ID must be specified\"",
")",
"if",
"(",
"secret_access_key",
"is",
"None",
")",
... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | GroupBy.get_frame | Return the resulting H2OFrame containing the result(s) of aggregation(s) of the group by.
The number of rows denote the number of groups generated by the group by operation.
The number of columns depend on the number of aggregations performed, the number of columns specified in
the col paramet... | h2o-py/h2o/group_by.py | def get_frame(self):
"""
Return the resulting H2OFrame containing the result(s) of aggregation(s) of the group by.
The number of rows denote the number of groups generated by the group by operation.
The number of columns depend on the number of aggregations performed, the number of col... | def get_frame(self):
"""
Return the resulting H2OFrame containing the result(s) of aggregation(s) of the group by.
The number of rows denote the number of groups generated by the group by operation.
The number of columns depend on the number of aggregations performed, the number of col... | [
"Return",
"the",
"resulting",
"H2OFrame",
"containing",
"the",
"result",
"(",
"s",
")",
"of",
"aggregation",
"(",
"s",
")",
"of",
"the",
"group",
"by",
"."
] | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/group_by.py#L222-L252 | [
"def",
"get_frame",
"(",
"self",
")",
":",
"if",
"self",
".",
"_res",
"is",
"None",
":",
"aggs",
"=",
"[",
"]",
"cols_operated",
"=",
"[",
"]",
"for",
"k",
"in",
"self",
".",
"_aggs",
":",
"aggs",
"+=",
"(",
"self",
".",
"_aggs",
"[",
"k",
"]",... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | add_schema_to_dependency_array | This is a helper function to order all schemas according to their usage. For example, if schema A uses schemas B
and C, then they should be reordered as {B, C, A}.
:param schema: schema object that we are processing right now
:param ordered_schemas: an OrderedDict of schemas that were already encountere... | h2o-bindings/bin/gen_thrift.py | def add_schema_to_dependency_array(schema, ordered_schemas, schemas_map):
"""
This is a helper function to order all schemas according to their usage. For example, if schema A uses schemas B
and C, then they should be reordered as {B, C, A}.
:param schema: schema object that we are processing right no... | def add_schema_to_dependency_array(schema, ordered_schemas, schemas_map):
"""
This is a helper function to order all schemas according to their usage. For example, if schema A uses schemas B
and C, then they should be reordered as {B, C, A}.
:param schema: schema object that we are processing right no... | [
"This",
"is",
"a",
"helper",
"function",
"to",
"order",
"all",
"schemas",
"according",
"to",
"their",
"usage",
".",
"For",
"example",
"if",
"schema",
"A",
"uses",
"schemas",
"B",
"and",
"C",
"then",
"they",
"should",
"be",
"reordered",
"as",
"{",
"B",
... | h2oai/h2o-3 | python | https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-bindings/bin/gen_thrift.py#L32-L52 | [
"def",
"add_schema_to_dependency_array",
"(",
"schema",
",",
"ordered_schemas",
",",
"schemas_map",
")",
":",
"ordered_schemas",
"[",
"schema",
"[",
"\"name\"",
"]",
"]",
"=",
"schema",
"for",
"field",
"in",
"schema",
"[",
"\"fields\"",
"]",
":",
"field_schema_n... | dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8 |
test | update_site_forward | Set site domain and name. | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py | def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "{{cookiecutter.domain_name}}",
"name": "{{cookiecutter.project_name}}",
... | def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "{{cookiecutter.domain_name}}",
"name": "{{cookiecutter.project_name}}",
... | [
"Set",
"site",
"domain",
"and",
"name",
"."
] | pydanny/cookiecutter-django | python | https://github.com/pydanny/cookiecutter-django/blob/bb9b482e96d1966e20745eeea87a8aa10ed1c861/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py#L10-L19 | [
"def",
"update_site_forward",
"(",
"apps",
",",
"schema_editor",
")",
":",
"Site",
"=",
"apps",
".",
"get_model",
"(",
"\"sites\"",
",",
"\"Site\"",
")",
"Site",
".",
"objects",
".",
"update_or_create",
"(",
"id",
"=",
"settings",
".",
"SITE_ID",
",",
"def... | bb9b482e96d1966e20745eeea87a8aa10ed1c861 |
test | generate_random_string | Example:
opting out for 50 symbol-long, [a-z][A-Z][0-9] string
would yield log_2((26+26+50)^50) ~= 334 bit strength. | hooks/post_gen_project.py | def generate_random_string(
length, using_digits=False, using_ascii_letters=False, using_punctuation=False
):
"""
Example:
opting out for 50 symbol-long, [a-z][A-Z][0-9] string
would yield log_2((26+26+50)^50) ~= 334 bit strength.
"""
if not using_sysrandom:
return None
... | def generate_random_string(
length, using_digits=False, using_ascii_letters=False, using_punctuation=False
):
"""
Example:
opting out for 50 symbol-long, [a-z][A-Z][0-9] string
would yield log_2((26+26+50)^50) ~= 334 bit strength.
"""
if not using_sysrandom:
return None
... | [
"Example",
":",
"opting",
"out",
"for",
"50",
"symbol",
"-",
"long",
"[",
"a",
"-",
"z",
"]",
"[",
"A",
"-",
"Z",
"]",
"[",
"0",
"-",
"9",
"]",
"string",
"would",
"yield",
"log_2",
"((",
"26",
"+",
"26",
"+",
"50",
")",
"^50",
")",
"~",
"="... | pydanny/cookiecutter-django | python | https://github.com/pydanny/cookiecutter-django/blob/bb9b482e96d1966e20745eeea87a8aa10ed1c861/hooks/post_gen_project.py#L107-L129 | [
"def",
"generate_random_string",
"(",
"length",
",",
"using_digits",
"=",
"False",
",",
"using_ascii_letters",
"=",
"False",
",",
"using_punctuation",
"=",
"False",
")",
":",
"if",
"not",
"using_sysrandom",
":",
"return",
"None",
"symbols",
"=",
"[",
"]",
"if"... | bb9b482e96d1966e20745eeea87a8aa10ed1c861 |
test | send_message | :param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id | instabot/bot/bot_direct.py | def send_message(self, text, user_ids, thread_id=None):
"""
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
user_ids = _get_user_ids(self, user_ids)
if not isinstance(... | def send_message(self, text, user_ids, thread_id=None):
"""
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
user_ids = _get_user_ids(self, user_ids)
if not isinstance(... | [
":",
"param",
"self",
":",
"bot",
":",
"param",
"text",
":",
"text",
"of",
"message",
":",
"param",
"user_ids",
":",
"list",
"of",
"user_ids",
"for",
"creating",
"group",
"or",
"one",
"user_id",
"for",
"send",
"to",
"one",
"person",
":",
"param",
"thre... | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_direct.py#L4-L34 | [
"def",
"send_message",
"(",
"self",
",",
"text",
",",
"user_ids",
",",
"thread_id",
"=",
"None",
")",
":",
"user_ids",
"=",
"_get_user_ids",
"(",
"self",
",",
"user_ids",
")",
"if",
"not",
"isinstance",
"(",
"text",
",",
"str",
")",
"and",
"isinstance",
... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | send_media | :param media_id:
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id | instabot/bot/bot_direct.py | def send_media(self, media_id, user_ids, text='', thread_id=None):
"""
:param media_id:
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
user_ids = _get_user_ids(self, ... | def send_media(self, media_id, user_ids, text='', thread_id=None):
"""
:param media_id:
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
user_ids = _get_user_ids(self, ... | [
":",
"param",
"media_id",
":",
":",
"param",
"self",
":",
"bot",
":",
"param",
"text",
":",
"text",
"of",
"message",
":",
"param",
"user_ids",
":",
"list",
"of",
"user_ids",
"for",
"creating",
"group",
"or",
"one",
"user_id",
"for",
"send",
"to",
"one"... | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_direct.py#L51-L83 | [
"def",
"send_media",
"(",
"self",
",",
"media_id",
",",
"user_ids",
",",
"text",
"=",
"''",
",",
"thread_id",
"=",
"None",
")",
":",
"user_ids",
"=",
"_get_user_ids",
"(",
"self",
",",
"user_ids",
")",
"if",
"not",
"isinstance",
"(",
"text",
",",
"str"... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | send_hashtag | :param hashtag: hashtag
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id | instabot/bot/bot_direct.py | def send_hashtag(self, hashtag, user_ids, text='', thread_id=None):
"""
:param hashtag: hashtag
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
user_ids = _get_user_id... | def send_hashtag(self, hashtag, user_ids, text='', thread_id=None):
"""
:param hashtag: hashtag
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
user_ids = _get_user_id... | [
":",
"param",
"hashtag",
":",
"hashtag",
":",
"param",
"self",
":",
"bot",
":",
"param",
"text",
":",
"text",
"of",
"message",
":",
"param",
"user_ids",
":",
"list",
"of",
"user_ids",
"for",
"creating",
"group",
"or",
"one",
"user_id",
"for",
"send",
"... | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_direct.py#L100-L125 | [
"def",
"send_hashtag",
"(",
"self",
",",
"hashtag",
",",
"user_ids",
",",
"text",
"=",
"''",
",",
"thread_id",
"=",
"None",
")",
":",
"user_ids",
"=",
"_get_user_ids",
"(",
"self",
",",
"user_ids",
")",
"if",
"not",
"isinstance",
"(",
"text",
",",
"str... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | send_profile | :param profile_user_id: profile_id
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id | instabot/bot/bot_direct.py | def send_profile(self, profile_user_id, user_ids, text='', thread_id=None):
"""
:param profile_user_id: profile_id
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
prof... | def send_profile(self, profile_user_id, user_ids, text='', thread_id=None):
"""
:param profile_user_id: profile_id
:param self: bot
:param text: text of message
:param user_ids: list of user_ids for creating group or one user_id for send to one person
:param thread_id: thread_id
"""
prof... | [
":",
"param",
"profile_user_id",
":",
"profile_id",
":",
"param",
"self",
":",
"bot",
":",
"param",
"text",
":",
"text",
"of",
"message",
":",
"param",
"user_ids",
":",
"list",
"of",
"user_ids",
"for",
"creating",
"group",
"or",
"one",
"user_id",
"for",
... | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_direct.py#L128-L157 | [
"def",
"send_profile",
"(",
"self",
",",
"profile_user_id",
",",
"user_ids",
",",
"text",
"=",
"''",
",",
"thread_id",
"=",
"None",
")",
":",
"profile_id",
"=",
"self",
".",
"convert_to_user_id",
"(",
"profile_user_id",
")",
"user_ids",
"=",
"_get_user_ids",
... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | API.json_data | Adds the default_data to data and dumps it to a json. | instabot/api/api.py | def json_data(self, data=None):
"""Adds the default_data to data and dumps it to a json."""
if data is None:
data = {}
data.update(self.default_data)
return json.dumps(data) | def json_data(self, data=None):
"""Adds the default_data to data and dumps it to a json."""
if data is None:
data = {}
data.update(self.default_data)
return json.dumps(data) | [
"Adds",
"the",
"default_data",
"to",
"data",
"and",
"dumps",
"it",
"to",
"a",
"json",
"."
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/api/api.py#L283-L288 | [
"def",
"json_data",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"{",
"}",
"data",
".",
"update",
"(",
"self",
".",
"default_data",
")",
"return",
"json",
".",
"dumps",
"(",
"data",
")"
] | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | API.get_users_reel | Input: user_ids - a list of user_id
Output: dictionary: user_id - stories data.
Basically, for each user output the same as after self.get_user_reel | instabot/api/api.py | def get_users_reel(self, user_ids):
"""
Input: user_ids - a list of user_id
Output: dictionary: user_id - stories data.
Basically, for each user output the same as after self.get_user_reel
"""
url = 'feed/reels_media/'
res = self.send_request(
url,
... | def get_users_reel(self, user_ids):
"""
Input: user_ids - a list of user_id
Output: dictionary: user_id - stories data.
Basically, for each user output the same as after self.get_user_reel
"""
url = 'feed/reels_media/'
res = self.send_request(
url,
... | [
"Input",
":",
"user_ids",
"-",
"a",
"list",
"of",
"user_id",
"Output",
":",
"dictionary",
":",
"user_id",
"-",
"stories",
"data",
".",
"Basically",
"for",
"each",
"user",
"output",
"the",
"same",
"as",
"after",
"self",
".",
"get_user_reel"
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/api/api.py#L849-L866 | [
"def",
"get_users_reel",
"(",
"self",
",",
"user_ids",
")",
":",
"url",
"=",
"'feed/reels_media/'",
"res",
"=",
"self",
".",
"send_request",
"(",
"url",
",",
"post",
"=",
"self",
".",
"json_data",
"(",
"{",
"'user_ids'",
":",
"[",
"str",
"(",
"x",
")",... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | API.see_reels | Input - the list of reels jsons
They can be aquired by using get_users_reel() or get_user_reel() methods | instabot/api/api.py | def see_reels(self, reels):
"""
Input - the list of reels jsons
They can be aquired by using get_users_reel() or get_user_reel() methods
"""
if not isinstance(reels, list):
reels = [reels]
story_seen = {}
now = int(time.time())
for i, ... | def see_reels(self, reels):
"""
Input - the list of reels jsons
They can be aquired by using get_users_reel() or get_user_reel() methods
"""
if not isinstance(reels, list):
reels = [reels]
story_seen = {}
now = int(time.time())
for i, ... | [
"Input",
"-",
"the",
"list",
"of",
"reels",
"jsons",
"They",
"can",
"be",
"aquired",
"by",
"using",
"get_users_reel",
"()",
"or",
"get_user_reel",
"()",
"methods"
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/api/api.py#L868-L893 | [
"def",
"see_reels",
"(",
"self",
",",
"reels",
")",
":",
"if",
"not",
"isinstance",
"(",
"reels",
",",
"list",
")",
":",
"reels",
"=",
"[",
"reels",
"]",
"story_seen",
"=",
"{",
"}",
"now",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | comment_user | Comments last user_id's medias | instabot/bot/bot_comment.py | def comment_user(self, user_id, amount=None):
""" Comments last user_id's medias """
if not self.check_user(user_id, filter_closed_acc=True):
return False
self.logger.info("Going to comment user_%s's feed:" % user_id)
user_id = self.convert_to_user_id(user_id)
medias = self.get_user_medias(u... | def comment_user(self, user_id, amount=None):
""" Comments last user_id's medias """
if not self.check_user(user_id, filter_closed_acc=True):
return False
self.logger.info("Going to comment user_%s's feed:" % user_id)
user_id = self.convert_to_user_id(user_id)
medias = self.get_user_medias(u... | [
"Comments",
"last",
"user_id",
"s",
"medias"
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_comment.py#L91-L102 | [
"def",
"comment_user",
"(",
"self",
",",
"user_id",
",",
"amount",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"check_user",
"(",
"user_id",
",",
"filter_closed_acc",
"=",
"True",
")",
":",
"return",
"False",
"self",
".",
"logger",
".",
"info",
"(... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | Bot.delay | Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`. | instabot/bot/bot.py | def delay(self, key):
"""Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`."""
last_action, target_delay = self.last[key], self.delays[key]
elapsed_time = time.time() - last_action
if elapsed_time < target_delay:
t_remaining = target_delay - elapsed_time
... | def delay(self, key):
"""Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`."""
last_action, target_delay = self.last[key], self.delays[key]
elapsed_time = time.time() - last_action
if elapsed_time < target_delay:
t_remaining = target_delay - elapsed_time
... | [
"Sleep",
"only",
"if",
"elapsed",
"time",
"since",
"self",
".",
"last",
"[",
"key",
"]",
"<",
"self",
".",
"delay",
"[",
"key",
"]",
"."
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot.py#L293-L300 | [
"def",
"delay",
"(",
"self",
",",
"key",
")",
":",
"last_action",
",",
"target_delay",
"=",
"self",
".",
"last",
"[",
"key",
"]",
",",
"self",
".",
"delays",
"[",
"key",
"]",
"elapsed_time",
"=",
"time",
".",
"time",
"(",
")",
"-",
"last_action",
"... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | get_credentials | Returns login and password stored in `secret.txt`. | instabot/api/prepare.py | def get_credentials(username=None):
"""Returns login and password stored in `secret.txt`."""
while not check_secret():
pass
while True:
try:
with open(SECRET_FILE, "r") as f:
lines = [line.strip().split(":", 2) for line in f.readlines()]
except ValueError:... | def get_credentials(username=None):
"""Returns login and password stored in `secret.txt`."""
while not check_secret():
pass
while True:
try:
with open(SECRET_FILE, "r") as f:
lines = [line.strip().split(":", 2) for line in f.readlines()]
except ValueError:... | [
"Returns",
"login",
"and",
"password",
"stored",
"in",
"secret",
".",
"txt",
"."
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/api/prepare.py#L18-L50 | [
"def",
"get_credentials",
"(",
"username",
"=",
"None",
")",
":",
"while",
"not",
"check_secret",
"(",
")",
":",
"pass",
"while",
"True",
":",
"try",
":",
"with",
"open",
"(",
"SECRET_FILE",
",",
"\"r\"",
")",
"as",
"f",
":",
"lines",
"=",
"[",
"line... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | like_user | Likes last user_id's medias | instabot/bot/bot_like.py | def like_user(self, user_id, amount=None, filtration=True):
""" Likes last user_id's medias """
if filtration:
if not self.check_user(user_id):
return False
self.logger.info("Liking user_%s's feed:" % user_id)
user_id = self.convert_to_user_id(user_id)
medias = self.get_user_medi... | def like_user(self, user_id, amount=None, filtration=True):
""" Likes last user_id's medias """
if filtration:
if not self.check_user(user_id):
return False
self.logger.info("Liking user_%s's feed:" % user_id)
user_id = self.convert_to_user_id(user_id)
medias = self.get_user_medi... | [
"Likes",
"last",
"user_id",
"s",
"medias"
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_like.py#L94-L106 | [
"def",
"like_user",
"(",
"self",
",",
"user_id",
",",
"amount",
"=",
"None",
",",
"filtration",
"=",
"True",
")",
":",
"if",
"filtration",
":",
"if",
"not",
"self",
".",
"check_user",
"(",
"user_id",
")",
":",
"return",
"False",
"self",
".",
"logger",
... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | like_hashtag | Likes last medias from hashtag | instabot/bot/bot_like.py | def like_hashtag(self, hashtag, amount=None):
""" Likes last medias from hashtag """
self.logger.info("Going to like media with hashtag #%s." % hashtag)
medias = self.get_total_hashtag_medias(hashtag, amount)
return self.like_medias(medias) | def like_hashtag(self, hashtag, amount=None):
""" Likes last medias from hashtag """
self.logger.info("Going to like media with hashtag #%s." % hashtag)
medias = self.get_total_hashtag_medias(hashtag, amount)
return self.like_medias(medias) | [
"Likes",
"last",
"medias",
"from",
"hashtag"
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_like.py#L117-L121 | [
"def",
"like_hashtag",
"(",
"self",
",",
"hashtag",
",",
"amount",
"=",
"None",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Going to like media with hashtag #%s.\"",
"%",
"hashtag",
")",
"medias",
"=",
"self",
".",
"get_total_hashtag_medias",
"(",
"h... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | check_not_bot | Filter bot from real users. | instabot/bot/bot_filter.py | def check_not_bot(self, user_id):
""" Filter bot from real users. """
self.small_delay()
user_id = self.convert_to_user_id(user_id)
if not user_id:
return False
if user_id in self.whitelist:
return True
if user_id in self.blacklist:
return False
user_info = self.get_... | def check_not_bot(self, user_id):
""" Filter bot from real users. """
self.small_delay()
user_id = self.convert_to_user_id(user_id)
if not user_id:
return False
if user_id in self.whitelist:
return True
if user_id in self.blacklist:
return False
user_info = self.get_... | [
"Filter",
"bot",
"from",
"real",
"users",
"."
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_filter.py#L230-L257 | [
"def",
"check_not_bot",
"(",
"self",
",",
"user_id",
")",
":",
"self",
".",
"small_delay",
"(",
")",
"user_id",
"=",
"self",
".",
"convert_to_user_id",
"(",
"user_id",
")",
"if",
"not",
"user_id",
":",
"return",
"False",
"if",
"user_id",
"in",
"self",
".... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | read_list_from_file | Reads list from file. One line - one item.
Returns the list if file items. | instabot/bot/bot_support.py | def read_list_from_file(file_path, quiet=False):
"""
Reads list from file. One line - one item.
Returns the list if file items.
"""
try:
if not check_if_file_exists(file_path, quiet=quiet):
return []
with codecs.open(file_path, "r", encoding="utf-8") as f:
... | def read_list_from_file(file_path, quiet=False):
"""
Reads list from file. One line - one item.
Returns the list if file items.
"""
try:
if not check_if_file_exists(file_path, quiet=quiet):
return []
with codecs.open(file_path, "r", encoding="utf-8") as f:
... | [
"Reads",
"list",
"from",
"file",
".",
"One",
"line",
"-",
"one",
"item",
".",
"Returns",
"the",
"list",
"if",
"file",
"items",
"."
] | instagrambot/instabot | python | https://github.com/instagrambot/instabot/blob/d734f892ac4cc35d22746a4f2680425ffaff0927/instabot/bot/bot_support.py#L23-L39 | [
"def",
"read_list_from_file",
"(",
"file_path",
",",
"quiet",
"=",
"False",
")",
":",
"try",
":",
"if",
"not",
"check_if_file_exists",
"(",
"file_path",
",",
"quiet",
"=",
"quiet",
")",
":",
"return",
"[",
"]",
"with",
"codecs",
".",
"open",
"(",
"file_p... | d734f892ac4cc35d22746a4f2680425ffaff0927 |
test | get_tweets | Gets tweets for a given user, via the Twitter frontend API. | twitter_scraper.py | def get_tweets(user, pages=25):
"""Gets tweets for a given user, via the Twitter frontend API."""
url = f'https://twitter.com/i/profiles/show/{user}/timeline/tweets?include_available_features=1&include_entities=1&include_new_items_bar=true'
headers = {
'Accept': 'application/json, text/javascript, ... | def get_tweets(user, pages=25):
"""Gets tweets for a given user, via the Twitter frontend API."""
url = f'https://twitter.com/i/profiles/show/{user}/timeline/tweets?include_available_features=1&include_entities=1&include_new_items_bar=true'
headers = {
'Accept': 'application/json, text/javascript, ... | [
"Gets",
"tweets",
"for",
"a",
"given",
"user",
"via",
"the",
"Twitter",
"frontend",
"API",
"."
] | kennethreitz/twitter-scraper | python | https://github.com/kennethreitz/twitter-scraper/blob/6e5631ab478e1066f6cb1bb9e9633d4928f6a550/twitter_scraper.py#L8-L115 | [
"def",
"get_tweets",
"(",
"user",
",",
"pages",
"=",
"25",
")",
":",
"url",
"=",
"f'https://twitter.com/i/profiles/show/{user}/timeline/tweets?include_available_features=1&include_entities=1&include_new_items_bar=true'",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/json, t... | 6e5631ab478e1066f6cb1bb9e9633d4928f6a550 |
test | Message.schedule | Add a specific enqueue time to the message.
:param schedule_time: The scheduled time to enqueue the message.
:type schedule_time: ~datetime.datetime | azure-servicebus/azure/servicebus/common/message.py | def schedule(self, schedule_time):
"""Add a specific enqueue time to the message.
:param schedule_time: The scheduled time to enqueue the message.
:type schedule_time: ~datetime.datetime
"""
if not self.properties.message_id:
self.properties.message_id = str(uuid.uui... | def schedule(self, schedule_time):
"""Add a specific enqueue time to the message.
:param schedule_time: The scheduled time to enqueue the message.
:type schedule_time: ~datetime.datetime
"""
if not self.properties.message_id:
self.properties.message_id = str(uuid.uui... | [
"Add",
"a",
"specific",
"enqueue",
"time",
"to",
"the",
"message",
"."
] | Azure/azure-sdk-for-python | python | https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/message.py#L274-L284 | [
"def",
"schedule",
"(",
"self",
",",
"schedule_time",
")",
":",
"if",
"not",
"self",
".",
"properties",
".",
"message_id",
":",
"self",
".",
"properties",
".",
"message_id",
"=",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"if",
"not",
"self",
"... | d7306fde32f60a293a7567678692bdad31e4b667 |
test | Message.complete | Complete the message.
This removes the message from the queue.
:raises: ~azure.servicebus.common.errors.MessageAlreadySettled if the message has been settled.
:raises: ~azure.servicebus.common.errors.MessageLockExpired if message lock has already expired.
:raises: ~azure.servicebus.com... | azure-servicebus/azure/servicebus/common/message.py | def complete(self):
"""Complete the message.
This removes the message from the queue.
:raises: ~azure.servicebus.common.errors.MessageAlreadySettled if the message has been settled.
:raises: ~azure.servicebus.common.errors.MessageLockExpired if message lock has already expired.
... | def complete(self):
"""Complete the message.
This removes the message from the queue.
:raises: ~azure.servicebus.common.errors.MessageAlreadySettled if the message has been settled.
:raises: ~azure.servicebus.common.errors.MessageLockExpired if message lock has already expired.
... | [
"Complete",
"the",
"message",
"."
] | Azure/azure-sdk-for-python | python | https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/message.py#L306-L320 | [
"def",
"complete",
"(",
"self",
")",
":",
"self",
".",
"_is_live",
"(",
"'complete'",
")",
"try",
":",
"self",
".",
"message",
".",
"accept",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"raise",
"MessageSettleFailed",
"(",
"\"complete\"",
",",
"e",
... | d7306fde32f60a293a7567678692bdad31e4b667 |
test | Message.dead_letter | Move the message to the Dead Letter queue.
The Dead Letter queue is a sub-queue that can be
used to store messages that failed to process correctly, or otherwise require further inspection
or processing. The queue can also be configured to send expired messages to the Dead Letter queue.
... | azure-servicebus/azure/servicebus/common/message.py | def dead_letter(self, description=None):
"""Move the message to the Dead Letter queue.
The Dead Letter queue is a sub-queue that can be
used to store messages that failed to process correctly, or otherwise require further inspection
or processing. The queue can also be configured to sen... | def dead_letter(self, description=None):
"""Move the message to the Dead Letter queue.
The Dead Letter queue is a sub-queue that can be
used to store messages that failed to process correctly, or otherwise require further inspection
or processing. The queue can also be configured to sen... | [
"Move",
"the",
"message",
"to",
"the",
"Dead",
"Letter",
"queue",
"."
] | Azure/azure-sdk-for-python | python | https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/message.py#L322-L342 | [
"def",
"dead_letter",
"(",
"self",
",",
"description",
"=",
"None",
")",
":",
"self",
".",
"_is_live",
"(",
"'reject'",
")",
"try",
":",
"self",
".",
"message",
".",
"reject",
"(",
"condition",
"=",
"DEADLETTERNAME",
",",
"description",
"=",
"description",... | d7306fde32f60a293a7567678692bdad31e4b667 |
test | Message.abandon | Abandon the message.
This message will be returned to the queue to be reprocessed.
:raises: ~azure.servicebus.common.errors.MessageAlreadySettled if the message has been settled.
:raises: ~azure.servicebus.common.errors.MessageLockExpired if message lock has already expired.
:raises: ~... | azure-servicebus/azure/servicebus/common/message.py | def abandon(self):
"""Abandon the message.
This message will be returned to the queue to be reprocessed.
:raises: ~azure.servicebus.common.errors.MessageAlreadySettled if the message has been settled.
:raises: ~azure.servicebus.common.errors.MessageLockExpired if message lock has alrea... | def abandon(self):
"""Abandon the message.
This message will be returned to the queue to be reprocessed.
:raises: ~azure.servicebus.common.errors.MessageAlreadySettled if the message has been settled.
:raises: ~azure.servicebus.common.errors.MessageLockExpired if message lock has alrea... | [
"Abandon",
"the",
"message",
"."
] | Azure/azure-sdk-for-python | python | https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/common/message.py#L344-L358 | [
"def",
"abandon",
"(",
"self",
")",
":",
"self",
".",
"_is_live",
"(",
"'abandon'",
")",
"try",
":",
"self",
".",
"message",
".",
"modify",
"(",
"True",
",",
"False",
")",
"except",
"Exception",
"as",
"e",
":",
"raise",
"MessageSettleFailed",
"(",
"\"a... | d7306fde32f60a293a7567678692bdad31e4b667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.