repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
crdoconnor/commandlib | commandlib/command.py | Command.ignore_errors | def ignore_errors(self):
"""
Return new command object that will not raise an exception when
return code > 0.
"""
new_command = copy.deepcopy(self)
new_command._ignore_errors = True
return new_command | python | def ignore_errors(self):
"""
Return new command object that will not raise an exception when
return code > 0.
"""
new_command = copy.deepcopy(self)
new_command._ignore_errors = True
return new_command | [
"def",
"ignore_errors",
"(",
"self",
")",
":",
"new_command",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_command",
".",
"_ignore_errors",
"=",
"True",
"return",
"new_command"
] | Return new command object that will not raise an exception when
return code > 0. | [
"Return",
"new",
"command",
"object",
"that",
"will",
"not",
"raise",
"an",
"exception",
"when",
"return",
"code",
">",
"0",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L87-L94 | train | Return a copy of the current command that will not raise an exception when the return code > 0. |
crdoconnor/commandlib | commandlib/command.py | Command.with_env | def with_env(self, **environment_variables):
"""
Return new Command object that will be run with additional
environment variables.
Specify environment variables as follows:
new_cmd = old_cmd.with_env(PYTHON_PATH=".", ENV_PORT="2022")
"""
new_env_vars = {
... | python | def with_env(self, **environment_variables):
"""
Return new Command object that will be run with additional
environment variables.
Specify environment variables as follows:
new_cmd = old_cmd.with_env(PYTHON_PATH=".", ENV_PORT="2022")
"""
new_env_vars = {
... | [
"def",
"with_env",
"(",
"self",
",",
"*",
"*",
"environment_variables",
")",
":",
"new_env_vars",
"=",
"{",
"str",
"(",
"var",
")",
":",
"str",
"(",
"val",
")",
"for",
"var",
",",
"val",
"in",
"environment_variables",
".",
"items",
"(",
")",
"}",
"ne... | Return new Command object that will be run with additional
environment variables.
Specify environment variables as follows:
new_cmd = old_cmd.with_env(PYTHON_PATH=".", ENV_PORT="2022") | [
"Return",
"new",
"Command",
"object",
"that",
"will",
"be",
"run",
"with",
"additional",
"environment",
"variables",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L115-L129 | train | Returns a new Command object that will be run with additional environment variables. |
crdoconnor/commandlib | commandlib/command.py | Command.without_env | def without_env(self, environment_variable):
"""
Return new Command object that will drop a specified
environment variable if it is set.
new_cmd = old_cmd.without_env("PYTHON_PATH")
"""
new_command = copy.deepcopy(self)
new_command._env_drop.append(str(enviro... | python | def without_env(self, environment_variable):
"""
Return new Command object that will drop a specified
environment variable if it is set.
new_cmd = old_cmd.without_env("PYTHON_PATH")
"""
new_command = copy.deepcopy(self)
new_command._env_drop.append(str(enviro... | [
"def",
"without_env",
"(",
"self",
",",
"environment_variable",
")",
":",
"new_command",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_command",
".",
"_env_drop",
".",
"append",
"(",
"str",
"(",
"environment_variable",
")",
")",
"return",
"new_command"
... | Return new Command object that will drop a specified
environment variable if it is set.
new_cmd = old_cmd.without_env("PYTHON_PATH") | [
"Return",
"new",
"Command",
"object",
"that",
"will",
"drop",
"a",
"specified",
"environment",
"variable",
"if",
"it",
"is",
"set",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L131-L140 | train | Returns a new Command object that will drop a specified environment variable if it is set. |
crdoconnor/commandlib | commandlib/command.py | Command.in_dir | def in_dir(self, directory):
"""
Return new Command object that will be run in specified
directory.
new_cmd = old_cmd.in_dir("/usr")
"""
new_command = copy.deepcopy(self)
new_command._directory = str(directory)
return new_command | python | def in_dir(self, directory):
"""
Return new Command object that will be run in specified
directory.
new_cmd = old_cmd.in_dir("/usr")
"""
new_command = copy.deepcopy(self)
new_command._directory = str(directory)
return new_command | [
"def",
"in_dir",
"(",
"self",
",",
"directory",
")",
":",
"new_command",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_command",
".",
"_directory",
"=",
"str",
"(",
"directory",
")",
"return",
"new_command"
] | Return new Command object that will be run in specified
directory.
new_cmd = old_cmd.in_dir("/usr") | [
"Return",
"new",
"Command",
"object",
"that",
"will",
"be",
"run",
"in",
"specified",
"directory",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L142-L151 | train | Returns a copy of this Command object that will be run in specified directory. |
crdoconnor/commandlib | commandlib/command.py | Command.with_shell | def with_shell(self):
"""
Return new Command object that will be run using shell.
"""
new_command = copy.deepcopy(self)
new_command._shell = True
return new_command | python | def with_shell(self):
"""
Return new Command object that will be run using shell.
"""
new_command = copy.deepcopy(self)
new_command._shell = True
return new_command | [
"def",
"with_shell",
"(",
"self",
")",
":",
"new_command",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_command",
".",
"_shell",
"=",
"True",
"return",
"new_command"
] | Return new Command object that will be run using shell. | [
"Return",
"new",
"Command",
"object",
"that",
"will",
"be",
"run",
"using",
"shell",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L153-L159 | train | Returns a new Command object that will be run using shell. |
crdoconnor/commandlib | commandlib/command.py | Command.with_trailing_args | def with_trailing_args(self, *arguments):
"""
Return new Command object that will be run with specified
trailing arguments.
"""
new_command = copy.deepcopy(self)
new_command._trailing_args = [str(arg) for arg in arguments]
return new_command | python | def with_trailing_args(self, *arguments):
"""
Return new Command object that will be run with specified
trailing arguments.
"""
new_command = copy.deepcopy(self)
new_command._trailing_args = [str(arg) for arg in arguments]
return new_command | [
"def",
"with_trailing_args",
"(",
"self",
",",
"*",
"arguments",
")",
":",
"new_command",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_command",
".",
"_trailing_args",
"=",
"[",
"str",
"(",
"arg",
")",
"for",
"arg",
"in",
"arguments",
"]",
"retur... | Return new Command object that will be run with specified
trailing arguments. | [
"Return",
"new",
"Command",
"object",
"that",
"will",
"be",
"run",
"with",
"specified",
"trailing",
"arguments",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L161-L168 | train | Returns a new Command object that will be run with specified trailing arguments. |
crdoconnor/commandlib | commandlib/command.py | Command.with_path | def with_path(self, path):
"""
Return new Command object that will be run with a new addition
to the PATH environment variable that will be fed to the command.
"""
new_command = copy.deepcopy(self)
new_command._paths.append(str(path))
return new_command | python | def with_path(self, path):
"""
Return new Command object that will be run with a new addition
to the PATH environment variable that will be fed to the command.
"""
new_command = copy.deepcopy(self)
new_command._paths.append(str(path))
return new_command | [
"def",
"with_path",
"(",
"self",
",",
"path",
")",
":",
"new_command",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"new_command",
".",
"_paths",
".",
"append",
"(",
"str",
"(",
"path",
")",
")",
"return",
"new_command"
] | Return new Command object that will be run with a new addition
to the PATH environment variable that will be fed to the command. | [
"Return",
"new",
"Command",
"object",
"that",
"will",
"be",
"run",
"with",
"a",
"new",
"addition",
"to",
"the",
"PATH",
"environment",
"variable",
"that",
"will",
"be",
"fed",
"to",
"the",
"command",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L170-L177 | train | Returns a new Command object that will be run with a new addition
to the PATH environment variable that will be fed to the command. |
crdoconnor/commandlib | commandlib/command.py | Command.pexpect | def pexpect(self):
"""
Run command and return pexpect process object.
NOTE: Requires you to pip install 'pexpect' or will fail.
"""
import pexpect
assert not self._ignore_errors
_check_directory(self.directory)
arguments = self.arguments
retur... | python | def pexpect(self):
"""
Run command and return pexpect process object.
NOTE: Requires you to pip install 'pexpect' or will fail.
"""
import pexpect
assert not self._ignore_errors
_check_directory(self.directory)
arguments = self.arguments
retur... | [
"def",
"pexpect",
"(",
"self",
")",
":",
"import",
"pexpect",
"assert",
"not",
"self",
".",
"_ignore_errors",
"_check_directory",
"(",
"self",
".",
"directory",
")",
"arguments",
"=",
"self",
".",
"arguments",
"return",
"pexpect",
".",
"spawn",
"(",
"argumen... | Run command and return pexpect process object.
NOTE: Requires you to pip install 'pexpect' or will fail. | [
"Run",
"command",
"and",
"return",
"pexpect",
"process",
"object",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L203-L219 | train | Run command and return pexpect process object. |
crdoconnor/commandlib | commandlib/command.py | Command.run | def run(self):
"""Run command and wait until it finishes."""
_check_directory(self.directory)
with DirectoryContextManager(self.directory):
process = subprocess.Popen(self.arguments, shell=self._shell, env=self.env)
_, _ = process.communicate()
returncode = pro... | python | def run(self):
"""Run command and wait until it finishes."""
_check_directory(self.directory)
with DirectoryContextManager(self.directory):
process = subprocess.Popen(self.arguments, shell=self._shell, env=self.env)
_, _ = process.communicate()
returncode = pro... | [
"def",
"run",
"(",
"self",
")",
":",
"_check_directory",
"(",
"self",
".",
"directory",
")",
"with",
"DirectoryContextManager",
"(",
"self",
".",
"directory",
")",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"self",
".",
"arguments",
",",
"shell"... | Run command and wait until it finishes. | [
"Run",
"command",
"and",
"wait",
"until",
"it",
"finishes",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L221-L235 | train | Run command and wait until it finishes. |
aiidateam/aiida-codtools | aiida_codtools/workflows/functions/primitive_structure_from_cif.py | primitive_structure_from_cif | def primitive_structure_from_cif(cif, parse_engine, symprec, site_tolerance):
"""
This calcfunction will take a CifData node, attempt to create a StructureData object from it
using the 'parse_engine' and pass it through SeeKpath to try and get the primitive cell. Finally, it will
store several keys from... | python | def primitive_structure_from_cif(cif, parse_engine, symprec, site_tolerance):
"""
This calcfunction will take a CifData node, attempt to create a StructureData object from it
using the 'parse_engine' and pass it through SeeKpath to try and get the primitive cell. Finally, it will
store several keys from... | [
"def",
"primitive_structure_from_cif",
"(",
"cif",
",",
"parse_engine",
",",
"symprec",
",",
"site_tolerance",
")",
":",
"CifCleanWorkChain",
"=",
"WorkflowFactory",
"(",
"'codtools.cif_clean'",
")",
"# pylint: disable=invalid-name",
"try",
":",
"structure",
"=",
"cif",... | This calcfunction will take a CifData node, attempt to create a StructureData object from it
using the 'parse_engine' and pass it through SeeKpath to try and get the primitive cell. Finally, it will
store several keys from the SeeKpath output parameters dictionary directly on the structure data as attributes,
... | [
"This",
"calcfunction",
"will",
"take",
"a",
"CifData",
"node",
"attempt",
"to",
"create",
"a",
"StructureData",
"object",
"from",
"it",
"using",
"the",
"parse_engine",
"and",
"pass",
"it",
"through",
"SeeKpath",
"to",
"try",
"and",
"get",
"the",
"primitive",
... | da5e4259b7a2e86cf0cc3f997e11dd36d445fa94 | https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/workflows/functions/primitive_structure_from_cif.py#L14-L62 | train | This function will take a CifData object and attempt to create a StructureData object from it using the SeeKpath. |
SHDShim/pytheos | pytheos/eqn_debye.py | debye_E_single | def debye_E_single(x):
"""
calculate Debye energy using old fortran routine
:params x: Debye x value
:return: Debye energy
"""
# make the function handles both scalar and array
if ((x > 0.0) & (x <= 0.1)):
result = 1. - 0.375 * x + x * x * \
(0.05 - (5.952380953e-4) * x ... | python | def debye_E_single(x):
"""
calculate Debye energy using old fortran routine
:params x: Debye x value
:return: Debye energy
"""
# make the function handles both scalar and array
if ((x > 0.0) & (x <= 0.1)):
result = 1. - 0.375 * x + x * x * \
(0.05 - (5.952380953e-4) * x ... | [
"def",
"debye_E_single",
"(",
"x",
")",
":",
"# make the function handles both scalar and array",
"if",
"(",
"(",
"x",
">",
"0.0",
")",
"&",
"(",
"x",
"<=",
"0.1",
")",
")",
":",
"result",
"=",
"1.",
"-",
"0.375",
"*",
"x",
"+",
"x",
"*",
"x",
"*",
... | calculate Debye energy using old fortran routine
:params x: Debye x value
:return: Debye energy | [
"calculate",
"Debye",
"energy",
"using",
"old",
"fortran",
"routine"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_debye.py#L6-L43 | train | calculate Debye energy using old fortran routine |
SHDShim/pytheos | pytheos/eqn_debye.py | debye_E | def debye_E(x):
"""
calculate Debye energy using old fortran routine
:params x: Debye x value
:return: Debye energy
:note: this is a wraper function (vectorization) for debye_E_single
"""
if isuncertainties([x]):
f_u = uct.wrap(debye_E_single)
f_v = np.vectorize(f_u)
els... | python | def debye_E(x):
"""
calculate Debye energy using old fortran routine
:params x: Debye x value
:return: Debye energy
:note: this is a wraper function (vectorization) for debye_E_single
"""
if isuncertainties([x]):
f_u = uct.wrap(debye_E_single)
f_v = np.vectorize(f_u)
els... | [
"def",
"debye_E",
"(",
"x",
")",
":",
"if",
"isuncertainties",
"(",
"[",
"x",
"]",
")",
":",
"f_u",
"=",
"uct",
".",
"wrap",
"(",
"debye_E_single",
")",
"f_v",
"=",
"np",
".",
"vectorize",
"(",
"f_u",
")",
"else",
":",
"f_v",
"=",
"np",
".",
"v... | calculate Debye energy using old fortran routine
:params x: Debye x value
:return: Debye energy
:note: this is a wraper function (vectorization) for debye_E_single | [
"calculate",
"Debye",
"energy",
"using",
"old",
"fortran",
"routine"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_debye.py#L46-L59 | train | calculate Debye energy using old fortran routine |
Capitains/MyCapytain | MyCapytain/common/base.py | Exportable.export_capacities | def export_capacities(self):
""" List Mimetypes that current object can export to
"""
return [export for cls in getmro(type(self)) if hasattr(cls, "EXPORT_TO") for export in cls.EXPORT_TO] | python | def export_capacities(self):
""" List Mimetypes that current object can export to
"""
return [export for cls in getmro(type(self)) if hasattr(cls, "EXPORT_TO") for export in cls.EXPORT_TO] | [
"def",
"export_capacities",
"(",
"self",
")",
":",
"return",
"[",
"export",
"for",
"cls",
"in",
"getmro",
"(",
"type",
"(",
"self",
")",
")",
"if",
"hasattr",
"(",
"cls",
",",
"\"EXPORT_TO\"",
")",
"for",
"export",
"in",
"cls",
".",
"EXPORT_TO",
"]"
] | List Mimetypes that current object can export to | [
"List",
"Mimetypes",
"that",
"current",
"object",
"can",
"export",
"to"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/base.py#L21-L24 | train | List Mimetypes that current object can export to
|
Capitains/MyCapytain | MyCapytain/common/base.py | Exportable.export | def export(self, output=None, **kwargs):
""" Export the collection item in the Mimetype required.
:param output: Mimetype to export to (Uses MyCapytain.common.utils.Mimetypes)
:type output: str
:return: Object using a different representation
"""
if output is None:
... | python | def export(self, output=None, **kwargs):
""" Export the collection item in the Mimetype required.
:param output: Mimetype to export to (Uses MyCapytain.common.utils.Mimetypes)
:type output: str
:return: Object using a different representation
"""
if output is None:
... | [
"def",
"export",
"(",
"self",
",",
"output",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"output",
"is",
"None",
":",
"output",
"=",
"self",
".",
"DEFAULT_EXPORT",
"if",
"output",
"is",
"not",
"None",
"and",
"output",
"in",
"self",
".",
"... | Export the collection item in the Mimetype required.
:param output: Mimetype to export to (Uses MyCapytain.common.utils.Mimetypes)
:type output: str
:return: Object using a different representation | [
"Export",
"the",
"collection",
"item",
"in",
"the",
"Mimetype",
"required",
"."
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/base.py#L35-L50 | train | Exports the object in the Mimetype required. |
exosite-labs/pyonep | pyonep/provision.py | Provision._filter_options | def _filter_options(self, aliases=True, comments=True, historical=True):
"""Converts a set of boolean-valued options into the relevant HTTP values."""
options = []
if not aliases:
options.append('noaliases')
if not comments:
options.append('nocomments')
if... | python | def _filter_options(self, aliases=True, comments=True, historical=True):
"""Converts a set of boolean-valued options into the relevant HTTP values."""
options = []
if not aliases:
options.append('noaliases')
if not comments:
options.append('nocomments')
if... | [
"def",
"_filter_options",
"(",
"self",
",",
"aliases",
"=",
"True",
",",
"comments",
"=",
"True",
",",
"historical",
"=",
"True",
")",
":",
"options",
"=",
"[",
"]",
"if",
"not",
"aliases",
":",
"options",
".",
"append",
"(",
"'noaliases'",
")",
"if",
... | Converts a set of boolean-valued options into the relevant HTTP values. | [
"Converts",
"a",
"set",
"of",
"boolean",
"-",
"valued",
"options",
"into",
"the",
"relevant",
"HTTP",
"values",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L109-L118 | train | Converts a set of boolean - valued options into the relevant HTTP values. |
exosite-labs/pyonep | pyonep/provision.py | Provision._request | def _request(self, path, key, data, method, key_is_cik, extra_headers={}):
"""Generically shared HTTP request method.
Args:
path: The API endpoint to interact with.
key: A string for the key used by the device for the API. Either a CIK or token.
data: A string for t... | python | def _request(self, path, key, data, method, key_is_cik, extra_headers={}):
"""Generically shared HTTP request method.
Args:
path: The API endpoint to interact with.
key: A string for the key used by the device for the API. Either a CIK or token.
data: A string for t... | [
"def",
"_request",
"(",
"self",
",",
"path",
",",
"key",
",",
"data",
",",
"method",
",",
"key_is_cik",
",",
"extra_headers",
"=",
"{",
"}",
")",
":",
"if",
"method",
"==",
"'GET'",
":",
"if",
"len",
"(",
"data",
")",
">",
"0",
":",
"url",
"=",
... | Generically shared HTTP request method.
Args:
path: The API endpoint to interact with.
key: A string for the key used by the device for the API. Either a CIK or token.
data: A string for the pre-encoded data to be sent with this request.
method: A string denotin... | [
"Generically",
"shared",
"HTTP",
"request",
"method",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L120-L162 | train | Generically shared HTTP request method. |
exosite-labs/pyonep | pyonep/provision.py | Provision.content_create | def content_create(self, key, model, contentid, meta, protected=False):
"""Creates a content entity bucket with the given `contentid`.
This method maps to
https://github.com/exosite/docs/tree/master/provision#post---create-content-entity.
Args:
key: The CIK or Token for the... | python | def content_create(self, key, model, contentid, meta, protected=False):
"""Creates a content entity bucket with the given `contentid`.
This method maps to
https://github.com/exosite/docs/tree/master/provision#post---create-content-entity.
Args:
key: The CIK or Token for the... | [
"def",
"content_create",
"(",
"self",
",",
"key",
",",
"model",
",",
"contentid",
",",
"meta",
",",
"protected",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'id'",
":",
"contentid",
",",
"'meta'",
":",
"meta",
"}",
"if",
"protected",
"is",
"not",
"F... | Creates a content entity bucket with the given `contentid`.
This method maps to
https://github.com/exosite/docs/tree/master/provision#post---create-content-entity.
Args:
key: The CIK or Token for the device
model:
contentid: The ID used to name the entity bu... | [
"Creates",
"a",
"content",
"entity",
"bucket",
"with",
"the",
"given",
"contentid",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L172-L191 | train | Creates a content entity bucket with the given contentid. |
exosite-labs/pyonep | pyonep/provision.py | Provision.content_download | def content_download(self, cik, vendor, model, contentid):
"""(Speculation) Fetches content information for a given vendor, model, and ID as chunks.
This method might map to:
https://github.com/exosite/docs/tree/master/provision#get---get-content-blob-1,
but seems to be missing serial n... | python | def content_download(self, cik, vendor, model, contentid):
"""(Speculation) Fetches content information for a given vendor, model, and ID as chunks.
This method might map to:
https://github.com/exosite/docs/tree/master/provision#get---get-content-blob-1,
but seems to be missing serial n... | [
"def",
"content_download",
"(",
"self",
",",
"cik",
",",
"vendor",
",",
"model",
",",
"contentid",
")",
":",
"data",
"=",
"urlencode",
"(",
"{",
"'vendor'",
":",
"vendor",
",",
"'model'",
":",
"model",
",",
"'id'",
":",
"contentid",
"}",
")",
"headers"... | (Speculation) Fetches content information for a given vendor, model, and ID as chunks.
This method might map to:
https://github.com/exosite/docs/tree/master/provision#get---get-content-blob-1,
but seems to be missing serial number.
Args:
cik: The CIK for the device
... | [
"(",
"Speculation",
")",
"Fetches",
"content",
"information",
"for",
"a",
"given",
"vendor",
"model",
"and",
"ID",
"as",
"chunks",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L193-L211 | train | Download the content for a given CIK model and ID. |
exosite-labs/pyonep | pyonep/provision.py | Provision.content_info | def content_info(self, key, model, contentid, vendor=None):
"""(Speculation) Fetches content information for a given vendor, model, and ID.
This method might map to:
https://github.com/exosite/docs/tree/master/provision#get---get-content-info-1,
but seems to be missing serial number.
... | python | def content_info(self, key, model, contentid, vendor=None):
"""(Speculation) Fetches content information for a given vendor, model, and ID.
This method might map to:
https://github.com/exosite/docs/tree/master/provision#get---get-content-info-1,
but seems to be missing serial number.
... | [
"def",
"content_info",
"(",
"self",
",",
"key",
",",
"model",
",",
"contentid",
",",
"vendor",
"=",
"None",
")",
":",
"if",
"not",
"vendor",
":",
"# if no vendor name, key should be the owner one",
"path",
"=",
"PROVISION_MANAGE_CONTENT",
"+",
"model",
"+",
"'/'... | (Speculation) Fetches content information for a given vendor, model, and ID.
This method might map to:
https://github.com/exosite/docs/tree/master/provision#get---get-content-info-1,
but seems to be missing serial number.
Args:
key: The CIK or Token for the device
... | [
"(",
"Speculation",
")",
"Fetches",
"content",
"information",
"for",
"a",
"given",
"vendor",
"model",
"and",
"ID",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L213-L235 | train | Fetch the content information for a given CIK model and ID. |
exosite-labs/pyonep | pyonep/provision.py | Provision.content_list | def content_list(self, key, model):
"""Returns the list of content IDs for a given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#get---list-content-ids
Args:
key: The CIK or Token for the device
model:
"""
path ... | python | def content_list(self, key, model):
"""Returns the list of content IDs for a given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#get---list-content-ids
Args:
key: The CIK or Token for the device
model:
"""
path ... | [
"def",
"content_list",
"(",
"self",
",",
"key",
",",
"model",
")",
":",
"path",
"=",
"PROVISION_MANAGE_CONTENT",
"+",
"model",
"+",
"'/'",
"return",
"self",
".",
"_request",
"(",
"path",
",",
"key",
",",
"''",
",",
"'GET'",
",",
"self",
".",
"_manage_b... | Returns the list of content IDs for a given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#get---list-content-ids
Args:
key: The CIK or Token for the device
model: | [
"Returns",
"the",
"list",
"of",
"content",
"IDs",
"for",
"a",
"given",
"model",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L237-L248 | train | Returns the list of content IDs for a given model. |
exosite-labs/pyonep | pyonep/provision.py | Provision.content_remove | def content_remove(self, key, model, contentid):
"""Deletes the information for the given contentid under the given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#delete---delete-content
Args:
key: The CIK or Token for the device
... | python | def content_remove(self, key, model, contentid):
"""Deletes the information for the given contentid under the given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#delete---delete-content
Args:
key: The CIK or Token for the device
... | [
"def",
"content_remove",
"(",
"self",
",",
"key",
",",
"model",
",",
"contentid",
")",
":",
"path",
"=",
"PROVISION_MANAGE_CONTENT",
"+",
"model",
"+",
"'/'",
"+",
"contentid",
"return",
"self",
".",
"_request",
"(",
"path",
",",
"key",
",",
"''",
",",
... | Deletes the information for the given contentid under the given model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#delete---delete-content
Args:
key: The CIK or Token for the device
model: | [
"Deletes",
"the",
"information",
"for",
"the",
"given",
"contentid",
"under",
"the",
"given",
"model",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L250-L261 | train | Deletes the information for the given contentid under the given model. |
exosite-labs/pyonep | pyonep/provision.py | Provision.content_upload | def content_upload(self, key, model, contentid, data, mimetype):
"""Store the given data as a result of a query for content id given the model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#post---upload-content
Args:
key: The CIK or Token for th... | python | def content_upload(self, key, model, contentid, data, mimetype):
"""Store the given data as a result of a query for content id given the model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#post---upload-content
Args:
key: The CIK or Token for th... | [
"def",
"content_upload",
"(",
"self",
",",
"key",
",",
"model",
",",
"contentid",
",",
"data",
",",
"mimetype",
")",
":",
"headers",
"=",
"{",
"\"Content-Type\"",
":",
"mimetype",
"}",
"path",
"=",
"PROVISION_MANAGE_CONTENT",
"+",
"model",
"+",
"'/'",
"+",... | Store the given data as a result of a query for content id given the model.
This method maps to
https://github.com/exosite/docs/tree/master/provision#post---upload-content
Args:
key: The CIK or Token for the device
model:
contentid: The ID used to name the e... | [
"Store",
"the",
"given",
"data",
"as",
"a",
"result",
"of",
"a",
"query",
"for",
"content",
"id",
"given",
"the",
"model",
"."
] | d27b621b00688a542e0adcc01f3e3354c05238a1 | https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/provision.py#L263-L278 | train | Store the given data as a result of a query for content id given the model. |
SHDShim/pytheos | pytheos/plot/static_fit.py | static_fit_result | def static_fit_result(fit_result, v_residual=None,
v_label='Unit-cell volume $(\mathrm{\AA}^3)$',
figsize=(5, 5), height_ratios=(3, 1), ms_data=8,
p_err=None, v_err=None, pdf_filen=None,
title='Fit result'):
"""
plot static ... | python | def static_fit_result(fit_result, v_residual=None,
v_label='Unit-cell volume $(\mathrm{\AA}^3)$',
figsize=(5, 5), height_ratios=(3, 1), ms_data=8,
p_err=None, v_err=None, pdf_filen=None,
title='Fit result'):
"""
plot static ... | [
"def",
"static_fit_result",
"(",
"fit_result",
",",
"v_residual",
"=",
"None",
",",
"v_label",
"=",
"'Unit-cell volume $(\\mathrm{\\AA}^3)$'",
",",
"figsize",
"=",
"(",
"5",
",",
"5",
")",
",",
"height_ratios",
"=",
"(",
"3",
",",
"1",
")",
",",
"ms_data",
... | plot static compressional curve fitting result
:param fit_result: lmfit result object, see example jnb file for detail
:param v_residual: manual input of fit residual
:param v_label: label for volume axis
:param figsize: figure size
:param fitline: manual input of fit line, array of (v_fitline, p_f... | [
"plot",
"static",
"compressional",
"curve",
"fitting",
"result"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/plot/static_fit.py#L10-L88 | train | plot a static compressional curve fitting result |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | contains_content | def contains_content(browser, content):
"""
Search for an element that contains the whole of the text we're looking
for in it or its subelements, but whose children do NOT contain that
text - otherwise matches <body> or <html> or other similarly useless
things.
"""
for elem in browser.find_e... | python | def contains_content(browser, content):
"""
Search for an element that contains the whole of the text we're looking
for in it or its subelements, but whose children do NOT contain that
text - otherwise matches <body> or <html> or other similarly useless
things.
"""
for elem in browser.find_e... | [
"def",
"contains_content",
"(",
"browser",
",",
"content",
")",
":",
"for",
"elem",
"in",
"browser",
".",
"find_elements_by_xpath",
"(",
"str",
"(",
"'//*[contains(normalize-space(.), {content}) '",
"'and not(./*[contains(normalize-space(.), {content})])]'",
".",
"format",
... | Search for an element that contains the whole of the text we're looking
for in it or its subelements, but whose children do NOT contain that
text - otherwise matches <body> or <html> or other similarly useless
things. | [
"Search",
"for",
"an",
"element",
"that",
"contains",
"the",
"whole",
"of",
"the",
"text",
"we",
"re",
"looking",
"for",
"in",
"it",
"or",
"its",
"subelements",
"but",
"whose",
"children",
"do",
"NOT",
"contain",
"that",
"text",
"-",
"otherwise",
"matches"... | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L41-L59 | train | Return True if the content is contained in the content of the element. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | url_should_be | def url_should_be(self, url):
"""Assert the absolute URL of the browser is as provided."""
if world.browser.current_url != url:
raise AssertionError(
"Browser URL expected to be {!r}, got {!r}.".format(
url, world.browser.current_url)) | python | def url_should_be(self, url):
"""Assert the absolute URL of the browser is as provided."""
if world.browser.current_url != url:
raise AssertionError(
"Browser URL expected to be {!r}, got {!r}.".format(
url, world.browser.current_url)) | [
"def",
"url_should_be",
"(",
"self",
",",
"url",
")",
":",
"if",
"world",
".",
"browser",
".",
"current_url",
"!=",
"url",
":",
"raise",
"AssertionError",
"(",
"\"Browser URL expected to be {!r}, got {!r}.\"",
".",
"format",
"(",
"url",
",",
"world",
".",
"bro... | Assert the absolute URL of the browser is as provided. | [
"Assert",
"the",
"absolute",
"URL",
"of",
"the",
"browser",
"is",
"as",
"provided",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L75-L81 | train | Assert the absolute URL of the browser is as provided. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | url_should_contain | def url_should_contain(self, url):
"""Assert the absolute URL of the browser contains the provided."""
if url not in world.browser.current_url:
raise AssertionError(
"Browser URL expected to contain {!r}, got {!r}.".format(
url, world.browser.current_url)) | python | def url_should_contain(self, url):
"""Assert the absolute URL of the browser contains the provided."""
if url not in world.browser.current_url:
raise AssertionError(
"Browser URL expected to contain {!r}, got {!r}.".format(
url, world.browser.current_url)) | [
"def",
"url_should_contain",
"(",
"self",
",",
"url",
")",
":",
"if",
"url",
"not",
"in",
"world",
".",
"browser",
".",
"current_url",
":",
"raise",
"AssertionError",
"(",
"\"Browser URL expected to contain {!r}, got {!r}.\"",
".",
"format",
"(",
"url",
",",
"wo... | Assert the absolute URL of the browser contains the provided. | [
"Assert",
"the",
"absolute",
"URL",
"of",
"the",
"browser",
"contains",
"the",
"provided",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L86-L92 | train | Assert the absolute URL of the browser contains the provided. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | url_should_not_contain | def url_should_not_contain(self, url):
"""Assert the absolute URL of the browser does not contain the provided."""
if url in world.browser.current_url:
raise AssertionError(
"Browser URL expected not to contain {!r}, got {!r}.".format(
url, world.browser.current_url)) | python | def url_should_not_contain(self, url):
"""Assert the absolute URL of the browser does not contain the provided."""
if url in world.browser.current_url:
raise AssertionError(
"Browser URL expected not to contain {!r}, got {!r}.".format(
url, world.browser.current_url)) | [
"def",
"url_should_not_contain",
"(",
"self",
",",
"url",
")",
":",
"if",
"url",
"in",
"world",
".",
"browser",
".",
"current_url",
":",
"raise",
"AssertionError",
"(",
"\"Browser URL expected not to contain {!r}, got {!r}.\"",
".",
"format",
"(",
"url",
",",
"wor... | Assert the absolute URL of the browser does not contain the provided. | [
"Assert",
"the",
"absolute",
"URL",
"of",
"the",
"browser",
"does",
"not",
"contain",
"the",
"provided",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L97-L103 | train | Assert the absolute URL of the browser does not contain the provided. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | page_title | def page_title(self, title):
"""
Assert the page title matches the given text.
"""
if world.browser.title != title:
raise AssertionError(
"Page title expected to be {!r}, got {!r}.".format(
title, world.browser.title)) | python | def page_title(self, title):
"""
Assert the page title matches the given text.
"""
if world.browser.title != title:
raise AssertionError(
"Page title expected to be {!r}, got {!r}.".format(
title, world.browser.title)) | [
"def",
"page_title",
"(",
"self",
",",
"title",
")",
":",
"if",
"world",
".",
"browser",
".",
"title",
"!=",
"title",
":",
"raise",
"AssertionError",
"(",
"\"Page title expected to be {!r}, got {!r}.\"",
".",
"format",
"(",
"title",
",",
"world",
".",
"browser... | Assert the page title matches the given text. | [
"Assert",
"the",
"page",
"title",
"matches",
"the",
"given",
"text",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L109-L117 | train | Assert the page title matches the given text. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | click | def click(self, name):
"""Click the link with the provided link text."""
try:
elem = world.browser.find_element_by_link_text(name)
except NoSuchElementException:
raise AssertionError(
"Cannot find the link with text '{}'.".format(name))
elem.click() | python | def click(self, name):
"""Click the link with the provided link text."""
try:
elem = world.browser.find_element_by_link_text(name)
except NoSuchElementException:
raise AssertionError(
"Cannot find the link with text '{}'.".format(name))
elem.click() | [
"def",
"click",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"elem",
"=",
"world",
".",
"browser",
".",
"find_element_by_link_text",
"(",
"name",
")",
"except",
"NoSuchElementException",
":",
"raise",
"AssertionError",
"(",
"\"Cannot find the link with text '{}... | Click the link with the provided link text. | [
"Click",
"the",
"link",
"with",
"the",
"provided",
"link",
"text",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L125-L132 | train | Click the link with the provided link text. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | should_see_link | def should_see_link(self, link_url):
"""Assert a link with the provided URL is visible on the page."""
elements = ElementSelector(
world.browser,
str('//a[@href="%s"]' % link_url),
filter_displayed=True,
)
if not elements:
raise AssertionError("Expected link not found.") | python | def should_see_link(self, link_url):
"""Assert a link with the provided URL is visible on the page."""
elements = ElementSelector(
world.browser,
str('//a[@href="%s"]' % link_url),
filter_displayed=True,
)
if not elements:
raise AssertionError("Expected link not found.") | [
"def",
"should_see_link",
"(",
"self",
",",
"link_url",
")",
":",
"elements",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//a[@href=\"%s\"]'",
"%",
"link_url",
")",
",",
"filter_displayed",
"=",
"True",
",",
")",
"if",
"not",
"... | Assert a link with the provided URL is visible on the page. | [
"Assert",
"a",
"link",
"with",
"the",
"provided",
"URL",
"is",
"visible",
"on",
"the",
"page",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L137-L146 | train | Assert a link with the provided URL is visible on the page. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | should_see_link_text | def should_see_link_text(self, link_text, link_url):
"""Assert a link with the provided text points to the provided URL."""
elements = ElementSelector(
world.browser,
str('//a[@href="%s"][./text()="%s"]' % (link_url, link_text)),
filter_displayed=True,
)
if not elements:
... | python | def should_see_link_text(self, link_text, link_url):
"""Assert a link with the provided text points to the provided URL."""
elements = ElementSelector(
world.browser,
str('//a[@href="%s"][./text()="%s"]' % (link_url, link_text)),
filter_displayed=True,
)
if not elements:
... | [
"def",
"should_see_link_text",
"(",
"self",
",",
"link_text",
",",
"link_url",
")",
":",
"elements",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//a[@href=\"%s\"][./text()=\"%s\"]'",
"%",
"(",
"link_url",
",",
"link_text",
")",
")",
... | Assert a link with the provided text points to the provided URL. | [
"Assert",
"a",
"link",
"with",
"the",
"provided",
"text",
"points",
"to",
"the",
"provided",
"URL",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L152-L161 | train | Assert a link with the provided text points to the provided URL. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | should_include_link_text | def should_include_link_text(self, link_text, link_url):
"""
Assert a link containing the provided text points to the provided URL.
"""
elements = ElementSelector(
world.browser,
str('//a[@href="%s"][contains(., %s)]' %
(link_url, string_literal(link_text))),
filter_... | python | def should_include_link_text(self, link_text, link_url):
"""
Assert a link containing the provided text points to the provided URL.
"""
elements = ElementSelector(
world.browser,
str('//a[@href="%s"][contains(., %s)]' %
(link_url, string_literal(link_text))),
filter_... | [
"def",
"should_include_link_text",
"(",
"self",
",",
"link_text",
",",
"link_url",
")",
":",
"elements",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//a[@href=\"%s\"][contains(., %s)]'",
"%",
"(",
"link_url",
",",
"string_literal",
"("... | Assert a link containing the provided text points to the provided URL. | [
"Assert",
"a",
"link",
"containing",
"the",
"provided",
"text",
"points",
"to",
"the",
"provided",
"URL",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L169-L181 | train | Assert a link containing the provided text points to the provided URL. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | element_contains | def element_contains(self, element_id, value):
"""
Assert provided content is contained within an element found by ``id``.
"""
elements = ElementSelector(
world.browser,
str('id("{id}")[contains(., "{value}")]'.format(
id=element_id, value=value)),
filter_displayed=T... | python | def element_contains(self, element_id, value):
"""
Assert provided content is contained within an element found by ``id``.
"""
elements = ElementSelector(
world.browser,
str('id("{id}")[contains(., "{value}")]'.format(
id=element_id, value=value)),
filter_displayed=T... | [
"def",
"element_contains",
"(",
"self",
",",
"element_id",
",",
"value",
")",
":",
"elements",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'id(\"{id}\")[contains(., \"{value}\")]'",
".",
"format",
"(",
"id",
"=",
"element_id",
",",
... | Assert provided content is contained within an element found by ``id``. | [
"Assert",
"provided",
"content",
"is",
"contained",
"within",
"an",
"element",
"found",
"by",
"id",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L190-L202 | train | Assert provided content is contained within an element found by id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | element_not_contains | def element_not_contains(self, element_id, value):
"""
Assert provided content is not contained within an element found by ``id``.
"""
elem = world.browser.find_elements_by_xpath(str(
'id("{id}")[contains(., "{value}")]'.format(
id=element_id, value=value)))
assert not elem, \
... | python | def element_not_contains(self, element_id, value):
"""
Assert provided content is not contained within an element found by ``id``.
"""
elem = world.browser.find_elements_by_xpath(str(
'id("{id}")[contains(., "{value}")]'.format(
id=element_id, value=value)))
assert not elem, \
... | [
"def",
"element_not_contains",
"(",
"self",
",",
"element_id",
",",
"value",
")",
":",
"elem",
"=",
"world",
".",
"browser",
".",
"find_elements_by_xpath",
"(",
"str",
"(",
"'id(\"{id}\")[contains(., \"{value}\")]'",
".",
"format",
"(",
"id",
"=",
"element_id",
... | Assert provided content is not contained within an element found by ``id``. | [
"Assert",
"provided",
"content",
"is",
"not",
"contained",
"within",
"an",
"element",
"found",
"by",
"id",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L208-L216 | train | Assert provided content is not contained within an element found by id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | should_see_id_in_seconds | def should_see_id_in_seconds(self, element_id, timeout):
"""
Assert an element with the given ``id`` is visible within n seconds.
"""
def check_element():
"""Check for the element with the given id."""
assert ElementSelector(
world.browser,
'id("%s")' % element_... | python | def should_see_id_in_seconds(self, element_id, timeout):
"""
Assert an element with the given ``id`` is visible within n seconds.
"""
def check_element():
"""Check for the element with the given id."""
assert ElementSelector(
world.browser,
'id("%s")' % element_... | [
"def",
"should_see_id_in_seconds",
"(",
"self",
",",
"element_id",
",",
"timeout",
")",
":",
"def",
"check_element",
"(",
")",
":",
"\"\"\"Check for the element with the given id.\"\"\"",
"assert",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"'id(\"%s\")'",
... | Assert an element with the given ``id`` is visible within n seconds. | [
"Assert",
"an",
"element",
"with",
"the",
"given",
"id",
"is",
"visible",
"within",
"n",
"seconds",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L220-L234 | train | Assert an element with the given id is visible within n seconds. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | should_see_id | def should_see_id(self, element_id):
"""
Assert an element with the given ``id`` is visible.
"""
elements = ElementSelector(
world.browser,
'id("%s")' % element_id,
filter_displayed=True,
)
if not elements:
raise AssertionError("Expected element with given id.") | python | def should_see_id(self, element_id):
"""
Assert an element with the given ``id`` is visible.
"""
elements = ElementSelector(
world.browser,
'id("%s")' % element_id,
filter_displayed=True,
)
if not elements:
raise AssertionError("Expected element with given id.") | [
"def",
"should_see_id",
"(",
"self",
",",
"element_id",
")",
":",
"elements",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"'id(\"%s\")'",
"%",
"element_id",
",",
"filter_displayed",
"=",
"True",
",",
")",
"if",
"not",
"elements",
":",
"raise",... | Assert an element with the given ``id`` is visible. | [
"Assert",
"an",
"element",
"with",
"the",
"given",
"id",
"is",
"visible",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L239-L250 | train | Assert an element with the given id is visible. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | element_focused | def element_focused(self, id_):
"""
Assert the element is focused.
"""
try:
elem = world.browser.find_element_by_id(id_)
except NoSuchElementException:
raise AssertionError("Element with ID '{}' not found.".format(id_))
focused = world.browser.switch_to.active_element
# El... | python | def element_focused(self, id_):
"""
Assert the element is focused.
"""
try:
elem = world.browser.find_element_by_id(id_)
except NoSuchElementException:
raise AssertionError("Element with ID '{}' not found.".format(id_))
focused = world.browser.switch_to.active_element
# El... | [
"def",
"element_focused",
"(",
"self",
",",
"id_",
")",
":",
"try",
":",
"elem",
"=",
"world",
".",
"browser",
".",
"find_element_by_id",
"(",
"id_",
")",
"except",
"NoSuchElementException",
":",
"raise",
"AssertionError",
"(",
"\"Element with ID '{}' not found.\"... | Assert the element is focused. | [
"Assert",
"the",
"element",
"is",
"focused",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L271-L285 | train | Assert the element is focused. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | should_see_in_seconds | def should_see_in_seconds(self, text, timeout):
"""
Assert provided text is visible within n seconds.
Be aware this text could be anywhere on the screen. Also be aware that
it might cross several HTML nodes. No determination is made between
block and inline nodes. Whitespace can be affected.
""... | python | def should_see_in_seconds(self, text, timeout):
"""
Assert provided text is visible within n seconds.
Be aware this text could be anywhere on the screen. Also be aware that
it might cross several HTML nodes. No determination is made between
block and inline nodes. Whitespace can be affected.
""... | [
"def",
"should_see_in_seconds",
"(",
"self",
",",
"text",
",",
"timeout",
")",
":",
"def",
"check_element",
"(",
")",
":",
"\"\"\"Check for an element with the given content.\"\"\"",
"assert",
"contains_content",
"(",
"world",
".",
"browser",
",",
"text",
")",
",",
... | Assert provided text is visible within n seconds.
Be aware this text could be anywhere on the screen. Also be aware that
it might cross several HTML nodes. No determination is made between
block and inline nodes. Whitespace can be affected. | [
"Assert",
"provided",
"text",
"is",
"visible",
"within",
"n",
"seconds",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L312-L327 | train | Assert provided text is visible within n seconds. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | see_form | def see_form(self, url):
"""
Assert the existence of a HTML form that submits to the given URL.
"""
elements = ElementSelector(
world.browser,
str('//form[@action="%s"]' % url),
filter_displayed=True,
)
if not elements:
raise AssertionError("Expected form not fou... | python | def see_form(self, url):
"""
Assert the existence of a HTML form that submits to the given URL.
"""
elements = ElementSelector(
world.browser,
str('//form[@action="%s"]' % url),
filter_displayed=True,
)
if not elements:
raise AssertionError("Expected form not fou... | [
"def",
"see_form",
"(",
"self",
",",
"url",
")",
":",
"elements",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//form[@action=\"%s\"]'",
"%",
"url",
")",
",",
"filter_displayed",
"=",
"True",
",",
")",
"if",
"not",
"elements",
... | Assert the existence of a HTML form that submits to the given URL. | [
"Assert",
"the",
"existence",
"of",
"a",
"HTML",
"form",
"that",
"submits",
"to",
"the",
"given",
"URL",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L366-L377 | train | Assert that a form that submits to the given URL is present. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | fill_in_textfield | def fill_in_textfield(self, field_name, value):
"""
Fill in the HTML input with given label (recommended), name or id with
the given text.
Supported input types are text, textarea, password, month, time, week,
number, range, email, url, tel and color.
"""
date_field = find_any_field(world.... | python | def fill_in_textfield(self, field_name, value):
"""
Fill in the HTML input with given label (recommended), name or id with
the given text.
Supported input types are text, textarea, password, month, time, week,
number, range, email, url, tel and color.
"""
date_field = find_any_field(world.... | [
"def",
"fill_in_textfield",
"(",
"self",
",",
"field_name",
",",
"value",
")",
":",
"date_field",
"=",
"find_any_field",
"(",
"world",
".",
"browser",
",",
"DATE_FIELDS",
",",
"field_name",
")",
"if",
"date_field",
":",
"field",
"=",
"date_field",
"else",
":... | Fill in the HTML input with given label (recommended), name or id with
the given text.
Supported input types are text, textarea, password, month, time, week,
number, range, email, url, tel and color. | [
"Fill",
"in",
"the",
"HTML",
"input",
"with",
"given",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"with",
"the",
"given",
"text",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L406-L434 | train | Fill in the given text field with given value. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | press_button | def press_button(self, value):
"""
Click the button with the given label.
"""
button = find_button(world.browser, value)
if not button:
raise AssertionError(
"Cannot find a button named '{}'.".format(value))
button.click() | python | def press_button(self, value):
"""
Click the button with the given label.
"""
button = find_button(world.browser, value)
if not button:
raise AssertionError(
"Cannot find a button named '{}'.".format(value))
button.click() | [
"def",
"press_button",
"(",
"self",
",",
"value",
")",
":",
"button",
"=",
"find_button",
"(",
"world",
".",
"browser",
",",
"value",
")",
"if",
"not",
"button",
":",
"raise",
"AssertionError",
"(",
"\"Cannot find a button named '{}'.\"",
".",
"format",
"(",
... | Click the button with the given label. | [
"Click",
"the",
"button",
"with",
"the",
"given",
"label",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L440-L448 | train | Click the button with the given label. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | click_on_label | def click_on_label(self, label):
"""
Click on the given label.
On a correctly set up form this will highlight the appropriate field.
"""
elem = ElementSelector(
world.browser,
str('//label[normalize-space(text())=%s]' % string_literal(label)),
filter_displayed=True,
)
... | python | def click_on_label(self, label):
"""
Click on the given label.
On a correctly set up form this will highlight the appropriate field.
"""
elem = ElementSelector(
world.browser,
str('//label[normalize-space(text())=%s]' % string_literal(label)),
filter_displayed=True,
)
... | [
"def",
"click_on_label",
"(",
"self",
",",
"label",
")",
":",
"elem",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//label[normalize-space(text())=%s]'",
"%",
"string_literal",
"(",
"label",
")",
")",
",",
"filter_displayed",
"=",
"... | Click on the given label.
On a correctly set up form this will highlight the appropriate field. | [
"Click",
"on",
"the",
"given",
"label",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L454-L469 | train | Click on the given label. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | input_has_value | def input_has_value(self, field_name, value):
"""
Assert the form input with label (recommended), name or id has given value.
"""
text_field = find_any_field(world.browser,
DATE_FIELDS + TEXT_FIELDS,
field_name)
if text_field is False:
... | python | def input_has_value(self, field_name, value):
"""
Assert the form input with label (recommended), name or id has given value.
"""
text_field = find_any_field(world.browser,
DATE_FIELDS + TEXT_FIELDS,
field_name)
if text_field is False:
... | [
"def",
"input_has_value",
"(",
"self",
",",
"field_name",
",",
"value",
")",
":",
"text_field",
"=",
"find_any_field",
"(",
"world",
".",
"browser",
",",
"DATE_FIELDS",
"+",
"TEXT_FIELDS",
",",
"field_name",
")",
"if",
"text_field",
"is",
"False",
":",
"rais... | Assert the form input with label (recommended), name or id has given value. | [
"Assert",
"the",
"form",
"input",
"with",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"has",
"given",
"value",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L475-L490 | train | Assert the form input with label name or id has given value. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | submit_the_only_form | def submit_the_only_form(self):
"""
Look for a form on the page and submit it.
Asserts if more than one form exists.
"""
form = ElementSelector(world.browser, str('//form'))
assert form, "Cannot find a form on the page."
form.submit() | python | def submit_the_only_form(self):
"""
Look for a form on the page and submit it.
Asserts if more than one form exists.
"""
form = ElementSelector(world.browser, str('//form'))
assert form, "Cannot find a form on the page."
form.submit() | [
"def",
"submit_the_only_form",
"(",
"self",
")",
":",
"form",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//form'",
")",
")",
"assert",
"form",
",",
"\"Cannot find a form on the page.\"",
"form",
".",
"submit",
"(",
")"
] | Look for a form on the page and submit it.
Asserts if more than one form exists. | [
"Look",
"for",
"a",
"form",
"on",
"the",
"page",
"and",
"submit",
"it",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L495-L503 | train | Submit the only form on the page. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | submit_form_id | def submit_form_id(self, id_):
"""
Submit the form with given id (used to disambiguate between multiple
forms).
"""
form = ElementSelector(
world.browser,
str('id("{id}")'.format(id=id_)),
)
assert form, "Cannot find a form with ID '{}' on the page.".format(id_)
form.subm... | python | def submit_form_id(self, id_):
"""
Submit the form with given id (used to disambiguate between multiple
forms).
"""
form = ElementSelector(
world.browser,
str('id("{id}")'.format(id=id_)),
)
assert form, "Cannot find a form with ID '{}' on the page.".format(id_)
form.subm... | [
"def",
"submit_form_id",
"(",
"self",
",",
"id_",
")",
":",
"form",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'id(\"{id}\")'",
".",
"format",
"(",
"id",
"=",
"id_",
")",
")",
",",
")",
"assert",
"form",
",",
"\"Cannot find... | Submit the form with given id (used to disambiguate between multiple
forms). | [
"Submit",
"the",
"form",
"with",
"given",
"id",
"(",
"used",
"to",
"disambiguate",
"between",
"multiple",
"forms",
")",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L508-L518 | train | Submit the form with given id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | submit_form_action | def submit_form_action(self, url):
"""
Submit the form with the given action URL (i.e. the form that submits to
``/post/my/data``).
"""
form = ElementSelector(
world.browser,
str('//form[@action="%s"]' % url),
)
assert form, \
"Cannot find a form with action '{}' on t... | python | def submit_form_action(self, url):
"""
Submit the form with the given action URL (i.e. the form that submits to
``/post/my/data``).
"""
form = ElementSelector(
world.browser,
str('//form[@action="%s"]' % url),
)
assert form, \
"Cannot find a form with action '{}' on t... | [
"def",
"submit_form_action",
"(",
"self",
",",
"url",
")",
":",
"form",
"=",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//form[@action=\"%s\"]'",
"%",
"url",
")",
",",
")",
"assert",
"form",
",",
"\"Cannot find a form with action '{}' on... | Submit the form with the given action URL (i.e. the form that submits to
``/post/my/data``). | [
"Submit",
"the",
"form",
"with",
"the",
"given",
"action",
"URL",
"(",
"i",
".",
"e",
".",
"the",
"form",
"that",
"submits",
"to",
"/",
"post",
"/",
"my",
"/",
"data",
")",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L522-L533 | train | Submit the form with the given action URL. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | check_checkbox | def check_checkbox(self, value):
"""Check the checkbox with label (recommended), name or id."""
check_box = find_field(world.browser, 'checkbox', value)
assert check_box, "Cannot find checkbox '{}'.".format(value)
if not check_box.is_selected():
check_box.click() | python | def check_checkbox(self, value):
"""Check the checkbox with label (recommended), name or id."""
check_box = find_field(world.browser, 'checkbox', value)
assert check_box, "Cannot find checkbox '{}'.".format(value)
if not check_box.is_selected():
check_box.click() | [
"def",
"check_checkbox",
"(",
"self",
",",
"value",
")",
":",
"check_box",
"=",
"find_field",
"(",
"world",
".",
"browser",
",",
"'checkbox'",
",",
"value",
")",
"assert",
"check_box",
",",
"\"Cannot find checkbox '{}'.\"",
".",
"format",
"(",
"value",
")",
... | Check the checkbox with label (recommended), name or id. | [
"Check",
"the",
"checkbox",
"with",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L542-L547 | train | Check the checkbox with label recommended name or id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | assert_checked_checkbox | def assert_checked_checkbox(self, value):
"""Assert the checkbox with label (recommended), name or id is checked."""
check_box = find_field(world.browser, 'checkbox', value)
assert check_box, "Cannot find checkbox '{}'.".format(value)
assert check_box.is_selected(), "Check box should be selected." | python | def assert_checked_checkbox(self, value):
"""Assert the checkbox with label (recommended), name or id is checked."""
check_box = find_field(world.browser, 'checkbox', value)
assert check_box, "Cannot find checkbox '{}'.".format(value)
assert check_box.is_selected(), "Check box should be selected." | [
"def",
"assert_checked_checkbox",
"(",
"self",
",",
"value",
")",
":",
"check_box",
"=",
"find_field",
"(",
"world",
".",
"browser",
",",
"'checkbox'",
",",
"value",
")",
"assert",
"check_box",
",",
"\"Cannot find checkbox '{}'.\"",
".",
"format",
"(",
"value",
... | Assert the checkbox with label (recommended), name or id is checked. | [
"Assert",
"the",
"checkbox",
"with",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"is",
"checked",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L564-L568 | train | Assert the checkbox with label value is checked. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | select_single_item | def select_single_item(self, option_name, select_name):
"""
Select the named option from select with label (recommended), name or id.
"""
option_box = find_option(world.browser, select_name, option_name)
assert option_box, "Cannot find option '{}'.".format(option_name)
option_box.click() | python | def select_single_item(self, option_name, select_name):
"""
Select the named option from select with label (recommended), name or id.
"""
option_box = find_option(world.browser, select_name, option_name)
assert option_box, "Cannot find option '{}'.".format(option_name)
option_box.click() | [
"def",
"select_single_item",
"(",
"self",
",",
"option_name",
",",
"select_name",
")",
":",
"option_box",
"=",
"find_option",
"(",
"world",
".",
"browser",
",",
"select_name",
",",
"option_name",
")",
"assert",
"option_box",
",",
"\"Cannot find option '{}'.\"",
".... | Select the named option from select with label (recommended), name or id. | [
"Select",
"the",
"named",
"option",
"from",
"select",
"with",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L589-L595 | train | Select a single item from select with label name or id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | select_multi_items | def select_multi_items(self, select_name):
"""
Select multiple options from select with label (recommended), name, or
id. Pass a multiline string of options. e.g.
.. code-block:: gherkin
When I select the following from "Contact Methods":
\"\"\"
Email
Phone
... | python | def select_multi_items(self, select_name):
"""
Select multiple options from select with label (recommended), name, or
id. Pass a multiline string of options. e.g.
.. code-block:: gherkin
When I select the following from "Contact Methods":
\"\"\"
Email
Phone
... | [
"def",
"select_multi_items",
"(",
"self",
",",
"select_name",
")",
":",
"# Ensure only the options selected are actually selected",
"option_names",
"=",
"self",
".",
"multiline",
".",
"split",
"(",
"'\\n'",
")",
"select_box",
"=",
"find_field",
"(",
"world",
".",
"b... | Select multiple options from select with label (recommended), name, or
id. Pass a multiline string of options. e.g.
.. code-block:: gherkin
When I select the following from "Contact Methods":
\"\"\"
Email
Phone
Fax
\"\"\" | [
"Select",
"multiple",
"options",
"from",
"select",
"with",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
".",
"Pass",
"a",
"multiline",
"string",
"of",
"options",
".",
"e",
".",
"g",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L601-L630 | train | Select multiple options from select with label recommended name phone and fax. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | assert_single_selected | def assert_single_selected(self, option_name, select_name):
"""
Assert the given option is selected from the select with label
(recommended), name or id.
If multiple selections are supported other options may be selected.
"""
option = find_option(world.browser, select_name, option_name)
ass... | python | def assert_single_selected(self, option_name, select_name):
"""
Assert the given option is selected from the select with label
(recommended), name or id.
If multiple selections are supported other options may be selected.
"""
option = find_option(world.browser, select_name, option_name)
ass... | [
"def",
"assert_single_selected",
"(",
"self",
",",
"option_name",
",",
"select_name",
")",
":",
"option",
"=",
"find_option",
"(",
"world",
".",
"browser",
",",
"select_name",
",",
"option_name",
")",
"assert",
"option",
".",
"is_selected",
"(",
")",
",",
"\... | Assert the given option is selected from the select with label
(recommended), name or id.
If multiple selections are supported other options may be selected. | [
"Assert",
"the",
"given",
"option",
"is",
"selected",
"from",
"the",
"select",
"with",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L636-L644 | train | Assert the given option is selected from the select with label
name or id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | choose_radio | def choose_radio(self, value):
"""
Click (and choose) the radio button with the given label (recommended),
name or id.
"""
box = find_field(world.browser, 'radio', value)
assert box, "Cannot find a '{}' radio button.".format(value)
box.click() | python | def choose_radio(self, value):
"""
Click (and choose) the radio button with the given label (recommended),
name or id.
"""
box = find_field(world.browser, 'radio', value)
assert box, "Cannot find a '{}' radio button.".format(value)
box.click() | [
"def",
"choose_radio",
"(",
"self",
",",
"value",
")",
":",
"box",
"=",
"find_field",
"(",
"world",
".",
"browser",
",",
"'radio'",
",",
"value",
")",
"assert",
"box",
",",
"\"Cannot find a '{}' radio button.\"",
".",
"format",
"(",
"value",
")",
"box",
".... | Click (and choose) the radio button with the given label (recommended),
name or id. | [
"Click",
"(",
"and",
"choose",
")",
"the",
"radio",
"button",
"with",
"the",
"given",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L693-L700 | train | Clicks the radio button with the given label or id. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | assert_radio_selected | def assert_radio_selected(self, value):
"""
Assert the radio button with the given label (recommended), name or id is
chosen.
"""
radio = find_field(world.browser, 'radio', value)
assert radio, "Cannot find a '{}' radio button.".format(value)
assert radio.is_selected(), "Radio button should ... | python | def assert_radio_selected(self, value):
"""
Assert the radio button with the given label (recommended), name or id is
chosen.
"""
radio = find_field(world.browser, 'radio', value)
assert radio, "Cannot find a '{}' radio button.".format(value)
assert radio.is_selected(), "Radio button should ... | [
"def",
"assert_radio_selected",
"(",
"self",
",",
"value",
")",
":",
"radio",
"=",
"find_field",
"(",
"world",
".",
"browser",
",",
"'radio'",
",",
"value",
")",
"assert",
"radio",
",",
"\"Cannot find a '{}' radio button.\"",
".",
"format",
"(",
"value",
")",
... | Assert the radio button with the given label (recommended), name or id is
chosen. | [
"Assert",
"the",
"radio",
"button",
"with",
"the",
"given",
"label",
"(",
"recommended",
")",
"name",
"or",
"id",
"is",
"chosen",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L706-L713 | train | Assert the radio button with the given label is selected. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | check_alert | def check_alert(self, text):
"""
Assert an alert is showing with the given text.
"""
try:
alert = Alert(world.browser)
if alert.text != text:
raise AssertionError(
"Alert text expected to be {!r}, got {!r}.".format(
text, alert.text))
... | python | def check_alert(self, text):
"""
Assert an alert is showing with the given text.
"""
try:
alert = Alert(world.browser)
if alert.text != text:
raise AssertionError(
"Alert text expected to be {!r}, got {!r}.".format(
text, alert.text))
... | [
"def",
"check_alert",
"(",
"self",
",",
"text",
")",
":",
"try",
":",
"alert",
"=",
"Alert",
"(",
"world",
".",
"browser",
")",
"if",
"alert",
".",
"text",
"!=",
"text",
":",
"raise",
"AssertionError",
"(",
"\"Alert text expected to be {!r}, got {!r}.\"",
".... | Assert an alert is showing with the given text. | [
"Assert",
"an",
"alert",
"is",
"showing",
"with",
"the",
"given",
"text",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L762-L775 | train | Assert an alert is showing with the given text. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | check_no_alert | def check_no_alert(self):
"""
Assert there is no alert.
"""
try:
alert = Alert(world.browser)
raise AssertionError("Should not see an alert. Alert '%s' shown." %
alert.text)
except NoAlertPresentException:
pass | python | def check_no_alert(self):
"""
Assert there is no alert.
"""
try:
alert = Alert(world.browser)
raise AssertionError("Should not see an alert. Alert '%s' shown." %
alert.text)
except NoAlertPresentException:
pass | [
"def",
"check_no_alert",
"(",
"self",
")",
":",
"try",
":",
"alert",
"=",
"Alert",
"(",
"world",
".",
"browser",
")",
"raise",
"AssertionError",
"(",
"\"Should not see an alert. Alert '%s' shown.\"",
"%",
"alert",
".",
"text",
")",
"except",
"NoAlertPresentExcepti... | Assert there is no alert. | [
"Assert",
"there",
"is",
"no",
"alert",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L779-L789 | train | Assert there is no alert. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | find_by_tooltip | def find_by_tooltip(browser, tooltip):
"""
Find elements with the given tooltip.
:param browser: ``world.browser``
:param tooltip: Tooltip to search for
Returns: an :class:`ElementSelector`
"""
return ElementSelector(
world.browser,
str('//*[@title=%(tooltip)s or @data-ori... | python | def find_by_tooltip(browser, tooltip):
"""
Find elements with the given tooltip.
:param browser: ``world.browser``
:param tooltip: Tooltip to search for
Returns: an :class:`ElementSelector`
"""
return ElementSelector(
world.browser,
str('//*[@title=%(tooltip)s or @data-ori... | [
"def",
"find_by_tooltip",
"(",
"browser",
",",
"tooltip",
")",
":",
"return",
"ElementSelector",
"(",
"world",
".",
"browser",
",",
"str",
"(",
"'//*[@title=%(tooltip)s or @data-original-title=%(tooltip)s]'",
"%",
"dict",
"(",
"tooltip",
"=",
"string_literal",
"(",
... | Find elements with the given tooltip.
:param browser: ``world.browser``
:param tooltip: Tooltip to search for
Returns: an :class:`ElementSelector` | [
"Find",
"elements",
"with",
"the",
"given",
"tooltip",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L794-L809 | train | Find elements with the given tooltip. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | press_by_tooltip | def press_by_tooltip(self, tooltip):
"""
Click on a HTML element with a given tooltip.
This is very useful if you're clicking on icon buttons, etc.
"""
for button in find_by_tooltip(world.browser, tooltip):
try:
button.click()
break
except: # pylint:disable=... | python | def press_by_tooltip(self, tooltip):
"""
Click on a HTML element with a given tooltip.
This is very useful if you're clicking on icon buttons, etc.
"""
for button in find_by_tooltip(world.browser, tooltip):
try:
button.click()
break
except: # pylint:disable=... | [
"def",
"press_by_tooltip",
"(",
"self",
",",
"tooltip",
")",
":",
"for",
"button",
"in",
"find_by_tooltip",
"(",
"world",
".",
"browser",
",",
"tooltip",
")",
":",
"try",
":",
"button",
".",
"click",
"(",
")",
"break",
"except",
":",
"# pylint:disable=bare... | Click on a HTML element with a given tooltip.
This is very useful if you're clicking on icon buttons, etc. | [
"Click",
"on",
"a",
"HTML",
"element",
"with",
"a",
"given",
"tooltip",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L840-L854 | train | Click on a HTML element with a given tooltip. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | switch_to_frame_with_id | def switch_to_frame_with_id(self, frame):
"""Swap Selenium's context to the given frame or iframe."""
elem = world.browser.find_element_by_id(frame)
world.browser.switch_to.frame(elem) | python | def switch_to_frame_with_id(self, frame):
"""Swap Selenium's context to the given frame or iframe."""
elem = world.browser.find_element_by_id(frame)
world.browser.switch_to.frame(elem) | [
"def",
"switch_to_frame_with_id",
"(",
"self",
",",
"frame",
")",
":",
"elem",
"=",
"world",
".",
"browser",
".",
"find_element_by_id",
"(",
"frame",
")",
"world",
".",
"browser",
".",
"switch_to",
".",
"frame",
"(",
"elem",
")"
] | Swap Selenium's context to the given frame or iframe. | [
"Swap",
"Selenium",
"s",
"context",
"to",
"the",
"given",
"frame",
"or",
"iframe",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L860-L863 | train | Swap Selenium s context to the given frame or iframe. |
aloetesting/aloe_webdriver | aloe_webdriver/__init__.py | switch_to_frame_with_class | def switch_to_frame_with_class(self, frame):
"""Swap Selenium's context to the given frame or iframe."""
elem = world.browser.find_element_by_class_name(frame)
world.browser.switch_to.frame(elem) | python | def switch_to_frame_with_class(self, frame):
"""Swap Selenium's context to the given frame or iframe."""
elem = world.browser.find_element_by_class_name(frame)
world.browser.switch_to.frame(elem) | [
"def",
"switch_to_frame_with_class",
"(",
"self",
",",
"frame",
")",
":",
"elem",
"=",
"world",
".",
"browser",
".",
"find_element_by_class_name",
"(",
"frame",
")",
"world",
".",
"browser",
".",
"switch_to",
".",
"frame",
"(",
"elem",
")"
] | Swap Selenium's context to the given frame or iframe. | [
"Swap",
"Selenium",
"s",
"context",
"to",
"the",
"given",
"frame",
"or",
"iframe",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/__init__.py#L867-L870 | train | Swap Selenium s context to the given frame. |
dingusdk/PythonIhcSdk | ihcsdk/ihccurlconnection.py | IHCCurlConnection.soap_action | def soap_action(self, service, action, payloadbody):
"""Do a soap request """
payload = self.soapenvelope.format(body=payloadbody).encode('utf-8')
headers = ['SOAPAction: ' + action,
'Content-Type: application/soap+xml; charset=UTF-8',
'Content-Length: ' + s... | python | def soap_action(self, service, action, payloadbody):
"""Do a soap request """
payload = self.soapenvelope.format(body=payloadbody).encode('utf-8')
headers = ['SOAPAction: ' + action,
'Content-Type: application/soap+xml; charset=UTF-8',
'Content-Length: ' + s... | [
"def",
"soap_action",
"(",
"self",
",",
"service",
",",
"action",
",",
"payloadbody",
")",
":",
"payload",
"=",
"self",
".",
"soapenvelope",
".",
"format",
"(",
"body",
"=",
"payloadbody",
")",
".",
"encode",
"(",
"'utf-8'",
")",
"headers",
"=",
"[",
"... | Do a soap request | [
"Do",
"a",
"soap",
"request"
] | 7e2067e009fe7600b49f30bff1cf91dc72fc891e | https://github.com/dingusdk/PythonIhcSdk/blob/7e2067e009fe7600b49f30bff1cf91dc72fc891e/ihcsdk/ihccurlconnection.py#L21-L58 | train | Do a soap request |
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.print_equations | def print_equations(self):
"""
show equations used for the EOS
"""
print("P_static: ", self.eqn_st)
print("P_thermal: ", self.eqn_th)
print("P_anharmonic: ", self.eqn_anh)
print("P_electronic: ", self.eqn_el) | python | def print_equations(self):
"""
show equations used for the EOS
"""
print("P_static: ", self.eqn_st)
print("P_thermal: ", self.eqn_th)
print("P_anharmonic: ", self.eqn_anh)
print("P_electronic: ", self.eqn_el) | [
"def",
"print_equations",
"(",
"self",
")",
":",
"print",
"(",
"\"P_static: \"",
",",
"self",
".",
"eqn_st",
")",
"print",
"(",
"\"P_thermal: \"",
",",
"self",
".",
"eqn_th",
")",
"print",
"(",
"\"P_anharmonic: \"",
",",
"self",
".",
"eqn_anh",
")",
"print... | show equations used for the EOS | [
"show",
"equations",
"used",
"for",
"the",
"EOS"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L84-L91 | train | show equations used for the EOS |
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.print_parameters | def print_parameters(self):
"""
show thermoelastic parameters for the EOS
"""
print("Static: ", self.params_st)
print("Thermal: ", self.params_th)
print("Anharmonic: ", self.params_anh)
print("Electronic: ", self.params_el) | python | def print_parameters(self):
"""
show thermoelastic parameters for the EOS
"""
print("Static: ", self.params_st)
print("Thermal: ", self.params_th)
print("Anharmonic: ", self.params_anh)
print("Electronic: ", self.params_el) | [
"def",
"print_parameters",
"(",
"self",
")",
":",
"print",
"(",
"\"Static: \"",
",",
"self",
".",
"params_st",
")",
"print",
"(",
"\"Thermal: \"",
",",
"self",
".",
"params_th",
")",
"print",
"(",
"\"Anharmonic: \"",
",",
"self",
".",
"params_anh",
")",
"p... | show thermoelastic parameters for the EOS | [
"show",
"thermoelastic",
"parameters",
"for",
"the",
"EOS"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L93-L100 | train | show thermoelastic parameters for the EOS |
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS._set_params | def _set_params(self, p):
"""
change parameters in OrderedDict to list with or without uncertainties
:param p: parameters in OrderedDict
:return: parameters in list
:note: internal function
"""
if self.force_norm:
params = [value.n for key, value in p... | python | def _set_params(self, p):
"""
change parameters in OrderedDict to list with or without uncertainties
:param p: parameters in OrderedDict
:return: parameters in list
:note: internal function
"""
if self.force_norm:
params = [value.n for key, value in p... | [
"def",
"_set_params",
"(",
"self",
",",
"p",
")",
":",
"if",
"self",
".",
"force_norm",
":",
"params",
"=",
"[",
"value",
".",
"n",
"for",
"key",
",",
"value",
"in",
"p",
".",
"items",
"(",
")",
"]",
"else",
":",
"params",
"=",
"[",
"value",
"f... | change parameters in OrderedDict to list with or without uncertainties
:param p: parameters in OrderedDict
:return: parameters in list
:note: internal function | [
"change",
"parameters",
"in",
"OrderedDict",
"to",
"list",
"with",
"or",
"without",
"uncertainties"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L102-L114 | train | change parameters in OrderedDict to list with or without uncertainties
|
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.cal_pst | def cal_pst(self, v):
"""
calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa
"""
params = self._set_params(self.params_st)
return func_st[self.eqn_st](v, *params) | python | def cal_pst(self, v):
"""
calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa
"""
params = self._set_params(self.params_st)
return func_st[self.eqn_st](v, *params) | [
"def",
"cal_pst",
"(",
"self",
",",
"v",
")",
":",
"params",
"=",
"self",
".",
"_set_params",
"(",
"self",
".",
"params_st",
")",
"return",
"func_st",
"[",
"self",
".",
"eqn_st",
"]",
"(",
"v",
",",
"*",
"params",
")"
] | calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa | [
"calculate",
"static",
"pressure",
"at",
"300",
"K",
"."
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L116-L124 | train | calculate static pressure at 300 K. |
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.cal_pth | def cal_pth(self, v, temp):
"""
calculate thermal pressure
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: thermal pressure in GPa
"""
if (self.eqn_th is None) or (self.params_th is None):
return np.zeros_like(v)
param... | python | def cal_pth(self, v, temp):
"""
calculate thermal pressure
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: thermal pressure in GPa
"""
if (self.eqn_th is None) or (self.params_th is None):
return np.zeros_like(v)
param... | [
"def",
"cal_pth",
"(",
"self",
",",
"v",
",",
"temp",
")",
":",
"if",
"(",
"self",
".",
"eqn_th",
"is",
"None",
")",
"or",
"(",
"self",
".",
"params_th",
"is",
"None",
")",
":",
"return",
"np",
".",
"zeros_like",
"(",
"v",
")",
"params",
"=",
"... | calculate thermal pressure
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: thermal pressure in GPa | [
"calculate",
"thermal",
"pressure"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L126-L139 | train | calculate thermal pressure in A^3
|
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.cal_pel | def cal_pel(self, v, temp):
"""
calculate pressure from electronic contributions
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
"""
if (self.eqn_el is None) or (self.params_el is None):
return np.zeros_like(v)... | python | def cal_pel(self, v, temp):
"""
calculate pressure from electronic contributions
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
"""
if (self.eqn_el is None) or (self.params_el is None):
return np.zeros_like(v)... | [
"def",
"cal_pel",
"(",
"self",
",",
"v",
",",
"temp",
")",
":",
"if",
"(",
"self",
".",
"eqn_el",
"is",
"None",
")",
"or",
"(",
"self",
".",
"params_el",
"is",
"None",
")",
":",
"return",
"np",
".",
"zeros_like",
"(",
"v",
")",
"params",
"=",
"... | calculate pressure from electronic contributions
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa | [
"calculate",
"pressure",
"from",
"electronic",
"contributions"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L141-L154 | train | calculate pressure from electronic contributions
|
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.cal_panh | def cal_panh(self, v, temp):
"""
calculate pressure from anharmonic contributions
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
"""
if (self.eqn_anh is None) or (self.params_anh is None):
return np.zeros_like... | python | def cal_panh(self, v, temp):
"""
calculate pressure from anharmonic contributions
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
"""
if (self.eqn_anh is None) or (self.params_anh is None):
return np.zeros_like... | [
"def",
"cal_panh",
"(",
"self",
",",
"v",
",",
"temp",
")",
":",
"if",
"(",
"self",
".",
"eqn_anh",
"is",
"None",
")",
"or",
"(",
"self",
".",
"params_anh",
"is",
"None",
")",
":",
"return",
"np",
".",
"zeros_like",
"(",
"v",
")",
"params",
"=",
... | calculate pressure from anharmonic contributions
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa | [
"calculate",
"pressure",
"from",
"anharmonic",
"contributions"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L156-L169 | train | calculate pressure from anharmonic contributions
|
SHDShim/pytheos | pytheos/scales/objs.py | MGEOS.cal_p | def cal_p(self, v, temp):
"""
calculate total pressure at given volume and temperature
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
:note: 2017/05/10 temp must be numpy array. If not, such as list,
create an error.... | python | def cal_p(self, v, temp):
"""
calculate total pressure at given volume and temperature
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
:note: 2017/05/10 temp must be numpy array. If not, such as list,
create an error.... | [
"def",
"cal_p",
"(",
"self",
",",
"v",
",",
"temp",
")",
":",
"if",
"not",
"isinstance",
"(",
"temp",
",",
"np",
".",
"ndarray",
")",
":",
"temp",
"=",
"np",
".",
"asarray",
"(",
"temp",
")",
"if",
"not",
"isinstance",
"(",
"v",
",",
"np",
".",... | calculate total pressure at given volume and temperature
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
:note: 2017/05/10 temp must be numpy array. If not, such as list,
create an error. | [
"calculate",
"total",
"pressure",
"at",
"given",
"volume",
"and",
"temperature"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L171-L186 | train | calculate total pressure at given volume and temperature |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS.print_parameters | def print_parameters(self):
"""
show thermoelastic parameters for the EOS
"""
print("Static: ", self.params_hugoniot)
print("Thermal: ", self.params_therm)
print("Anharmonic: None")
print("Electronic: None") | python | def print_parameters(self):
"""
show thermoelastic parameters for the EOS
"""
print("Static: ", self.params_hugoniot)
print("Thermal: ", self.params_therm)
print("Anharmonic: None")
print("Electronic: None") | [
"def",
"print_parameters",
"(",
"self",
")",
":",
"print",
"(",
"\"Static: \"",
",",
"self",
".",
"params_hugoniot",
")",
"print",
"(",
"\"Thermal: \"",
",",
"self",
".",
"params_therm",
")",
"print",
"(",
"\"Anharmonic: None\"",
")",
"print",
"(",
"\"Electron... | show thermoelastic parameters for the EOS | [
"show",
"thermoelastic",
"parameters",
"for",
"the",
"EOS"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L290-L297 | train | Print the thermoelastic parameters for the current locale. |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS._get_rho | def _get_rho(self, v):
"""
convert unit-cell volume in A^3 to density in g/cm^3
:param v: unit cell volume in A^3
:return: density in g/cm^3
:note: internal function
"""
v_mol = vol_uc2mol(v, self.z) # in m^3
rho = self.mass / v_mol * 1.e-6 # in g/cm^3... | python | def _get_rho(self, v):
"""
convert unit-cell volume in A^3 to density in g/cm^3
:param v: unit cell volume in A^3
:return: density in g/cm^3
:note: internal function
"""
v_mol = vol_uc2mol(v, self.z) # in m^3
rho = self.mass / v_mol * 1.e-6 # in g/cm^3... | [
"def",
"_get_rho",
"(",
"self",
",",
"v",
")",
":",
"v_mol",
"=",
"vol_uc2mol",
"(",
"v",
",",
"self",
".",
"z",
")",
"# in m^3",
"rho",
"=",
"self",
".",
"mass",
"/",
"v_mol",
"*",
"1.e-6",
"# in g/cm^3",
"return",
"rho"
] | convert unit-cell volume in A^3 to density in g/cm^3
:param v: unit cell volume in A^3
:return: density in g/cm^3
:note: internal function | [
"convert",
"unit",
"-",
"cell",
"volume",
"in",
"A^3",
"to",
"density",
"in",
"g",
"/",
"cm^3"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L299-L310 | train | convert unit - cell volume in A^3 to density in g / cm^3
|
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS._get_v | def _get_v(self, rho):
"""
convert density in g/cm^3 to unit-cell volume
:param rho: density in g/cm^3
:return: unit-cell volume in A^3
:note: internal function
"""
v_mol = self.mass / rho # in cm^3
v = vol_mol2uc(v_mol * 1.e-6, self.z)
print(v)... | python | def _get_v(self, rho):
"""
convert density in g/cm^3 to unit-cell volume
:param rho: density in g/cm^3
:return: unit-cell volume in A^3
:note: internal function
"""
v_mol = self.mass / rho # in cm^3
v = vol_mol2uc(v_mol * 1.e-6, self.z)
print(v)... | [
"def",
"_get_v",
"(",
"self",
",",
"rho",
")",
":",
"v_mol",
"=",
"self",
".",
"mass",
"/",
"rho",
"# in cm^3",
"v",
"=",
"vol_mol2uc",
"(",
"v_mol",
"*",
"1.e-6",
",",
"self",
".",
"z",
")",
"print",
"(",
"v",
")",
"return",
"v"
] | convert density in g/cm^3 to unit-cell volume
:param rho: density in g/cm^3
:return: unit-cell volume in A^3
:note: internal function | [
"convert",
"density",
"in",
"g",
"/",
"cm^3",
"to",
"unit",
"-",
"cell",
"volume"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L312-L324 | train | convert density in g / cm^3 to unit - cell volume in A^3
|
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS.cal_pst | def cal_pst(self, v):
"""
calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa
"""
p_h = self._hugoniot_p(v)
p_th_h = self._hugoniot_pth(v)
p_st = p_h - p_th_h
return p_st | python | def cal_pst(self, v):
"""
calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa
"""
p_h = self._hugoniot_p(v)
p_th_h = self._hugoniot_pth(v)
p_st = p_h - p_th_h
return p_st | [
"def",
"cal_pst",
"(",
"self",
",",
"v",
")",
":",
"p_h",
"=",
"self",
".",
"_hugoniot_p",
"(",
"v",
")",
"p_th_h",
"=",
"self",
".",
"_hugoniot_pth",
"(",
"v",
")",
"p_st",
"=",
"p_h",
"-",
"p_th_h",
"return",
"p_st"
] | calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa | [
"calculate",
"static",
"pressure",
"at",
"300",
"K",
"."
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L326-L336 | train | calculate static pressure at 300 K. |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS._hugoniot_p | def _hugoniot_p(self, v):
"""
calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa
"""
rho = self._get_rho(v)
params = self._set_params(self.params_hugoniot)
if self.nonlinear:
... | python | def _hugoniot_p(self, v):
"""
calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa
"""
rho = self._get_rho(v)
params = self._set_params(self.params_hugoniot)
if self.nonlinear:
... | [
"def",
"_hugoniot_p",
"(",
"self",
",",
"v",
")",
":",
"rho",
"=",
"self",
".",
"_get_rho",
"(",
"v",
")",
"params",
"=",
"self",
".",
"_set_params",
"(",
"self",
".",
"params_hugoniot",
")",
"if",
"self",
".",
"nonlinear",
":",
"return",
"hugoniot_p_n... | calculate static pressure at 300 K.
:param v: unit-cell volume in A^3
:return: static pressure at t_ref (=300 K) in GPa | [
"calculate",
"static",
"pressure",
"at",
"300",
"K",
"."
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L338-L350 | train | calculate static pressure at 300 K. |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS._hugoniot_t | def _hugoniot_t(self, v):
"""
calculate Hugoniot temperature
:param v: unit-cell volume in A^3
:return: temperature in K
:note: 2017/05/10, It is intentional that I call hugoniot_t
instead of hugoniot_t_nlin for the nonlinear case.
The reason is the hugoniot_t_nl... | python | def _hugoniot_t(self, v):
"""
calculate Hugoniot temperature
:param v: unit-cell volume in A^3
:return: temperature in K
:note: 2017/05/10, It is intentional that I call hugoniot_t
instead of hugoniot_t_nlin for the nonlinear case.
The reason is the hugoniot_t_nl... | [
"def",
"_hugoniot_t",
"(",
"self",
",",
"v",
")",
":",
"rho",
"=",
"self",
".",
"_get_rho",
"(",
"v",
")",
"params_h",
"=",
"self",
".",
"_set_params",
"(",
"self",
".",
"params_hugoniot",
")",
"params_t",
"=",
"self",
".",
"_set_params",
"(",
"self",
... | calculate Hugoniot temperature
:param v: unit-cell volume in A^3
:return: temperature in K
:note: 2017/05/10, It is intentional that I call hugoniot_t
instead of hugoniot_t_nlin for the nonlinear case.
The reason is the hugoniot_t_nlin (and its equivalent part in mdaap)
... | [
"calculate",
"Hugoniot",
"temperature"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L352-L375 | train | calculate Hugoniot temperature in A^3 |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS.cal_pth | def cal_pth(self, v, temp):
"""
calculate thermal pressure
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: thermal pressure in GPa
"""
params_t = self._set_params(self.params_therm)
return constq_pth(v, temp, *params_t, self.n, se... | python | def cal_pth(self, v, temp):
"""
calculate thermal pressure
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: thermal pressure in GPa
"""
params_t = self._set_params(self.params_therm)
return constq_pth(v, temp, *params_t, self.n, se... | [
"def",
"cal_pth",
"(",
"self",
",",
"v",
",",
"temp",
")",
":",
"params_t",
"=",
"self",
".",
"_set_params",
"(",
"self",
".",
"params_therm",
")",
"return",
"constq_pth",
"(",
"v",
",",
"temp",
",",
"*",
"params_t",
",",
"self",
".",
"n",
",",
"se... | calculate thermal pressure
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: thermal pressure in GPa | [
"calculate",
"thermal",
"pressure"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L377-L387 | train | calculate thermal pressure in A^3
|
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS._hugoniot_pth | def _hugoniot_pth(self, v):
"""
calculate thermal pressure along hugoniot
:param v: unit-cell volume in A^3
:return: thermal pressure along hugoniot in GPa
"""
temp = self._hugoniot_t(v)
return self.cal_pth(v, temp) | python | def _hugoniot_pth(self, v):
"""
calculate thermal pressure along hugoniot
:param v: unit-cell volume in A^3
:return: thermal pressure along hugoniot in GPa
"""
temp = self._hugoniot_t(v)
return self.cal_pth(v, temp) | [
"def",
"_hugoniot_pth",
"(",
"self",
",",
"v",
")",
":",
"temp",
"=",
"self",
".",
"_hugoniot_t",
"(",
"v",
")",
"return",
"self",
".",
"cal_pth",
"(",
"v",
",",
"temp",
")"
] | calculate thermal pressure along hugoniot
:param v: unit-cell volume in A^3
:return: thermal pressure along hugoniot in GPa | [
"calculate",
"thermal",
"pressure",
"along",
"hugoniot"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L389-L397 | train | calculate thermal pressure along hugoniot in A^3 |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS.cal_p | def cal_p(self, v, temp):
"""
calculate total pressure at given volume and temperature
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
"""
return self.cal_pst(v) + self.cal_pth(v, temp) | python | def cal_p(self, v, temp):
"""
calculate total pressure at given volume and temperature
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa
"""
return self.cal_pst(v) + self.cal_pth(v, temp) | [
"def",
"cal_p",
"(",
"self",
",",
"v",
",",
"temp",
")",
":",
"return",
"self",
".",
"cal_pst",
"(",
"v",
")",
"+",
"self",
".",
"cal_pth",
"(",
"v",
",",
"temp",
")"
] | calculate total pressure at given volume and temperature
:param v: unit-cell volume in A^3
:param temp: temperature in K
:return: pressure in GPa | [
"calculate",
"total",
"pressure",
"at",
"given",
"volume",
"and",
"temperature"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L399-L407 | train | calculate total pressure at given volume and temperature |
SHDShim/pytheos | pytheos/scales/objs.py | JHEOS.cal_v | def cal_v(self, p, temp, min_strain=0.3, max_strain=1.0):
"""
calculate unit-cell volume at given pressure and temperature
:param p: pressure in GPa
:param temp: temperature in K
:param min_strain: minimum strain searched for volume root
:param max_strain: maximum strain... | python | def cal_v(self, p, temp, min_strain=0.3, max_strain=1.0):
"""
calculate unit-cell volume at given pressure and temperature
:param p: pressure in GPa
:param temp: temperature in K
:param min_strain: minimum strain searched for volume root
:param max_strain: maximum strain... | [
"def",
"cal_v",
"(",
"self",
",",
"p",
",",
"temp",
",",
"min_strain",
"=",
"0.3",
",",
"max_strain",
"=",
"1.0",
")",
":",
"v0",
"=",
"self",
".",
"params_therm",
"[",
"'v0'",
"]",
".",
"nominal_value",
"self",
".",
"force_norm",
"=",
"True",
"pp",
... | calculate unit-cell volume at given pressure and temperature
:param p: pressure in GPa
:param temp: temperature in K
:param min_strain: minimum strain searched for volume root
:param max_strain: maximum strain searched for volume root
:return: unit-cell volume in A^3
:no... | [
"calculate",
"unit",
"-",
"cell",
"volume",
"at",
"given",
"pressure",
"and",
"temperature"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/scales/objs.py#L409-L439 | train | calculate unit - cell volume at given pressure and temperature |
ChrisBeaumont/smother | smother/interval.py | parse_intervals | def parse_intervals(path, as_context=False):
"""
Parse path strings into a collection of Intervals.
`path` is a string describing a region in a file. It's format is
dotted.module.name:[line | start-stop | context]
`dotted.module.name` is a python module
`line` is a single line number in t... | python | def parse_intervals(path, as_context=False):
"""
Parse path strings into a collection of Intervals.
`path` is a string describing a region in a file. It's format is
dotted.module.name:[line | start-stop | context]
`dotted.module.name` is a python module
`line` is a single line number in t... | [
"def",
"parse_intervals",
"(",
"path",
",",
"as_context",
"=",
"False",
")",
":",
"def",
"_regions_from_range",
"(",
")",
":",
"if",
"as_context",
":",
"ctxs",
"=",
"list",
"(",
"set",
"(",
"pf",
".",
"lines",
"[",
"start",
"-",
"1",
":",
"stop",
"-"... | Parse path strings into a collection of Intervals.
`path` is a string describing a region in a file. It's format is
dotted.module.name:[line | start-stop | context]
`dotted.module.name` is a python module
`line` is a single line number in the module (1-offset)
`start-stop` is a right-open int... | [
"Parse",
"path",
"strings",
"into",
"a",
"collection",
"of",
"Intervals",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/interval.py#L55-L127 | train | Parses a path string into a collection of Intervals. |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_suffix | def p_suffix(self, length=None, elipsis=False):
"Return the rest of the input"
if length is not None:
result = self.input[self.pos:self.pos + length]
if elipsis and len(result) == length:
result += "..."
return result
return self.input[self.pos... | python | def p_suffix(self, length=None, elipsis=False):
"Return the rest of the input"
if length is not None:
result = self.input[self.pos:self.pos + length]
if elipsis and len(result) == length:
result += "..."
return result
return self.input[self.pos... | [
"def",
"p_suffix",
"(",
"self",
",",
"length",
"=",
"None",
",",
"elipsis",
"=",
"False",
")",
":",
"if",
"length",
"is",
"not",
"None",
":",
"result",
"=",
"self",
".",
"input",
"[",
"self",
".",
"pos",
":",
"self",
".",
"pos",
"+",
"length",
"]... | Return the rest of the input | [
"Return",
"the",
"rest",
"of",
"the",
"input"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L65-L72 | train | Return the rest of the input |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_debug | def p_debug(self, message):
"Format and print debug messages"
print("{}{} `{}`".format(self._debug_indent * " ",
message, repr(self.p_suffix(10)))) | python | def p_debug(self, message):
"Format and print debug messages"
print("{}{} `{}`".format(self._debug_indent * " ",
message, repr(self.p_suffix(10)))) | [
"def",
"p_debug",
"(",
"self",
",",
"message",
")",
":",
"print",
"(",
"\"{}{} `{}`\"",
".",
"format",
"(",
"self",
".",
"_debug_indent",
"*",
"\" \"",
",",
"message",
",",
"repr",
"(",
"self",
".",
"p_suffix",
"(",
"10",
")",
")",
")",
")"
] | Format and print debug messages | [
"Format",
"and",
"print",
"debug",
"messages"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L74-L77 | train | Format and print debug messages |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_next | def p_next(self):
"Consume and return the next char"
try:
self.pos += 1
return self.input[self.pos - 1]
except IndexError:
self.pos -= 1
return None | python | def p_next(self):
"Consume and return the next char"
try:
self.pos += 1
return self.input[self.pos - 1]
except IndexError:
self.pos -= 1
return None | [
"def",
"p_next",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"pos",
"+=",
"1",
"return",
"self",
".",
"input",
"[",
"self",
".",
"pos",
"-",
"1",
"]",
"except",
"IndexError",
":",
"self",
".",
"pos",
"-=",
"1",
"return",
"None"
] | Consume and return the next char | [
"Consume",
"and",
"return",
"the",
"next",
"char"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L86-L93 | train | Consume and return the next char |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_current_col | def p_current_col(self):
"Return currnet column in line"
prefix = self.input[:self.pos]
nlidx = prefix.rfind('\n')
if nlidx == -1:
return self.pos
return self.pos - nlidx | python | def p_current_col(self):
"Return currnet column in line"
prefix = self.input[:self.pos]
nlidx = prefix.rfind('\n')
if nlidx == -1:
return self.pos
return self.pos - nlidx | [
"def",
"p_current_col",
"(",
"self",
")",
":",
"prefix",
"=",
"self",
".",
"input",
"[",
":",
"self",
".",
"pos",
"]",
"nlidx",
"=",
"prefix",
".",
"rfind",
"(",
"'\\n'",
")",
"if",
"nlidx",
"==",
"-",
"1",
":",
"return",
"self",
".",
"pos",
"ret... | Return currnet column in line | [
"Return",
"currnet",
"column",
"in",
"line"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L116-L122 | train | Return currnet column in line |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_pretty_pos | def p_pretty_pos(self):
"Print current line and a pretty cursor below. Used in error messages"
col = self.p_current_col
suffix = self.input[self.pos - col:]
end = suffix.find("\n")
if end != -1:
suffix = suffix[:end]
return "%s\n%s" % (suffix, "-" * col + "^") | python | def p_pretty_pos(self):
"Print current line and a pretty cursor below. Used in error messages"
col = self.p_current_col
suffix = self.input[self.pos - col:]
end = suffix.find("\n")
if end != -1:
suffix = suffix[:end]
return "%s\n%s" % (suffix, "-" * col + "^") | [
"def",
"p_pretty_pos",
"(",
"self",
")",
":",
"col",
"=",
"self",
".",
"p_current_col",
"suffix",
"=",
"self",
".",
"input",
"[",
"self",
".",
"pos",
"-",
"col",
":",
"]",
"end",
"=",
"suffix",
".",
"find",
"(",
"\"\\n\"",
")",
"if",
"end",
"!=",
... | Print current line and a pretty cursor below. Used in error messages | [
"Print",
"current",
"line",
"and",
"a",
"pretty",
"cursor",
"below",
".",
"Used",
"in",
"error",
"messages"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L124-L131 | train | Print current line and a pretty cursor below. Used in error messages |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_startswith | def p_startswith(self, st, ignorecase=False):
"Return True if the input starts with `st` at current position"
length = len(st)
matcher = result = self.input[self.pos:self.pos + length]
if ignorecase:
matcher = result.lower()
st = st.lower()
if matcher == s... | python | def p_startswith(self, st, ignorecase=False):
"Return True if the input starts with `st` at current position"
length = len(st)
matcher = result = self.input[self.pos:self.pos + length]
if ignorecase:
matcher = result.lower()
st = st.lower()
if matcher == s... | [
"def",
"p_startswith",
"(",
"self",
",",
"st",
",",
"ignorecase",
"=",
"False",
")",
":",
"length",
"=",
"len",
"(",
"st",
")",
"matcher",
"=",
"result",
"=",
"self",
".",
"input",
"[",
"self",
".",
"pos",
":",
"self",
".",
"pos",
"+",
"length",
... | Return True if the input starts with `st` at current position | [
"Return",
"True",
"if",
"the",
"input",
"starts",
"with",
"st",
"at",
"current",
"position"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L163-L173 | train | Return True if the input starts with st at current position |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_flatten | def p_flatten(self, obj, **kwargs):
""" Flatten a list of lists of lists... of strings into a string
This is usually used as the action for sequence expressions:
.. code-block::
my_rule <- 'a' . 'c' {p_flatten}
With the input "abc" and no action, this rule returns [ 'a', ... | python | def p_flatten(self, obj, **kwargs):
""" Flatten a list of lists of lists... of strings into a string
This is usually used as the action for sequence expressions:
.. code-block::
my_rule <- 'a' . 'c' {p_flatten}
With the input "abc" and no action, this rule returns [ 'a', ... | [
"def",
"p_flatten",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"six",
".",
"string_types",
")",
":",
"return",
"obj",
"result",
"=",
"\"\"",
"for",
"i",
"in",
"obj",
":",
"result",
"+=",
"self",... | Flatten a list of lists of lists... of strings into a string
This is usually used as the action for sequence expressions:
.. code-block::
my_rule <- 'a' . 'c' {p_flatten}
With the input "abc" and no action, this rule returns [ 'a', 'b', 'c'].
{ p_flatten } procuces "abc".... | [
"Flatten",
"a",
"list",
"of",
"lists",
"of",
"lists",
"...",
"of",
"strings",
"into",
"a",
"string"
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L175-L196 | train | Flatten a list of lists of strings into a string |
lisael/fastidious | fastidious/parser_base.py | ParserMixin.p_parse | def p_parse(cls, input, methodname=None, parse_all=True):
"""
Parse the `input` using `methodname` as entry point.
If `parse_all` is true, the input MUST be fully consumed at the end of
the parsing, otherwise p_parse raises an exception.
"""
if methodname is None:
... | python | def p_parse(cls, input, methodname=None, parse_all=True):
"""
Parse the `input` using `methodname` as entry point.
If `parse_all` is true, the input MUST be fully consumed at the end of
the parsing, otherwise p_parse raises an exception.
"""
if methodname is None:
... | [
"def",
"p_parse",
"(",
"cls",
",",
"input",
",",
"methodname",
"=",
"None",
",",
"parse_all",
"=",
"True",
")",
":",
"if",
"methodname",
"is",
"None",
":",
"methodname",
"=",
"cls",
".",
"__default__",
"p",
"=",
"cls",
"(",
"input",
")",
"result",
"=... | Parse the `input` using `methodname` as entry point.
If `parse_all` is true, the input MUST be fully consumed at the end of
the parsing, otherwise p_parse raises an exception. | [
"Parse",
"the",
"input",
"using",
"methodname",
"as",
"entry",
"point",
"."
] | 2542db9de779ddabc3a64e9eb19a4e2de99741dc | https://github.com/lisael/fastidious/blob/2542db9de779ddabc3a64e9eb19a4e2de99741dc/fastidious/parser_base.py#L199-L212 | train | Parse the input using the specified methodname as entry point. |
jiasir/playback | playback/prepare_host.py | PrepareHost._set_openstack_repository | def _set_openstack_repository(self):
"""openstack packages"""
if self._release() == 'trusty':
print red(env.host_string + ' | Enable the OpenStack repository for trusty')
sudo('apt-get update')
sudo('apt-get install software-properties-common -y')
su... | python | def _set_openstack_repository(self):
"""openstack packages"""
if self._release() == 'trusty':
print red(env.host_string + ' | Enable the OpenStack repository for trusty')
sudo('apt-get update')
sudo('apt-get install software-properties-common -y')
su... | [
"def",
"_set_openstack_repository",
"(",
"self",
")",
":",
"if",
"self",
".",
"_release",
"(",
")",
"==",
"'trusty'",
":",
"print",
"red",
"(",
"env",
".",
"host_string",
"+",
"' | Enable the OpenStack repository for trusty'",
")",
"sudo",
"(",
"'apt-get update'",... | openstack packages | [
"openstack",
"packages"
] | 58b2a5d669dcfaa8cad50c544a4b068dcacf9b69 | https://github.com/jiasir/playback/blob/58b2a5d669dcfaa8cad50c544a4b068dcacf9b69/playback/prepare_host.py#L81-L99 | train | Set the OpenStack repository for trusty or client |
klen/muffin-admin | example/admin.py | bulk_delete | def bulk_delete(handler, request):
"""Bulk delete items"""
ids = request.GET.getall('ids')
Message.delete().where(Message.id << ids).execute()
raise muffin.HTTPFound(handler.url) | python | def bulk_delete(handler, request):
"""Bulk delete items"""
ids = request.GET.getall('ids')
Message.delete().where(Message.id << ids).execute()
raise muffin.HTTPFound(handler.url) | [
"def",
"bulk_delete",
"(",
"handler",
",",
"request",
")",
":",
"ids",
"=",
"request",
".",
"GET",
".",
"getall",
"(",
"'ids'",
")",
"Message",
".",
"delete",
"(",
")",
".",
"where",
"(",
"Message",
".",
"id",
"<<",
"ids",
")",
".",
"execute",
"(",... | Bulk delete items | [
"Bulk",
"delete",
"items"
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/example/admin.py#L47-L51 | train | Bulk delete items |
jiasir/playback | playback/cli/manila_share.py | make | def make(parser):
"""provison Manila Share with HA"""
s = parser.add_subparsers(
title='commands',
metavar='COMMAND',
help='description',
)
def install_f(args):
install(args)
install_parser = install_subparser(s)
install_parser.set_defaults(func=install_f) | python | def make(parser):
"""provison Manila Share with HA"""
s = parser.add_subparsers(
title='commands',
metavar='COMMAND',
help='description',
)
def install_f(args):
install(args)
install_parser = install_subparser(s)
install_parser.set_defaults(func=install_f) | [
"def",
"make",
"(",
"parser",
")",
":",
"s",
"=",
"parser",
".",
"add_subparsers",
"(",
"title",
"=",
"'commands'",
",",
"metavar",
"=",
"'COMMAND'",
",",
"help",
"=",
"'description'",
",",
")",
"def",
"install_f",
"(",
"args",
")",
":",
"install",
"("... | provison Manila Share with HA | [
"provison",
"Manila",
"Share",
"with",
"HA"
] | 58b2a5d669dcfaa8cad50c544a4b068dcacf9b69 | https://github.com/jiasir/playback/blob/58b2a5d669dcfaa8cad50c544a4b068dcacf9b69/playback/cli/manila_share.py#L102-L113 | train | provison Manila Share with HA |
Capitains/MyCapytain | MyCapytain/resources/collections/dts/_resolver.py | HttpResolverDtsCollection._parse_paginated_members | def _parse_paginated_members(self, direction="children"):
""" Launch parsing of children
"""
page = self._last_page_parsed[direction]
if not page:
page = 1
else:
page = int(page)
while page:
if page > 1:
response = self... | python | def _parse_paginated_members(self, direction="children"):
""" Launch parsing of children
"""
page = self._last_page_parsed[direction]
if not page:
page = 1
else:
page = int(page)
while page:
if page > 1:
response = self... | [
"def",
"_parse_paginated_members",
"(",
"self",
",",
"direction",
"=",
"\"children\"",
")",
":",
"page",
"=",
"self",
".",
"_last_page_parsed",
"[",
"direction",
"]",
"if",
"not",
"page",
":",
"page",
"=",
"1",
"else",
":",
"page",
"=",
"int",
"(",
"page... | Launch parsing of children | [
"Launch",
"parsing",
"of",
"children"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/collections/dts/_resolver.py#L103-L154 | train | Launch parsing of children and parents of the object. |
Capitains/MyCapytain | MyCapytain/resources/collections/dts/_resolver.py | HttpResolverDtsCollection.parse_member | def parse_member(
cls,
obj: dict,
collection: "HttpResolverDtsCollection",
direction: str,
**additional_parameters):
""" Parse the member value of a Collection response
and returns the list of object while setting the graph
relationshi... | python | def parse_member(
cls,
obj: dict,
collection: "HttpResolverDtsCollection",
direction: str,
**additional_parameters):
""" Parse the member value of a Collection response
and returns the list of object while setting the graph
relationshi... | [
"def",
"parse_member",
"(",
"cls",
",",
"obj",
":",
"dict",
",",
"collection",
":",
"\"HttpResolverDtsCollection\"",
",",
"direction",
":",
"str",
",",
"*",
"*",
"additional_parameters",
")",
":",
"members",
"=",
"[",
"]",
"# Start pagination check here",
"hydra... | Parse the member value of a Collection response
and returns the list of object while setting the graph
relationship based on `direction`
:param obj: PyLD parsed JSON+LD
:param collection: Collection attached to the member property
:param direction: Direction of the member (child... | [
"Parse",
"the",
"member",
"value",
"of",
"a",
"Collection",
"response",
"and",
"returns",
"the",
"list",
"of",
"object",
"while",
"setting",
"the",
"graph",
"relationship",
"based",
"on",
"direction"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/collections/dts/_resolver.py#L187-L218 | train | Parse the member value of a Collection response and return the list of objects while setting the graph
relationship based on the direction |
erijo/tellive-py | tellive/client.py | LiveClient.request_token | def request_token(self):
""" Returns url, request_token, request_secret"""
logging.debug("Getting request token from %s:%d",
self.server, self.port)
token, secret = self._token("/oauth/requestToken")
return "{}/oauth/authorize?oauth_token={}".format(self.host, token... | python | def request_token(self):
""" Returns url, request_token, request_secret"""
logging.debug("Getting request token from %s:%d",
self.server, self.port)
token, secret = self._token("/oauth/requestToken")
return "{}/oauth/authorize?oauth_token={}".format(self.host, token... | [
"def",
"request_token",
"(",
"self",
")",
":",
"logging",
".",
"debug",
"(",
"\"Getting request token from %s:%d\"",
",",
"self",
".",
"server",
",",
"self",
".",
"port",
")",
"token",
",",
"secret",
"=",
"self",
".",
"_token",
"(",
"\"/oauth/requestToken\"",
... | Returns url, request_token, request_secret | [
"Returns",
"url",
"request_token",
"request_secret"
] | a84ebb1eb29ee4c69a085e55e523ac5fff0087fc | https://github.com/erijo/tellive-py/blob/a84ebb1eb29ee4c69a085e55e523ac5fff0087fc/tellive/client.py#L65-L71 | train | Returns the url request_token request_secret |
erijo/tellive-py | tellive/client.py | LiveClient.access_token | def access_token(self, request_token, request_secret):
"""Returns access_token, access_secret"""
logging.debug("Getting access token from %s:%d",
self.server, self.port)
self.access_token, self.access_secret = \
self._token("/oauth/accessToken", request_token, r... | python | def access_token(self, request_token, request_secret):
"""Returns access_token, access_secret"""
logging.debug("Getting access token from %s:%d",
self.server, self.port)
self.access_token, self.access_secret = \
self._token("/oauth/accessToken", request_token, r... | [
"def",
"access_token",
"(",
"self",
",",
"request_token",
",",
"request_secret",
")",
":",
"logging",
".",
"debug",
"(",
"\"Getting access token from %s:%d\"",
",",
"self",
".",
"server",
",",
"self",
".",
"port",
")",
"self",
".",
"access_token",
",",
"self",... | Returns access_token, access_secret | [
"Returns",
"access_token",
"access_secret"
] | a84ebb1eb29ee4c69a085e55e523ac5fff0087fc | https://github.com/erijo/tellive-py/blob/a84ebb1eb29ee4c69a085e55e523ac5fff0087fc/tellive/client.py#L73-L79 | train | Returns the access token and access secret for the given request token and secret. |
potatolondon/gae-pytz | pytz/gae.py | TimezoneLoader.open_resource | def open_resource(self, name):
"""Opens a resource from the zoneinfo subdir for reading."""
# Import nested here so we can run setup.py without GAE.
from google.appengine.api import memcache
from pytz import OLSON_VERSION
name_parts = name.lstrip('/').split('/')
if os.pa... | python | def open_resource(self, name):
"""Opens a resource from the zoneinfo subdir for reading."""
# Import nested here so we can run setup.py without GAE.
from google.appengine.api import memcache
from pytz import OLSON_VERSION
name_parts = name.lstrip('/').split('/')
if os.pa... | [
"def",
"open_resource",
"(",
"self",
",",
"name",
")",
":",
"# Import nested here so we can run setup.py without GAE.",
"from",
"google",
".",
"appengine",
".",
"api",
"import",
"memcache",
"from",
"pytz",
"import",
"OLSON_VERSION",
"name_parts",
"=",
"name",
".",
"... | Opens a resource from the zoneinfo subdir for reading. | [
"Opens",
"a",
"resource",
"from",
"the",
"zoneinfo",
"subdir",
"for",
"reading",
"."
] | 24741951a7af3e79cd8727ae3f79265decc93fef | https://github.com/potatolondon/gae-pytz/blob/24741951a7af3e79cd8727ae3f79265decc93fef/pytz/gae.py#L46-L65 | train | Opens a resource from the zoneinfo subdir for reading. |
potatolondon/gae-pytz | pytz/gae.py | TimezoneLoader.resource_exists | def resource_exists(self, name):
"""Return true if the given resource exists"""
if name not in self.available:
try:
get_zoneinfo().getinfo('zoneinfo/' + name)
self.available[name] = True
except KeyError:
self.available[name] = False... | python | def resource_exists(self, name):
"""Return true if the given resource exists"""
if name not in self.available:
try:
get_zoneinfo().getinfo('zoneinfo/' + name)
self.available[name] = True
except KeyError:
self.available[name] = False... | [
"def",
"resource_exists",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"available",
":",
"try",
":",
"get_zoneinfo",
"(",
")",
".",
"getinfo",
"(",
"'zoneinfo/'",
"+",
"name",
")",
"self",
".",
"available",
"[",
"name",
... | Return true if the given resource exists | [
"Return",
"true",
"if",
"the",
"given",
"resource",
"exists"
] | 24741951a7af3e79cd8727ae3f79265decc93fef | https://github.com/potatolondon/gae-pytz/blob/24741951a7af3e79cd8727ae3f79265decc93fef/pytz/gae.py#L67-L76 | train | Return True if the given resource exists False otherwise |
potatolondon/gae-pytz | pytz/tzinfo.py | DstTzInfo.fromutc | def fromutc(self, dt):
'''See datetime.tzinfo.fromutc'''
dt = dt.replace(tzinfo=None)
idx = max(0, bisect_right(self._utc_transition_times, dt) - 1)
inf = self._transition_info[idx]
return (dt + inf[0]).replace(tzinfo=self._tzinfos[inf]) | python | def fromutc(self, dt):
'''See datetime.tzinfo.fromutc'''
dt = dt.replace(tzinfo=None)
idx = max(0, bisect_right(self._utc_transition_times, dt) - 1)
inf = self._transition_info[idx]
return (dt + inf[0]).replace(tzinfo=self._tzinfos[inf]) | [
"def",
"fromutc",
"(",
"self",
",",
"dt",
")",
":",
"dt",
"=",
"dt",
".",
"replace",
"(",
"tzinfo",
"=",
"None",
")",
"idx",
"=",
"max",
"(",
"0",
",",
"bisect_right",
"(",
"self",
".",
"_utc_transition_times",
",",
"dt",
")",
"-",
"1",
")",
"inf... | See datetime.tzinfo.fromutc | [
"See",
"datetime",
".",
"tzinfo",
".",
"fromutc"
] | 24741951a7af3e79cd8727ae3f79265decc93fef | https://github.com/potatolondon/gae-pytz/blob/24741951a7af3e79cd8727ae3f79265decc93fef/pytz/tzinfo.py#L141-L146 | train | See datetime. tzinfo. fromutc |
potatolondon/gae-pytz | pytz/tzinfo.py | DstTzInfo.localize | def localize(self, dt, is_dst=False):
'''Convert naive time to local time.
This method should be used to construct localtimes, rather
than passing a tzinfo argument to a datetime constructor.
is_dst is used to determine the correct timezone in the ambigous
period at the end of ... | python | def localize(self, dt, is_dst=False):
'''Convert naive time to local time.
This method should be used to construct localtimes, rather
than passing a tzinfo argument to a datetime constructor.
is_dst is used to determine the correct timezone in the ambigous
period at the end of ... | [
"def",
"localize",
"(",
"self",
",",
"dt",
",",
"is_dst",
"=",
"False",
")",
":",
"if",
"dt",
".",
"tzinfo",
"is",
"not",
"None",
":",
"raise",
"ValueError",
",",
"'Not naive datetime (tzinfo is already set)'",
"# Find the two best possibilities.",
"possible_loc_dt"... | Convert naive time to local time.
This method should be used to construct localtimes, rather
than passing a tzinfo argument to a datetime constructor.
is_dst is used to determine the correct timezone in the ambigous
period at the end of daylight savings time.
>>> from pytz imp... | [
"Convert",
"naive",
"time",
"to",
"local",
"time",
"."
] | 24741951a7af3e79cd8727ae3f79265decc93fef | https://github.com/potatolondon/gae-pytz/blob/24741951a7af3e79cd8727ae3f79265decc93fef/pytz/tzinfo.py#L193-L326 | train | Convert naive time to local time. |
crdoconnor/commandlib | hitch/key.py | regressfile | def regressfile(filename):
"""
Run all stories in filename 'filename' in python 2 and 3.
Rewrite stories if appropriate.
"""
_storybook().in_filename(filename).with_params(
**{"python version": "2.7.14"}
).ordered_by_name().play()
_storybook().with_params(**{"python version": "3.7.0... | python | def regressfile(filename):
"""
Run all stories in filename 'filename' in python 2 and 3.
Rewrite stories if appropriate.
"""
_storybook().in_filename(filename).with_params(
**{"python version": "2.7.14"}
).ordered_by_name().play()
_storybook().with_params(**{"python version": "3.7.0... | [
"def",
"regressfile",
"(",
"filename",
")",
":",
"_storybook",
"(",
")",
".",
"in_filename",
"(",
"filename",
")",
".",
"with_params",
"(",
"*",
"*",
"{",
"\"python version\"",
":",
"\"2.7.14\"",
"}",
")",
".",
"ordered_by_name",
"(",
")",
".",
"play",
"... | Run all stories in filename 'filename' in python 2 and 3.
Rewrite stories if appropriate. | [
"Run",
"all",
"stories",
"in",
"filename",
"filename",
"in",
"python",
"2",
"and",
"3",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/hitch/key.py#L234-L245 | train | Regress a file in python 2 and 3. |
crdoconnor/commandlib | hitch/key.py | readmegen | def readmegen():
"""
Build documentation.
"""
hitchpylibrarytoolkit.readmegen(
_storybook(), DIR.project, DIR.key, DIR.gen, "commandlib"
) | python | def readmegen():
"""
Build documentation.
"""
hitchpylibrarytoolkit.readmegen(
_storybook(), DIR.project, DIR.key, DIR.gen, "commandlib"
) | [
"def",
"readmegen",
"(",
")",
":",
"hitchpylibrarytoolkit",
".",
"readmegen",
"(",
"_storybook",
"(",
")",
",",
"DIR",
".",
"project",
",",
"DIR",
".",
"key",
",",
"DIR",
".",
"gen",
",",
"\"commandlib\"",
")"
] | Build documentation. | [
"Build",
"documentation",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/hitch/key.py#L293-L299 | train | Read the build documentation. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.