partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | group_experiments_greedy | Greedy method to group ExperimentSettings in a given TomographyExperiment
:param tomo_expt: TomographyExperiment to group ExperimentSettings within
:return: TomographyExperiment, with grouped ExperimentSettings according to whether
it consists of PauliTerms diagonal in the same tensor product basis | pyquil/operator_estimation.py | def group_experiments_greedy(tomo_expt: TomographyExperiment):
"""
Greedy method to group ExperimentSettings in a given TomographyExperiment
:param tomo_expt: TomographyExperiment to group ExperimentSettings within
:return: TomographyExperiment, with grouped ExperimentSettings according to whether
... | def group_experiments_greedy(tomo_expt: TomographyExperiment):
"""
Greedy method to group ExperimentSettings in a given TomographyExperiment
:param tomo_expt: TomographyExperiment to group ExperimentSettings within
:return: TomographyExperiment, with grouped ExperimentSettings according to whether
... | [
"Greedy",
"method",
"to",
"group",
"ExperimentSettings",
"in",
"a",
"given",
"TomographyExperiment"
] | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L631-L642 | [
"def",
"group_experiments_greedy",
"(",
"tomo_expt",
":",
"TomographyExperiment",
")",
":",
"diag_sets",
"=",
"_max_tpb_overlap",
"(",
"tomo_expt",
")",
"grouped_expt_settings_list",
"=",
"list",
"(",
"diag_sets",
".",
"values",
"(",
")",
")",
"grouped_tomo_expt",
"... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | group_experiments | Group experiments that are diagonal in a shared tensor product basis (TPB) to minimize number
of QPU runs.
Background
----------
Given some PauliTerm operator, the 'natural' tensor product basis to
diagonalize this term is the one which diagonalizes each Pauli operator in the
product term-by-t... | pyquil/operator_estimation.py | def group_experiments(experiments: TomographyExperiment,
method: str = 'greedy') -> TomographyExperiment:
"""
Group experiments that are diagonal in a shared tensor product basis (TPB) to minimize number
of QPU runs.
Background
----------
Given some PauliTerm operator, th... | def group_experiments(experiments: TomographyExperiment,
method: str = 'greedy') -> TomographyExperiment:
"""
Group experiments that are diagonal in a shared tensor product basis (TPB) to minimize number
of QPU runs.
Background
----------
Given some PauliTerm operator, th... | [
"Group",
"experiments",
"that",
"are",
"diagonal",
"in",
"a",
"shared",
"tensor",
"product",
"basis",
"(",
"TPB",
")",
"to",
"minimize",
"number",
"of",
"QPU",
"runs",
"."
] | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L645-L702 | [
"def",
"group_experiments",
"(",
"experiments",
":",
"TomographyExperiment",
",",
"method",
":",
"str",
"=",
"'greedy'",
")",
"->",
"TomographyExperiment",
":",
"allowed_methods",
"=",
"[",
"'greedy'",
",",
"'clique-removal'",
"]",
"assert",
"method",
"in",
"allow... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | measure_observables | Measure all the observables in a TomographyExperiment.
:param qc: A QuantumComputer which can run quantum programs
:param tomo_experiment: A suite of tomographic observables to measure
:param n_shots: The number of shots to take per ExperimentSetting
:param progress_callback: If not None, this function... | pyquil/operator_estimation.py | def measure_observables(qc: QuantumComputer, tomo_experiment: TomographyExperiment,
n_shots: int = 10000, progress_callback=None, active_reset=False,
symmetrize_readout: str = 'exhaustive',
calibrate_readout: str = 'plus-eig'):
"""
Measure ... | def measure_observables(qc: QuantumComputer, tomo_experiment: TomographyExperiment,
n_shots: int = 10000, progress_callback=None, active_reset=False,
symmetrize_readout: str = 'exhaustive',
calibrate_readout: str = 'plus-eig'):
"""
Measure ... | [
"Measure",
"all",
"the",
"observables",
"in",
"a",
"TomographyExperiment",
"."
] | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L746-L900 | [
"def",
"measure_observables",
"(",
"qc",
":",
"QuantumComputer",
",",
"tomo_experiment",
":",
"TomographyExperiment",
",",
"n_shots",
":",
"int",
"=",
"10000",
",",
"progress_callback",
"=",
"None",
",",
"active_reset",
"=",
"False",
",",
"symmetrize_readout",
":"... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | _ops_bool_to_prog | :param ops_bool: tuple of booleans specifying the operation to be carried out on `qubits`
:param qubits: list specifying the qubits to be carried operations on
:return: Program with the operations specified in `ops_bool` on the qubits specified in
`qubits` | pyquil/operator_estimation.py | def _ops_bool_to_prog(ops_bool: Tuple[bool], qubits: List[int]) -> Program:
"""
:param ops_bool: tuple of booleans specifying the operation to be carried out on `qubits`
:param qubits: list specifying the qubits to be carried operations on
:return: Program with the operations specified in `ops_bool` on ... | def _ops_bool_to_prog(ops_bool: Tuple[bool], qubits: List[int]) -> Program:
"""
:param ops_bool: tuple of booleans specifying the operation to be carried out on `qubits`
:param qubits: list specifying the qubits to be carried operations on
:return: Program with the operations specified in `ops_bool` on ... | [
":",
"param",
"ops_bool",
":",
"tuple",
"of",
"booleans",
"specifying",
"the",
"operation",
"to",
"be",
"carried",
"out",
"on",
"qubits",
":",
"param",
"qubits",
":",
"list",
"specifying",
"the",
"qubits",
"to",
"be",
"carried",
"operations",
"on",
":",
"r... | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L903-L919 | [
"def",
"_ops_bool_to_prog",
"(",
"ops_bool",
":",
"Tuple",
"[",
"bool",
"]",
",",
"qubits",
":",
"List",
"[",
"int",
"]",
")",
"->",
"Program",
":",
"assert",
"len",
"(",
"ops_bool",
")",
"==",
"len",
"(",
"qubits",
")",
",",
"\"Mismatch of qubits and op... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | _stats_from_measurements | :param bs_results: results from running `qc.run`
:param qubit_index_map: dict mapping qubit to classical register index
:param setting: ExperimentSetting
:param n_shots: number of shots in the measurement process
:param coeff: coefficient of the operator being estimated
:return: tuple specifying (me... | pyquil/operator_estimation.py | def _stats_from_measurements(bs_results: np.ndarray, qubit_index_map: Dict,
setting: ExperimentSetting, n_shots: int,
coeff: float = 1.0) -> Tuple[float]:
"""
:param bs_results: results from running `qc.run`
:param qubit_index_map: dict mapping qubit... | def _stats_from_measurements(bs_results: np.ndarray, qubit_index_map: Dict,
setting: ExperimentSetting, n_shots: int,
coeff: float = 1.0) -> Tuple[float]:
"""
:param bs_results: results from running `qc.run`
:param qubit_index_map: dict mapping qubit... | [
":",
"param",
"bs_results",
":",
"results",
"from",
"running",
"qc",
".",
"run",
":",
"param",
"qubit_index_map",
":",
"dict",
"mapping",
"qubit",
"to",
"classical",
"register",
"index",
":",
"param",
"setting",
":",
"ExperimentSetting",
":",
"param",
"n_shots... | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L922-L944 | [
"def",
"_stats_from_measurements",
"(",
"bs_results",
":",
"np",
".",
"ndarray",
",",
"qubit_index_map",
":",
"Dict",
",",
"setting",
":",
"ExperimentSetting",
",",
"n_shots",
":",
"int",
",",
"coeff",
":",
"float",
"=",
"1.0",
")",
"->",
"Tuple",
"[",
"fl... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | ratio_variance | r"""
Given random variables 'A' and 'B', compute the variance on the ratio Y = A/B. Denote the
mean of the random variables as a = E[A] and b = E[B] while the variances are var_a = Var[A]
and var_b = Var[B] and the covariance as Cov[A,B]. The following expression approximates the
variance of Y
Var[... | pyquil/operator_estimation.py | def ratio_variance(a: Union[float, np.ndarray],
var_a: Union[float, np.ndarray],
b: Union[float, np.ndarray],
var_b: Union[float, np.ndarray]) -> Union[float, np.ndarray]:
r"""
Given random variables 'A' and 'B', compute the variance on the ratio Y = A/B.... | def ratio_variance(a: Union[float, np.ndarray],
var_a: Union[float, np.ndarray],
b: Union[float, np.ndarray],
var_b: Union[float, np.ndarray]) -> Union[float, np.ndarray]:
r"""
Given random variables 'A' and 'B', compute the variance on the ratio Y = A/B.... | [
"r",
"Given",
"random",
"variables",
"A",
"and",
"B",
"compute",
"the",
"variance",
"on",
"the",
"ratio",
"Y",
"=",
"A",
"/",
"B",
".",
"Denote",
"the",
"mean",
"of",
"the",
"random",
"variables",
"as",
"a",
"=",
"E",
"[",
"A",
"]",
"and",
"b",
"... | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L947-L979 | [
"def",
"ratio_variance",
"(",
"a",
":",
"Union",
"[",
"float",
",",
"np",
".",
"ndarray",
"]",
",",
"var_a",
":",
"Union",
"[",
"float",
",",
"np",
".",
"ndarray",
"]",
",",
"b",
":",
"Union",
"[",
"float",
",",
"np",
".",
"ndarray",
"]",
",",
... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | _exhaustive_symmetrization | Perform exhaustive symmetrization
:param qc: A QuantumComputer which can run quantum programs
:param qubits: qubits on which the symmetrization program runs
:param shots: number of shots in the symmetrized program
:prog: program to symmetrize
:return: - the equivalent of a `run` output, but with ex... | pyquil/operator_estimation.py | def _exhaustive_symmetrization(qc: QuantumComputer, qubits: List[int],
shots: int, prog: Program) -> (np.ndarray, Dict):
"""
Perform exhaustive symmetrization
:param qc: A QuantumComputer which can run quantum programs
:param qubits: qubits on which the symmetrization pro... | def _exhaustive_symmetrization(qc: QuantumComputer, qubits: List[int],
shots: int, prog: Program) -> (np.ndarray, Dict):
"""
Perform exhaustive symmetrization
:param qc: A QuantumComputer which can run quantum programs
:param qubits: qubits on which the symmetrization pro... | [
"Perform",
"exhaustive",
"symmetrization"
] | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L982-L1022 | [
"def",
"_exhaustive_symmetrization",
"(",
"qc",
":",
"QuantumComputer",
",",
"qubits",
":",
"List",
"[",
"int",
"]",
",",
"shots",
":",
"int",
",",
"prog",
":",
"Program",
")",
"->",
"(",
"np",
".",
"ndarray",
",",
"Dict",
")",
":",
"# Symmetrize -- flip... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | _calibration_program | Program required for calibration in a tomography-like experiment.
:param tomo_experiment: A suite of tomographic observables
:param ExperimentSetting: The particular tomographic observable to measure
:param symmetrize_readout: Method used to symmetrize the readout errors (see docstring for
`measure... | pyquil/operator_estimation.py | def _calibration_program(qc: QuantumComputer, tomo_experiment: TomographyExperiment,
setting: ExperimentSetting) -> Program:
"""
Program required for calibration in a tomography-like experiment.
:param tomo_experiment: A suite of tomographic observables
:param ExperimentSetting... | def _calibration_program(qc: QuantumComputer, tomo_experiment: TomographyExperiment,
setting: ExperimentSetting) -> Program:
"""
Program required for calibration in a tomography-like experiment.
:param tomo_experiment: A suite of tomographic observables
:param ExperimentSetting... | [
"Program",
"required",
"for",
"calibration",
"in",
"a",
"tomography",
"-",
"like",
"experiment",
"."
] | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/operator_estimation.py#L1025-L1053 | [
"def",
"_calibration_program",
"(",
"qc",
":",
"QuantumComputer",
",",
"tomo_experiment",
":",
"TomographyExperiment",
",",
"setting",
":",
"ExperimentSetting",
")",
"->",
"Program",
":",
"# Inherit any noisy attributes from main Program, including gate definitions",
"# and app... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | PyquilConfig._env_or_config_or_default | Get the value of the environment variable or config file value.
The environment variable takes precedence.
:param env: The environment variable name.
:param name: The config file key.
:return: The value or None if not found | pyquil/api/_config.py | def _env_or_config_or_default(self, env=None, file=None, section=None, name=None, default=None):
"""
Get the value of the environment variable or config file value.
The environment variable takes precedence.
:param env: The environment variable name.
:param name: The config file... | def _env_or_config_or_default(self, env=None, file=None, section=None, name=None, default=None):
"""
Get the value of the environment variable or config file value.
The environment variable takes precedence.
:param env: The environment variable name.
:param name: The config file... | [
"Get",
"the",
"value",
"of",
"the",
"environment",
"variable",
"or",
"config",
"file",
"value",
".",
"The",
"environment",
"variable",
"takes",
"precedence",
"."
] | rigetti/pyquil | python | https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_config.py#L110-L126 | [
"def",
"_env_or_config_or_default",
"(",
"self",
",",
"env",
"=",
"None",
",",
"file",
"=",
"None",
",",
"section",
"=",
"None",
",",
"name",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"env_val",
"=",
"environ",
".",
"get",
"(",
"env",
")",
... | ec98e453084b0037d69d8c3245f6822a5422593d |
train | ThreadPool.instance | Cache threadpool since context is
recreated for each request | thumbor/context.py | def instance(cls, size):
"""
Cache threadpool since context is
recreated for each request
"""
if not getattr(cls, "_instance", None):
cls._instance = {}
if size not in cls._instance:
cls._instance[size] = ThreadPool(size)
return cls._instan... | def instance(cls, size):
"""
Cache threadpool since context is
recreated for each request
"""
if not getattr(cls, "_instance", None):
cls._instance = {}
if size not in cls._instance:
cls._instance[size] = ThreadPool(size)
return cls._instan... | [
"Cache",
"threadpool",
"since",
"context",
"is",
"recreated",
"for",
"each",
"request"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/context.py#L255-L264 | [
"def",
"instance",
"(",
"cls",
",",
"size",
")",
":",
"if",
"not",
"getattr",
"(",
"cls",
",",
"\"_instance\"",
",",
"None",
")",
":",
"cls",
".",
"_instance",
"=",
"{",
"}",
"if",
"size",
"not",
"in",
"cls",
".",
"_instance",
":",
"cls",
".",
"_... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | main | Runs thumbor server with the specified arguments. | thumbor/server.py | def main(arguments=None):
'''Runs thumbor server with the specified arguments.'''
if arguments is None:
arguments = sys.argv[1:]
server_parameters = get_server_parameters(arguments)
config = get_config(server_parameters.config_path, server_parameters.use_environment)
configure_log(config, s... | def main(arguments=None):
'''Runs thumbor server with the specified arguments.'''
if arguments is None:
arguments = sys.argv[1:]
server_parameters = get_server_parameters(arguments)
config = get_config(server_parameters.config_path, server_parameters.use_environment)
configure_log(config, s... | [
"Runs",
"thumbor",
"server",
"with",
"the",
"specified",
"arguments",
"."
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/server.py#L132-L150 | [
"def",
"main",
"(",
"arguments",
"=",
"None",
")",
":",
"if",
"arguments",
"is",
"None",
":",
"arguments",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"server_parameters",
"=",
"get_server_parameters",
"(",
"arguments",
")",
"config",
"=",
"get_config",
... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | ResultStorageResult.mime | Retrieves mime metadata if available
:return: | thumbor/result_storages/__init__.py | def mime(self):
'''
Retrieves mime metadata if available
:return:
'''
return self.metadata['ContentType'] if 'ContentType' in self.metadata else BaseEngine.get_mimetype(self.buffer) | def mime(self):
'''
Retrieves mime metadata if available
:return:
'''
return self.metadata['ContentType'] if 'ContentType' in self.metadata else BaseEngine.get_mimetype(self.buffer) | [
"Retrieves",
"mime",
"metadata",
"if",
"available",
":",
"return",
":"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/result_storages/__init__.py#L29-L34 | [
"def",
"mime",
"(",
"self",
")",
":",
"return",
"self",
".",
"metadata",
"[",
"'ContentType'",
"]",
"if",
"'ContentType'",
"in",
"self",
".",
"metadata",
"else",
"BaseEngine",
".",
"get_mimetype",
"(",
"self",
".",
"buffer",
")"
] | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | Metrics.client | Cache statsd client so it doesn't do a DNS lookup
over and over | thumbor/metrics/statsd_metrics.py | def client(cls, config):
"""
Cache statsd client so it doesn't do a DNS lookup
over and over
"""
if not hasattr(cls, "_client"):
cls._client = statsd.StatsClient(config.STATSD_HOST, config.STATSD_PORT, config.STATSD_PREFIX)
return cls._client | def client(cls, config):
"""
Cache statsd client so it doesn't do a DNS lookup
over and over
"""
if not hasattr(cls, "_client"):
cls._client = statsd.StatsClient(config.STATSD_HOST, config.STATSD_PORT, config.STATSD_PREFIX)
return cls._client | [
"Cache",
"statsd",
"client",
"so",
"it",
"doesn",
"t",
"do",
"a",
"DNS",
"lookup",
"over",
"and",
"over"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/metrics/statsd_metrics.py#L18-L25 | [
"def",
"client",
"(",
"cls",
",",
"config",
")",
":",
"if",
"not",
"hasattr",
"(",
"cls",
",",
"\"_client\"",
")",
":",
"cls",
".",
"_client",
"=",
"statsd",
".",
"StatsClient",
"(",
"config",
".",
"STATSD_HOST",
",",
"config",
".",
"STATSD_PORT",
",",... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | Filter.handle_padding | Pads the image with transparent pixels if necessary. | thumbor/filters/frame.py | def handle_padding(self, padding):
'''Pads the image with transparent pixels if necessary.'''
left = padding[0]
top = padding[1]
right = padding[2]
bottom = padding[3]
offset_x = 0
offset_y = 0
new_width = self.engine.size[0]
new_height = self.eng... | def handle_padding(self, padding):
'''Pads the image with transparent pixels if necessary.'''
left = padding[0]
top = padding[1]
right = padding[2]
bottom = padding[3]
offset_x = 0
offset_y = 0
new_width = self.engine.size[0]
new_height = self.eng... | [
"Pads",
"the",
"image",
"with",
"transparent",
"pixels",
"if",
"necessary",
"."
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/filters/frame.py#L50-L76 | [
"def",
"handle_padding",
"(",
"self",
",",
"padding",
")",
":",
"left",
"=",
"padding",
"[",
"0",
"]",
"top",
"=",
"padding",
"[",
"1",
"]",
"right",
"=",
"padding",
"[",
"2",
"]",
"bottom",
"=",
"padding",
"[",
"3",
"]",
"offset_x",
"=",
"0",
"o... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | Transformer.get_target_dimensions | Returns the target dimensions and calculates them if necessary.
The target dimensions are display independent.
:return: Target dimensions as a tuple (width, height)
:rtype: (int, int) | thumbor/transformer.py | def get_target_dimensions(self):
"""
Returns the target dimensions and calculates them if necessary.
The target dimensions are display independent.
:return: Target dimensions as a tuple (width, height)
:rtype: (int, int)
"""
if self.target_height is None:
... | def get_target_dimensions(self):
"""
Returns the target dimensions and calculates them if necessary.
The target dimensions are display independent.
:return: Target dimensions as a tuple (width, height)
:rtype: (int, int)
"""
if self.target_height is None:
... | [
"Returns",
"the",
"target",
"dimensions",
"and",
"calculates",
"them",
"if",
"necessary",
".",
"The",
"target",
"dimensions",
"are",
"display",
"independent",
".",
":",
"return",
":",
"Target",
"dimensions",
"as",
"a",
"tuple",
"(",
"width",
"height",
")",
"... | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/transformer.py#L58-L67 | [
"def",
"get_target_dimensions",
"(",
"self",
")",
":",
"if",
"self",
".",
"target_height",
"is",
"None",
":",
"self",
".",
"_calculate_target_dimensions",
"(",
")",
"return",
"int",
"(",
"self",
".",
"target_width",
")",
",",
"int",
"(",
"self",
".",
"targ... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | Transformer.do_image_operations | If ENGINE_THREADPOOL_SIZE > 0, this will schedule the image operations
into a threadpool. If not, it just executes them synchronously, and
calls self.done_callback when it's finished.
The actual work happens in self.img_operation_worker | thumbor/transformer.py | def do_image_operations(self):
"""
If ENGINE_THREADPOOL_SIZE > 0, this will schedule the image operations
into a threadpool. If not, it just executes them synchronously, and
calls self.done_callback when it's finished.
The actual work happens in self.img_operation_worker
... | def do_image_operations(self):
"""
If ENGINE_THREADPOOL_SIZE > 0, this will schedule the image operations
into a threadpool. If not, it just executes them synchronously, and
calls self.done_callback when it's finished.
The actual work happens in self.img_operation_worker
... | [
"If",
"ENGINE_THREADPOOL_SIZE",
">",
"0",
"this",
"will",
"schedule",
"the",
"image",
"operations",
"into",
"a",
"threadpool",
".",
"If",
"not",
"it",
"just",
"executes",
"them",
"synchronously",
"and",
"calls",
"self",
".",
"done_callback",
"when",
"it",
"s",... | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/transformer.py#L219-L233 | [
"def",
"do_image_operations",
"(",
"self",
")",
":",
"def",
"inner",
"(",
"future",
")",
":",
"self",
".",
"done_callback",
"(",
")",
"self",
".",
"context",
".",
"thread_pool",
".",
"queue",
"(",
"operation",
"=",
"self",
".",
"img_operation_worker",
",",... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | BaseEngine.get_orientation | Returns the image orientation of the buffer image or None
if it is undefined. Gets the original value from the Exif tag.
If the buffer has been rotated, then the value is adjusted to 1.
:return: Orientation value (1 - 8)
:rtype: int or None | thumbor/engines/__init__.py | def get_orientation(self):
"""
Returns the image orientation of the buffer image or None
if it is undefined. Gets the original value from the Exif tag.
If the buffer has been rotated, then the value is adjusted to 1.
:return: Orientation value (1 - 8)
:rtype: int or None
... | def get_orientation(self):
"""
Returns the image orientation of the buffer image or None
if it is undefined. Gets the original value from the Exif tag.
If the buffer has been rotated, then the value is adjusted to 1.
:return: Orientation value (1 - 8)
:rtype: int or None
... | [
"Returns",
"the",
"image",
"orientation",
"of",
"the",
"buffer",
"image",
"or",
"None",
"if",
"it",
"is",
"undefined",
".",
"Gets",
"the",
"original",
"value",
"from",
"the",
"Exif",
"tag",
".",
"If",
"the",
"buffer",
"has",
"been",
"rotated",
"then",
"t... | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/__init__.py#L246-L257 | [
"def",
"get_orientation",
"(",
"self",
")",
":",
"exif_dict",
"=",
"self",
".",
"_get_exif_segment",
"(",
")",
"if",
"exif_dict",
"and",
"piexif",
".",
"ImageIFD",
".",
"Orientation",
"in",
"exif_dict",
"[",
"\"0th\"",
"]",
":",
"return",
"exif_dict",
"[",
... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | BaseEngine.reorientate | Rotates the image in the buffer so that it is oriented correctly.
If override_exif is True (default) then the metadata
orientation is adjusted as well.
:param override_exif: If the metadata should be adjusted as well.
:type override_exif: Boolean | thumbor/engines/__init__.py | def reorientate(self, override_exif=True):
"""
Rotates the image in the buffer so that it is oriented correctly.
If override_exif is True (default) then the metadata
orientation is adjusted as well.
:param override_exif: If the metadata should be adjusted as well.
:type o... | def reorientate(self, override_exif=True):
"""
Rotates the image in the buffer so that it is oriented correctly.
If override_exif is True (default) then the metadata
orientation is adjusted as well.
:param override_exif: If the metadata should be adjusted as well.
:type o... | [
"Rotates",
"the",
"image",
"in",
"the",
"buffer",
"so",
"that",
"it",
"is",
"oriented",
"correctly",
".",
"If",
"override_exif",
"is",
"True",
"(",
"default",
")",
"then",
"the",
"metadata",
"orientation",
"is",
"adjusted",
"as",
"well",
".",
":",
"param",... | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/__init__.py#L259-L299 | [
"def",
"reorientate",
"(",
"self",
",",
"override_exif",
"=",
"True",
")",
":",
"orientation",
"=",
"self",
".",
"get_orientation",
"(",
")",
"if",
"orientation",
"is",
"None",
":",
"return",
"if",
"orientation",
"==",
"2",
":",
"self",
".",
"flip_horizont... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | BaseHandler.get_image | This function is called after the PRE_LOAD filters have been applied.
It applies the AFTER_LOAD filters on the result, then crops the image. | thumbor/handlers/__init__.py | def get_image(self):
"""
This function is called after the PRE_LOAD filters have been applied.
It applies the AFTER_LOAD filters on the result, then crops the image.
"""
try:
result = yield self._fetch(
self.context.request.image_url
)
... | def get_image(self):
"""
This function is called after the PRE_LOAD filters have been applied.
It applies the AFTER_LOAD filters on the result, then crops the image.
"""
try:
result = yield self._fetch(
self.context.request.image_url
)
... | [
"This",
"function",
"is",
"called",
"after",
"the",
"PRE_LOAD",
"filters",
"have",
"been",
"applied",
".",
"It",
"applies",
"the",
"AFTER_LOAD",
"filters",
"on",
"the",
"result",
"then",
"crops",
"the",
"image",
"."
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/handlers/__init__.py#L146-L224 | [
"def",
"get_image",
"(",
"self",
")",
":",
"try",
":",
"result",
"=",
"yield",
"self",
".",
"_fetch",
"(",
"self",
".",
"context",
".",
"request",
".",
"image_url",
")",
"if",
"not",
"result",
".",
"successful",
":",
"if",
"result",
".",
"loader_error"... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | main | Converts a given url with the specified arguments. | thumbor/url_composer.py | def main(arguments=None):
'''Converts a given url with the specified arguments.'''
parsed_options, arguments = get_options(arguments)
image_url = arguments[0]
image_url = quote(image_url)
try:
config = Config.load(None)
except Exception:
config = None
if not parsed_option... | def main(arguments=None):
'''Converts a given url with the specified arguments.'''
parsed_options, arguments = get_options(arguments)
image_url = arguments[0]
image_url = quote(image_url)
try:
config = Config.load(None)
except Exception:
config = None
if not parsed_option... | [
"Converts",
"a",
"given",
"url",
"with",
"the",
"specified",
"arguments",
"."
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/url_composer.py#L159-L183 | [
"def",
"main",
"(",
"arguments",
"=",
"None",
")",
":",
"parsed_options",
",",
"arguments",
"=",
"get_options",
"(",
"arguments",
")",
"image_url",
"=",
"arguments",
"[",
"0",
"]",
"image_url",
"=",
"quote",
"(",
"image_url",
")",
"try",
":",
"config",
"... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | checkImages | checkImages(images)
Check numpy images and correct intensity range etc.
The same for all movie formats. | thumbor/engines/extensions/pil.py | def checkImages(images):
""" checkImages(images)
Check numpy images and correct intensity range etc.
The same for all movie formats.
"""
# Init results
images2 = []
for im in images:
if PIL and isinstance(im, PIL.Image.Image):
# We assume PIL images are allright
... | def checkImages(images):
""" checkImages(images)
Check numpy images and correct intensity range etc.
The same for all movie formats.
"""
# Init results
images2 = []
for im in images:
if PIL and isinstance(im, PIL.Image.Image):
# We assume PIL images are allright
... | [
"checkImages",
"(",
"images",
")",
"Check",
"numpy",
"images",
"and",
"correct",
"intensity",
"range",
"etc",
".",
"The",
"same",
"for",
"all",
"movie",
"formats",
"."
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L91-L129 | [
"def",
"checkImages",
"(",
"images",
")",
":",
"# Init results",
"images2",
"=",
"[",
"]",
"for",
"im",
"in",
"images",
":",
"if",
"PIL",
"and",
"isinstance",
"(",
"im",
",",
"PIL",
".",
"Image",
".",
"Image",
")",
":",
"# We assume PIL images are allright... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | intToBin | Integer to two bytes | thumbor/engines/extensions/pil.py | def intToBin(i):
""" Integer to two bytes """
# devide in two parts (bytes)
i1 = i % 256
i2 = int(i / 256)
# make string (little endian)
return chr(i1) + chr(i2) | def intToBin(i):
""" Integer to two bytes """
# devide in two parts (bytes)
i1 = i % 256
i2 = int(i / 256)
# make string (little endian)
return chr(i1) + chr(i2) | [
"Integer",
"to",
"two",
"bytes"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L132-L138 | [
"def",
"intToBin",
"(",
"i",
")",
":",
"# devide in two parts (bytes)",
"i1",
"=",
"i",
"%",
"256",
"i2",
"=",
"int",
"(",
"i",
"/",
"256",
")",
"# make string (little endian)",
"return",
"chr",
"(",
"i1",
")",
"+",
"chr",
"(",
"i2",
")"
] | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | writeGif | writeGif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, subRectangles=True, dispose=None)
Write an animated gif from the specified images.
Parameters
----------
filename : string
The name of the file to write the image to.
images : list
Should ... | thumbor/engines/extensions/pil.py | def writeGif(
filename, images, duration=0.1, repeat=True, dither=False,
nq=0, subRectangles=True, dispose=None):
""" writeGif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, subRectangles=True, dispose=None)
Write an animated gif from the specified images.
... | def writeGif(
filename, images, duration=0.1, repeat=True, dither=False,
nq=0, subRectangles=True, dispose=None):
""" writeGif(filename, images, duration=0.1, repeat=True, dither=False,
nq=0, subRectangles=True, dispose=None)
Write an animated gif from the specified images.
... | [
"writeGif",
"(",
"filename",
"images",
"duration",
"=",
"0",
".",
"1",
"repeat",
"=",
"True",
"dither",
"=",
"False",
"nq",
"=",
"0",
"subRectangles",
"=",
"True",
"dispose",
"=",
"None",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L454-L551 | [
"def",
"writeGif",
"(",
"filename",
",",
"images",
",",
"duration",
"=",
"0.1",
",",
"repeat",
"=",
"True",
",",
"dither",
"=",
"False",
",",
"nq",
"=",
"0",
",",
"subRectangles",
"=",
"True",
",",
"dispose",
"=",
"None",
")",
":",
"# Check PIL",
"if... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | readGif | readGif(filename, asNumpy=True)
Read images from an animated GIF file. Returns a list of numpy
arrays, or, if asNumpy is false, a list if PIL images. | thumbor/engines/extensions/pil.py | def readGif(filename, asNumpy=True):
""" readGif(filename, asNumpy=True)
Read images from an animated GIF file. Returns a list of numpy
arrays, or, if asNumpy is false, a list if PIL images.
"""
# Check PIL
if PIL is None:
raise RuntimeError("Need PIL to read animated gif files.")
... | def readGif(filename, asNumpy=True):
""" readGif(filename, asNumpy=True)
Read images from an animated GIF file. Returns a list of numpy
arrays, or, if asNumpy is false, a list if PIL images.
"""
# Check PIL
if PIL is None:
raise RuntimeError("Need PIL to read animated gif files.")
... | [
"readGif",
"(",
"filename",
"asNumpy",
"=",
"True",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L554-L601 | [
"def",
"readGif",
"(",
"filename",
",",
"asNumpy",
"=",
"True",
")",
":",
"# Check PIL",
"if",
"PIL",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"Need PIL to read animated gif files.\"",
")",
"# Check Numpy",
"if",
"np",
"is",
"None",
":",
"raise",
"Ru... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.getheaderAnim | getheaderAnim(im)
Get animation header. To replace PILs getheader()[0] | thumbor/engines/extensions/pil.py | def getheaderAnim(self, im):
""" getheaderAnim(im)
Get animation header. To replace PILs getheader()[0]
"""
bb = "GIF89a"
bb += intToBin(im.size[0])
bb += intToBin(im.size[1])
bb += "\x87\x00\x00"
return bb | def getheaderAnim(self, im):
""" getheaderAnim(im)
Get animation header. To replace PILs getheader()[0]
"""
bb = "GIF89a"
bb += intToBin(im.size[0])
bb += intToBin(im.size[1])
bb += "\x87\x00\x00"
return bb | [
"getheaderAnim",
"(",
"im",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L148-L158 | [
"def",
"getheaderAnim",
"(",
"self",
",",
"im",
")",
":",
"bb",
"=",
"\"GIF89a\"",
"bb",
"+=",
"intToBin",
"(",
"im",
".",
"size",
"[",
"0",
"]",
")",
"bb",
"+=",
"intToBin",
"(",
"im",
".",
"size",
"[",
"1",
"]",
")",
"bb",
"+=",
"\"\\x87\\x00\\... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.getImageDescriptor | getImageDescriptor(im, xy=None)
Used for the local color table properties per image.
Otherwise global color table applies to all frames irrespective of
whether additional colors comes in play that require a redefined
palette. Still a maximum of 256 color per frame, obviously.
W... | thumbor/engines/extensions/pil.py | def getImageDescriptor(self, im, xy=None):
""" getImageDescriptor(im, xy=None)
Used for the local color table properties per image.
Otherwise global color table applies to all frames irrespective of
whether additional colors comes in play that require a redefined
palette. Still ... | def getImageDescriptor(self, im, xy=None):
""" getImageDescriptor(im, xy=None)
Used for the local color table properties per image.
Otherwise global color table applies to all frames irrespective of
whether additional colors comes in play that require a redefined
palette. Still ... | [
"getImageDescriptor",
"(",
"im",
"xy",
"=",
"None",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L160-L192 | [
"def",
"getImageDescriptor",
"(",
"self",
",",
"im",
",",
"xy",
"=",
"None",
")",
":",
"# Defaule use full image and place at upper left",
"if",
"xy",
"is",
"None",
":",
"xy",
"=",
"(",
"0",
",",
"0",
")",
"# Image separator,",
"bb",
"=",
"'\\x2C'",
"# Image... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.getAppExt | getAppExt(loops=float('inf'))
Application extention. This part specifies the amount of loops.
If loops is 0 or inf, it goes on infinitely. | thumbor/engines/extensions/pil.py | def getAppExt(self, loops=float('inf')):
""" getAppExt(loops=float('inf'))
Application extention. This part specifies the amount of loops.
If loops is 0 or inf, it goes on infinitely.
"""
if loops == 0 or loops == float('inf'):
loops = 2 ** 16 - 1
# bb ... | def getAppExt(self, loops=float('inf')):
""" getAppExt(loops=float('inf'))
Application extention. This part specifies the amount of loops.
If loops is 0 or inf, it goes on infinitely.
"""
if loops == 0 or loops == float('inf'):
loops = 2 ** 16 - 1
# bb ... | [
"getAppExt",
"(",
"loops",
"=",
"float",
"(",
"inf",
"))"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L194-L214 | [
"def",
"getAppExt",
"(",
"self",
",",
"loops",
"=",
"float",
"(",
"'inf'",
")",
")",
":",
"if",
"loops",
"==",
"0",
"or",
"loops",
"==",
"float",
"(",
"'inf'",
")",
":",
"loops",
"=",
"2",
"**",
"16",
"-",
"1",
"# bb = \"\" application extension should... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.getGraphicsControlExt | getGraphicsControlExt(duration=0.1, dispose=2)
Graphics Control Extension. A sort of header at the start of
each image. Specifies duration and transparancy.
Dispose
-------
* 0 - No disposal specified.
* 1 - Do not dispose. The graphic is to be left in place.
... | thumbor/engines/extensions/pil.py | def getGraphicsControlExt(self, duration=0.1, dispose=2):
""" getGraphicsControlExt(duration=0.1, dispose=2)
Graphics Control Extension. A sort of header at the start of
each image. Specifies duration and transparancy.
Dispose
-------
* 0 - No disposal specified.
... | def getGraphicsControlExt(self, duration=0.1, dispose=2):
""" getGraphicsControlExt(duration=0.1, dispose=2)
Graphics Control Extension. A sort of header at the start of
each image. Specifies duration and transparancy.
Dispose
-------
* 0 - No disposal specified.
... | [
"getGraphicsControlExt",
"(",
"duration",
"=",
"0",
".",
"1",
"dispose",
"=",
"2",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L216-L242 | [
"def",
"getGraphicsControlExt",
"(",
"self",
",",
"duration",
"=",
"0.1",
",",
"dispose",
"=",
"2",
")",
":",
"bb",
"=",
"'\\x21\\xF9\\x04'",
"bb",
"+=",
"chr",
"(",
"(",
"dispose",
"&",
"3",
")",
"<<",
"2",
")",
"# low bit 1 == transparency,",
"# 2nd bit ... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.handleSubRectangles | handleSubRectangles(images)
Handle the sub-rectangle stuff. If the rectangles are given by the
user, the values are checked. Otherwise the subrectangles are
calculated automatically. | thumbor/engines/extensions/pil.py | def handleSubRectangles(self, images, subRectangles):
""" handleSubRectangles(images)
Handle the sub-rectangle stuff. If the rectangles are given by the
user, the values are checked. Otherwise the subrectangles are
calculated automatically.
"""
if isinstance(subRectang... | def handleSubRectangles(self, images, subRectangles):
""" handleSubRectangles(images)
Handle the sub-rectangle stuff. If the rectangles are given by the
user, the values are checked. Otherwise the subrectangles are
calculated automatically.
"""
if isinstance(subRectang... | [
"handleSubRectangles",
"(",
"images",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L244-L290 | [
"def",
"handleSubRectangles",
"(",
"self",
",",
"images",
",",
"subRectangles",
")",
":",
"if",
"isinstance",
"(",
"subRectangles",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"# xy given directly",
"# Check xy",
"xy",
"=",
"subRectangles",
"if",
"xy",
"i... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.getSubRectangles | getSubRectangles(ims)
Calculate the minimal rectangles that need updating each frame.
Returns a two-element tuple containing the cropped images and a
list of x-y positions.
Calculating the subrectangles takes extra time, obviously. However,
if the image sizes were reduced, the ... | thumbor/engines/extensions/pil.py | def getSubRectangles(self, ims):
""" getSubRectangles(ims)
Calculate the minimal rectangles that need updating each frame.
Returns a two-element tuple containing the cropped images and a
list of x-y positions.
Calculating the subrectangles takes extra time, obviously. However,
... | def getSubRectangles(self, ims):
""" getSubRectangles(ims)
Calculate the minimal rectangles that need updating each frame.
Returns a two-element tuple containing the cropped images and a
list of x-y positions.
Calculating the subrectangles takes extra time, obviously. However,
... | [
"getSubRectangles",
"(",
"ims",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L292-L346 | [
"def",
"getSubRectangles",
"(",
"self",
",",
"ims",
")",
":",
"# Check image count",
"if",
"len",
"(",
"ims",
")",
"<",
"2",
":",
"return",
"ims",
",",
"[",
"(",
"0",
",",
"0",
")",
"for",
"i",
"in",
"ims",
"]",
"# We need numpy",
"if",
"np",
"is",... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.convertImagesToPIL | convertImagesToPIL(images, nq=0)
Convert images to Paletted PIL images, which can then be
written to a single animaged GIF. | thumbor/engines/extensions/pil.py | def convertImagesToPIL(self, images, dither, nq=0):
""" convertImagesToPIL(images, nq=0)
Convert images to Paletted PIL images, which can then be
written to a single animaged GIF.
"""
# Convert to PIL images
images2 = []
for im in images:
if isinsta... | def convertImagesToPIL(self, images, dither, nq=0):
""" convertImagesToPIL(images, nq=0)
Convert images to Paletted PIL images, which can then be
written to a single animaged GIF.
"""
# Convert to PIL images
images2 = []
for im in images:
if isinsta... | [
"convertImagesToPIL",
"(",
"images",
"nq",
"=",
"0",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L348-L380 | [
"def",
"convertImagesToPIL",
"(",
"self",
",",
"images",
",",
"dither",
",",
"nq",
"=",
"0",
")",
":",
"# Convert to PIL images",
"images2",
"=",
"[",
"]",
"for",
"im",
"in",
"images",
":",
"if",
"isinstance",
"(",
"im",
",",
"Image",
".",
"Image",
")"... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | GifWriter.writeGifToFile | writeGifToFile(fp, images, durations, loops, xys, disposes)
Given a set of images writes the bytes to the specified stream. | thumbor/engines/extensions/pil.py | def writeGifToFile(self, fp, images, durations, loops, xys, disposes):
""" writeGifToFile(fp, images, durations, loops, xys, disposes)
Given a set of images writes the bytes to the specified stream.
"""
# Obtain palette for all images and count each occurance
palettes, occur = ... | def writeGifToFile(self, fp, images, durations, loops, xys, disposes):
""" writeGifToFile(fp, images, durations, loops, xys, disposes)
Given a set of images writes the bytes to the specified stream.
"""
# Obtain palette for all images and count each occurance
palettes, occur = ... | [
"writeGifToFile",
"(",
"fp",
"images",
"durations",
"loops",
"xys",
"disposes",
")"
] | thumbor/thumbor | python | https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/engines/extensions/pil.py#L382-L450 | [
"def",
"writeGifToFile",
"(",
"self",
",",
"fp",
",",
"images",
",",
"durations",
",",
"loops",
",",
"xys",
",",
"disposes",
")",
":",
"# Obtain palette for all images and count each occurance",
"palettes",
",",
"occur",
"=",
"[",
"]",
",",
"[",
"]",
"for",
... | 558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607 |
train | ApplicationManager.generate_application_string | Generate an application string based on some of the given information
that can be pulled from the test object: app_env, start_time. | seleniumbase/core/application_manager.py | def generate_application_string(cls, test):
""" Generate an application string based on some of the given information
that can be pulled from the test object: app_env, start_time. """
app_env = 'test'
if hasattr(test, 'env'):
app_env = test.env
elif hasattr(test,... | def generate_application_string(cls, test):
""" Generate an application string based on some of the given information
that can be pulled from the test object: app_env, start_time. """
app_env = 'test'
if hasattr(test, 'env'):
app_env = test.env
elif hasattr(test,... | [
"Generate",
"an",
"application",
"string",
"based",
"on",
"some",
"of",
"the",
"given",
"information",
"that",
"can",
"be",
"pulled",
"from",
"the",
"test",
"object",
":",
"app_env",
"start_time",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/application_manager.py#L14-L26 | [
"def",
"generate_application_string",
"(",
"cls",
",",
"test",
")",
":",
"app_env",
"=",
"'test'",
"if",
"hasattr",
"(",
"test",
",",
"'env'",
")",
":",
"app_env",
"=",
"test",
".",
"env",
"elif",
"hasattr",
"(",
"test",
",",
"'environment'",
")",
":",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | _filter_xpath_grouping | This method removes the outer parentheses for xpath grouping.
The xpath converter will break otherwise.
Example:
"(//button[@type='submit'])[1]" becomes "//button[@type='submit'][1]" | seleniumbase/fixtures/xpath_to_css.py | def _filter_xpath_grouping(xpath):
"""
This method removes the outer parentheses for xpath grouping.
The xpath converter will break otherwise.
Example:
"(//button[@type='submit'])[1]" becomes "//button[@type='submit'][1]"
"""
# First remove the first open parentheses
xpath = xpath[1:]
... | def _filter_xpath_grouping(xpath):
"""
This method removes the outer parentheses for xpath grouping.
The xpath converter will break otherwise.
Example:
"(//button[@type='submit'])[1]" becomes "//button[@type='submit'][1]"
"""
# First remove the first open parentheses
xpath = xpath[1:]
... | [
"This",
"method",
"removes",
"the",
"outer",
"parentheses",
"for",
"xpath",
"grouping",
".",
"The",
"xpath",
"converter",
"will",
"break",
"otherwise",
".",
"Example",
":",
"(",
"//",
"button",
"["
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/xpath_to_css.py#L58-L74 | [
"def",
"_filter_xpath_grouping",
"(",
"xpath",
")",
":",
"# First remove the first open parentheses",
"xpath",
"=",
"xpath",
"[",
"1",
":",
"]",
"# Next remove the last closed parentheses",
"index",
"=",
"xpath",
".",
"rfind",
"(",
"')'",
")",
"if",
"index",
"==",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | create_proxy_zip | Implementation of https://stackoverflow.com/a/35293284 for
https://stackoverflow.com/questions/12848327/
(Run Selenium on a proxy server that requires authentication.)
Solution involves creating & adding a Chrome extension on the fly.
* CHROME-ONLY for now! * | seleniumbase/core/proxy_helper.py | def create_proxy_zip(proxy_string, proxy_user, proxy_pass):
""" Implementation of https://stackoverflow.com/a/35293284 for
https://stackoverflow.com/questions/12848327/
(Run Selenium on a proxy server that requires authentication.)
Solution involves creating & adding a Chrome extension on th... | def create_proxy_zip(proxy_string, proxy_user, proxy_pass):
""" Implementation of https://stackoverflow.com/a/35293284 for
https://stackoverflow.com/questions/12848327/
(Run Selenium on a proxy server that requires authentication.)
Solution involves creating & adding a Chrome extension on th... | [
"Implementation",
"of",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"35293284",
"for",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"12848327",
"/",
"(",
"Run",
"Selenium",
"on",
"a",
"proxy",
"server",
"tha... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/proxy_helper.py#L12-L80 | [
"def",
"create_proxy_zip",
"(",
"proxy_string",
",",
"proxy_user",
",",
"proxy_pass",
")",
":",
"proxy_host",
"=",
"proxy_string",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
"proxy_port",
"=",
"proxy_string",
".",
"split",
"(",
"':'",
")",
"[",
"1",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | remove_proxy_zip_if_present | Remove Chrome extension zip file used for proxy server authentication.
Used in the implementation of https://stackoverflow.com/a/35293284
for https://stackoverflow.com/questions/12848327/ | seleniumbase/core/proxy_helper.py | def remove_proxy_zip_if_present():
""" Remove Chrome extension zip file used for proxy server authentication.
Used in the implementation of https://stackoverflow.com/a/35293284
for https://stackoverflow.com/questions/12848327/
"""
try:
if os.path.exists(PROXY_ZIP_PATH):
o... | def remove_proxy_zip_if_present():
""" Remove Chrome extension zip file used for proxy server authentication.
Used in the implementation of https://stackoverflow.com/a/35293284
for https://stackoverflow.com/questions/12848327/
"""
try:
if os.path.exists(PROXY_ZIP_PATH):
o... | [
"Remove",
"Chrome",
"extension",
"zip",
"file",
"used",
"for",
"proxy",
"server",
"authentication",
".",
"Used",
"in",
"the",
"implementation",
"of",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"35293284",
"for",
"https",
":",
"//",
"st... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/proxy_helper.py#L83-L94 | [
"def",
"remove_proxy_zip_if_present",
"(",
")",
":",
"try",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"PROXY_ZIP_PATH",
")",
":",
"os",
".",
"remove",
"(",
"PROXY_ZIP_PATH",
")",
"elif",
"os",
".",
"path",
".",
"exists",
"(",
"PROXY_ZIP_PATH_2",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.click_chain | This method clicks on a list of elements in succession.
'spacing' is the amount of time to wait between clicks. (sec) | seleniumbase/fixtures/base_case.py | def click_chain(self, selectors_list, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT, spacing=0):
""" This method clicks on a list of elements in succession.
'spacing' is the amount of time to wait between clicks. (sec) """
if self.timeout_multiplier and timeout == se... | def click_chain(self, selectors_list, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT, spacing=0):
""" This method clicks on a list of elements in succession.
'spacing' is the amount of time to wait between clicks. (sec) """
if self.timeout_multiplier and timeout == se... | [
"This",
"method",
"clicks",
"on",
"a",
"list",
"of",
"elements",
"in",
"succession",
".",
"spacing",
"is",
"the",
"amount",
"of",
"time",
"to",
"wait",
"between",
"clicks",
".",
"(",
"sec",
")"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L181-L190 | [
"def",
"click_chain",
"(",
"self",
",",
"selectors_list",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
",",
"spacing",
"=",
"0",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.is_link_text_present | Returns True if the link text appears in the HTML of the page.
The element doesn't need to be visible,
such as elements hidden inside a dropdown selection. | seleniumbase/fixtures/base_case.py | def is_link_text_present(self, link_text):
""" Returns True if the link text appears in the HTML of the page.
The element doesn't need to be visible,
such as elements hidden inside a dropdown selection. """
soup = self.get_beautiful_soup()
html_links = soup.find_all('a')
... | def is_link_text_present(self, link_text):
""" Returns True if the link text appears in the HTML of the page.
The element doesn't need to be visible,
such as elements hidden inside a dropdown selection. """
soup = self.get_beautiful_soup()
html_links = soup.find_all('a')
... | [
"Returns",
"True",
"if",
"the",
"link",
"text",
"appears",
"in",
"the",
"HTML",
"of",
"the",
"page",
".",
"The",
"element",
"doesn",
"t",
"need",
"to",
"be",
"visible",
"such",
"as",
"elements",
"hidden",
"inside",
"a",
"dropdown",
"selection",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L192-L201 | [
"def",
"is_link_text_present",
"(",
"self",
",",
"link_text",
")",
":",
"soup",
"=",
"self",
".",
"get_beautiful_soup",
"(",
")",
"html_links",
"=",
"soup",
".",
"find_all",
"(",
"'a'",
")",
"for",
"html_link",
"in",
"html_links",
":",
"if",
"html_link",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_link_attribute | Finds a link by link text and then returns the attribute's value.
If the link text or attribute cannot be found, an exception will
get raised if hard_fail is True (otherwise None is returned). | seleniumbase/fixtures/base_case.py | def get_link_attribute(self, link_text, attribute, hard_fail=True):
""" Finds a link by link text and then returns the attribute's value.
If the link text or attribute cannot be found, an exception will
get raised if hard_fail is True (otherwise None is returned). """
soup = self... | def get_link_attribute(self, link_text, attribute, hard_fail=True):
""" Finds a link by link text and then returns the attribute's value.
If the link text or attribute cannot be found, an exception will
get raised if hard_fail is True (otherwise None is returned). """
soup = self... | [
"Finds",
"a",
"link",
"by",
"link",
"text",
"and",
"then",
"returns",
"the",
"attribute",
"s",
"value",
".",
"If",
"the",
"link",
"text",
"or",
"attribute",
"cannot",
"be",
"found",
"an",
"exception",
"will",
"get",
"raised",
"if",
"hard_fail",
"is",
"Tr... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L203-L223 | [
"def",
"get_link_attribute",
"(",
"self",
",",
"link_text",
",",
"attribute",
",",
"hard_fail",
"=",
"True",
")",
":",
"soup",
"=",
"self",
".",
"get_beautiful_soup",
"(",
")",
"html_links",
"=",
"soup",
".",
"find_all",
"(",
"'a'",
")",
"for",
"html_link"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.click_link_text | This method clicks link text on a page | seleniumbase/fixtures/base_case.py | def click_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" This method clicks link text on a page """
# If using phantomjs, might need to extract and open the link directly
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeo... | def click_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" This method clicks link text on a page """
# If using phantomjs, might need to extract and open the link directly
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeo... | [
"This",
"method",
"clicks",
"link",
"text",
"on",
"a",
"page"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L244-L319 | [
"def",
"click_link_text",
"(",
"self",
",",
"link_text",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"# If using phantomjs, might need to extract and open the link directly",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.click_link | Same as self.click_link_text() | seleniumbase/fixtures/base_case.py | def click_link(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" Same as self.click_link_text() """
self.click_link_text(link_text, timeout=timeout) | def click_link(self, link_text, timeout=settings.SMALL_TIMEOUT):
""" Same as self.click_link_text() """
self.click_link_text(link_text, timeout=timeout) | [
"Same",
"as",
"self",
".",
"click_link_text",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L321-L323 | [
"def",
"click_link",
"(",
"self",
",",
"link_text",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"self",
".",
"click_link_text",
"(",
"link_text",
",",
"timeout",
"=",
"timeout",
")"
] | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.click_partial_link_text | This method clicks the partial link text on a page. | seleniumbase/fixtures/base_case.py | def click_partial_link_text(self, partial_link_text,
timeout=settings.SMALL_TIMEOUT):
""" This method clicks the partial link text on a page. """
# If using phantomjs, might need to extract and open the link directly
if self.timeout_multiplier and timeout == setti... | def click_partial_link_text(self, partial_link_text,
timeout=settings.SMALL_TIMEOUT):
""" This method clicks the partial link text on a page. """
# If using phantomjs, might need to extract and open the link directly
if self.timeout_multiplier and timeout == setti... | [
"This",
"method",
"clicks",
"the",
"partial",
"link",
"text",
"on",
"a",
"page",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L325-L378 | [
"def",
"click_partial_link_text",
"(",
"self",
",",
"partial_link_text",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"# If using phantomjs, might need to extract and open the link directly",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_attribute | This method uses JavaScript to get the value of an attribute. | seleniumbase/fixtures/base_case.py | def get_attribute(self, selector, attribute, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" This method uses JavaScript to get the value of an attribute. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(tim... | def get_attribute(self, selector, attribute, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" This method uses JavaScript to get the value of an attribute. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(tim... | [
"This",
"method",
"uses",
"JavaScript",
"to",
"get",
"the",
"value",
"of",
"an",
"attribute",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L400-L426 | [
"def",
"get_attribute",
"(",
"self",
",",
"selector",
",",
"attribute",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.set_attribute | This method uses JavaScript to set/update an attribute. | seleniumbase/fixtures/base_case.py | def set_attribute(self, selector, attribute, value, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" This method uses JavaScript to set/update an attribute. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(ti... | def set_attribute(self, selector, attribute, value, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" This method uses JavaScript to set/update an attribute. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(ti... | [
"This",
"method",
"uses",
"JavaScript",
"to",
"set",
"/",
"update",
"an",
"attribute",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L428-L446 | [
"def",
"set_attribute",
"(",
"self",
",",
"selector",
",",
"attribute",
",",
"value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_property_value | Returns the property value of a page element's computed style.
Example:
opacity = self.get_property_value("html body a", "opacity")
self.assertTrue(float(opacity) > 0, "Element not visible!") | seleniumbase/fixtures/base_case.py | def get_property_value(self, selector, property, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Returns the property value of a page element's computed style.
Example:
opacity = self.get_property_value("html body a", "opacity")
sel... | def get_property_value(self, selector, property, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Returns the property value of a page element's computed style.
Example:
opacity = self.get_property_value("html body a", "opacity")
sel... | [
"Returns",
"the",
"property",
"value",
"of",
"a",
"page",
"element",
"s",
"computed",
"style",
".",
"Example",
":",
"opacity",
"=",
"self",
".",
"get_property_value",
"(",
"html",
"body",
"a",
"opacity",
")",
"self",
".",
"assertTrue",
"(",
"float",
"(",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L466-L499 | [
"def",
"get_property_value",
"(",
"self",
",",
"selector",
",",
"property",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_image_url | Extracts the URL from an image element on the page. | seleniumbase/fixtures/base_case.py | def get_image_url(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Extracts the URL from an image element on the page. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return ... | def get_image_url(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Extracts the URL from an image element on the page. """
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
return ... | [
"Extracts",
"the",
"URL",
"from",
"an",
"image",
"element",
"on",
"the",
"page",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L536-L542 | [
"def",
"get_image_url",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMALL_TIMEOUT... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.add_text | The more-reliable version of driver.send_keys()
Similar to update_text(), but won't clear the text field first. | seleniumbase/fixtures/base_case.py | def add_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The more-reliable version of driver.send_keys()
Similar to update_text(), but won't clear the text field first. """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEO... | def add_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The more-reliable version of driver.send_keys()
Similar to update_text(), but won't clear the text field first. """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEO... | [
"The",
"more",
"-",
"reliable",
"version",
"of",
"driver",
".",
"send_keys",
"()",
"Similar",
"to",
"update_text",
"()",
"but",
"won",
"t",
"clear",
"the",
"text",
"field",
"first",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L544-L587 | [
"def",
"add_text",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.send_keys | Same as add_text() -> more reliable, but less name confusion. | seleniumbase/fixtures/base_case.py | def send_keys(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Same as add_text() -> more reliable, but less name confusion. """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | def send_keys(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Same as add_text() -> more reliable, but less name confusion. """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
... | [
"Same",
"as",
"add_text",
"()",
"-",
">",
"more",
"reliable",
"but",
"less",
"name",
"confusion",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L589-L596 | [
"def",
"send_keys",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
"."... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.update_text | The shorter version of update_text_value(), which
clears existing text and adds new text into the text field.
We want to keep the old version for backward compatibility. | seleniumbase/fixtures/base_case.py | def update_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT, retry=False):
""" The shorter version of update_text_value(), which
clears existing text and adds new text into the text field.
We want to keep the old version for backward ... | def update_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT, retry=False):
""" The shorter version of update_text_value(), which
clears existing text and adds new text into the text field.
We want to keep the old version for backward ... | [
"The",
"shorter",
"version",
"of",
"update_text_value",
"()",
"which",
"clears",
"existing",
"text",
"and",
"adds",
"new",
"text",
"into",
"the",
"text",
"field",
".",
"We",
"want",
"to",
"keep",
"the",
"old",
"version",
"for",
"backward",
"compatibility",
"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L667-L677 | [
"def",
"update_text",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
",",
"retry",
"=",
"False",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.find_elements | Returns a list of matching WebElements.
If "limit" is set and > 0, will only return that many elements. | seleniumbase/fixtures/base_case.py | def find_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
""" Returns a list of matching WebElements.
If "limit" is set and > 0, will only return that many elements. """
self.wait_for_ready_state_complete()
if page_utils.is_xpath_selector(selector):
by = By.XPATH
... | def find_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
""" Returns a list of matching WebElements.
If "limit" is set and > 0, will only return that many elements. """
self.wait_for_ready_state_complete()
if page_utils.is_xpath_selector(selector):
by = By.XPATH
... | [
"Returns",
"a",
"list",
"of",
"matching",
"WebElements",
".",
"If",
"limit",
"is",
"set",
"and",
">",
"0",
"will",
"only",
"return",
"that",
"many",
"elements",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L717-L729 | [
"def",
"find_elements",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"limit",
"=",
"0",
")",
":",
"self",
".",
"wait_for_ready_state_complete",
"(",
")",
"if",
"page_utils",
".",
"is_xpath_selector",
"(",
"selector",
")",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.find_visible_elements | Returns a list of matching WebElements that are visible.
If "limit" is set and > 0, will only return that many elements. | seleniumbase/fixtures/base_case.py | def find_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
""" Returns a list of matching WebElements that are visible.
If "limit" is set and > 0, will only return that many elements. """
self.wait_for_ready_state_complete()
if page_utils.is_xpath_selector(selector):
... | def find_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
""" Returns a list of matching WebElements that are visible.
If "limit" is set and > 0, will only return that many elements. """
self.wait_for_ready_state_complete()
if page_utils.is_xpath_selector(selector):
... | [
"Returns",
"a",
"list",
"of",
"matching",
"WebElements",
"that",
"are",
"visible",
".",
"If",
"limit",
"is",
"set",
"and",
">",
"0",
"will",
"only",
"return",
"that",
"many",
"elements",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L731-L743 | [
"def",
"find_visible_elements",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"limit",
"=",
"0",
")",
":",
"self",
".",
"wait_for_ready_state_complete",
"(",
")",
"if",
"page_utils",
".",
"is_xpath_selector",
"(",
"selector",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.click_visible_elements | Finds all matching page elements and clicks visible ones in order.
If a click reloads or opens a new page, the clicking will stop.
Works best for actions such as clicking all checkboxes on a page.
Example: self.click_visible_elements('input[type="checkbox"]')
If "limit" ... | seleniumbase/fixtures/base_case.py | def click_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
""" Finds all matching page elements and clicks visible ones in order.
If a click reloads or opens a new page, the clicking will stop.
Works best for actions such as clicking all checkboxes on a page.
Ex... | def click_visible_elements(self, selector, by=By.CSS_SELECTOR, limit=0):
""" Finds all matching page elements and clicks visible ones in order.
If a click reloads or opens a new page, the clicking will stop.
Works best for actions such as clicking all checkboxes on a page.
Ex... | [
"Finds",
"all",
"matching",
"page",
"elements",
"and",
"clicks",
"visible",
"ones",
"in",
"order",
".",
"If",
"a",
"click",
"reloads",
"or",
"opens",
"a",
"new",
"page",
"the",
"clicking",
"will",
"stop",
".",
"Works",
"best",
"for",
"actions",
"such",
"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L745-L779 | [
"def",
"click_visible_elements",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"limit",
"=",
"0",
")",
":",
"elements",
"=",
"self",
".",
"find_elements",
"(",
"selector",
",",
"by",
"=",
"by",
")",
"count",
"=",
"0",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.is_element_in_an_iframe | Returns True if the selector's element is located in an iframe.
Otherwise returns False. | seleniumbase/fixtures/base_case.py | def is_element_in_an_iframe(self, selector, by=By.CSS_SELECTOR):
""" Returns True if the selector's element is located in an iframe.
Otherwise returns False. """
selector, by = self.__recalculate_selector(selector, by)
if self.is_element_present(selector, by=by):
return F... | def is_element_in_an_iframe(self, selector, by=By.CSS_SELECTOR):
""" Returns True if the selector's element is located in an iframe.
Otherwise returns False. """
selector, by = self.__recalculate_selector(selector, by)
if self.is_element_present(selector, by=by):
return F... | [
"Returns",
"True",
"if",
"the",
"selector",
"s",
"element",
"is",
"located",
"in",
"an",
"iframe",
".",
"Otherwise",
"returns",
"False",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L781-L802 | [
"def",
"is_element_in_an_iframe",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"if",
"self",
".",
"is_element_present",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.create_tour | Creates a tour for a website. By default, the Shepherd JavaScript
Library is used with the Shepherd "Light" / "Arrows" theme.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
theme - Sets ... | seleniumbase/fixtures/base_case.py | def create_tour(self, name=None, theme=None):
""" Creates a tour for a website. By default, the Shepherd JavaScript
Library is used with the Shepherd "Light" / "Arrows" theme.
@Params
name - If creating multiple tours at the same time,
use this to select th... | def create_tour(self, name=None, theme=None):
""" Creates a tour for a website. By default, the Shepherd JavaScript
Library is used with the Shepherd "Light" / "Arrows" theme.
@Params
name - If creating multiple tours at the same time,
use this to select th... | [
"Creates",
"a",
"tour",
"for",
"a",
"website",
".",
"By",
"default",
"the",
"Shepherd",
"JavaScript",
"Library",
"is",
"used",
"with",
"the",
"Shepherd",
"Light",
"/",
"Arrows",
"theme",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L869-L904 | [
"def",
"create_tour",
"(",
"self",
",",
"name",
"=",
"None",
",",
"theme",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"\"default\"",
"if",
"theme",
":",
"if",
"theme",
".",
"lower",
"(",
")",
"==",
"\"bootstrap\"",
":",
"self",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.create_shepherd_tour | Creates a Shepherd JS website tour.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
theme - Sets the default theme for the tour.
Choose from "light"/"arrows", "dark", "default", "... | seleniumbase/fixtures/base_case.py | def create_shepherd_tour(self, name=None, theme=None):
""" Creates a Shepherd JS website tour.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
theme - Sets the default theme for the tour.
... | def create_shepherd_tour(self, name=None, theme=None):
""" Creates a Shepherd JS website tour.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
theme - Sets the default theme for the tour.
... | [
"Creates",
"a",
"Shepherd",
"JS",
"website",
"tour",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L906-L965 | [
"def",
"create_shepherd_tour",
"(",
"self",
",",
"name",
"=",
"None",
",",
"theme",
"=",
"None",
")",
":",
"shepherd_theme",
"=",
"\"shepherd-theme-arrows\"",
"if",
"theme",
":",
"if",
"theme",
".",
"lower",
"(",
")",
"==",
"\"default\"",
":",
"shepherd_them... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.create_bootstrap_tour | Creates a Bootstrap tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to. | seleniumbase/fixtures/base_case.py | def create_bootstrap_tour(self, name=None):
""" Creates a Bootstrap tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
"""
if not name:
name = "default"
... | def create_bootstrap_tour(self, name=None):
""" Creates a Bootstrap tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
"""
if not name:
name = "default"
... | [
"Creates",
"a",
"Bootstrap",
"tour",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L967-L985 | [
"def",
"create_bootstrap_tour",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"\"default\"",
"new_tour",
"=",
"(",
"\"\"\"\n // Bootstrap Tour\n var tour = new Tour({\n });\n tour.addSteps([... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.create_hopscotch_tour | Creates an Hopscotch tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to. | seleniumbase/fixtures/base_case.py | def create_hopscotch_tour(self, name=None):
""" Creates an Hopscotch tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
"""
if not name:
name = "default"
... | def create_hopscotch_tour(self, name=None):
""" Creates an Hopscotch tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
"""
if not name:
name = "default"
... | [
"Creates",
"an",
"Hopscotch",
"tour",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L987-L1005 | [
"def",
"create_hopscotch_tour",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"\"default\"",
"new_tour",
"=",
"(",
"\"\"\"\n // Hopscotch Tour\n var tour = {\n id: \"hopscotch_tour\",\n step... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.create_introjs_tour | Creates an IntroJS tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to. | seleniumbase/fixtures/base_case.py | def create_introjs_tour(self, name=None):
""" Creates an IntroJS tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
"""
if not name:
name = "default"
... | def create_introjs_tour(self, name=None):
""" Creates an IntroJS tour for a website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
"""
if not name:
name = "default"
... | [
"Creates",
"an",
"IntroJS",
"tour",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1007-L1026 | [
"def",
"create_introjs_tour",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"\"default\"",
"new_tour",
"=",
"(",
"\"\"\"\n // IntroJS Tour\n function startIntro(){\n var intro = introJs();\n ... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.add_tour_step | Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attach to.
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.... | seleniumbase/fixtures/base_case.py | def add_tour_step(self, message, selector=None, name=None,
title=None, theme=None, alignment=None, duration=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element t... | def add_tour_step(self, message, selector=None, name=None,
title=None, theme=None, alignment=None, duration=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element t... | [
"Allows",
"the",
"user",
"to",
"add",
"tour",
"steps",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1028-L1088 | [
"def",
"add_tour_step",
"(",
"self",
",",
"message",
",",
"selector",
"=",
"None",
",",
"name",
"=",
"None",
",",
"title",
"=",
"None",
",",
"theme",
"=",
"None",
",",
"alignment",
"=",
"None",
",",
"duration",
"=",
"None",
")",
":",
"if",
"not",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__add_shepherd_tour_step | Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attach to.
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.... | seleniumbase/fixtures/base_case.py | def __add_shepherd_tour_step(self, message, selector=None, name=None,
title=None, theme=None, alignment=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the El... | def __add_shepherd_tour_step(self, message, selector=None, name=None,
title=None, theme=None, alignment=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the El... | [
"Allows",
"the",
"user",
"to",
"add",
"tour",
"steps",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1090-L1142 | [
"def",
"__add_shepherd_tour_step",
"(",
"self",
",",
"message",
",",
"selector",
"=",
"None",
",",
"name",
"=",
"None",
",",
"title",
"=",
"None",
",",
"theme",
"=",
"None",
",",
"alignment",
"=",
"None",
")",
":",
"if",
"theme",
"==",
"\"default\"",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__add_bootstrap_tour_step | Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attach to.
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.... | seleniumbase/fixtures/base_case.py | def __add_bootstrap_tour_step(self, message, selector=None, name=None,
title=None, alignment=None, duration=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of t... | def __add_bootstrap_tour_step(self, message, selector=None, name=None,
title=None, alignment=None, duration=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of t... | [
"Allows",
"the",
"user",
"to",
"add",
"tour",
"steps",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1144-L1178 | [
"def",
"__add_bootstrap_tour_step",
"(",
"self",
",",
"message",
",",
"selector",
"=",
"None",
",",
"name",
"=",
"None",
",",
"title",
"=",
"None",
",",
"alignment",
"=",
"None",
",",
"duration",
"=",
"None",
")",
":",
"if",
"selector",
"!=",
"\"html\"",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__add_hopscotch_tour_step | Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attach to.
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.... | seleniumbase/fixtures/base_case.py | def __add_hopscotch_tour_step(self, message, selector=None, name=None,
title=None, alignment=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to a... | def __add_hopscotch_tour_step(self, message, selector=None, name=None,
title=None, alignment=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to a... | [
"Allows",
"the",
"user",
"to",
"add",
"tour",
"steps",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1180-L1210 | [
"def",
"__add_hopscotch_tour_step",
"(",
"self",
",",
"message",
",",
"selector",
"=",
"None",
",",
"name",
"=",
"None",
",",
"title",
"=",
"None",
",",
"alignment",
"=",
"None",
")",
":",
"arrow_offset_row",
"=",
"None",
"if",
"not",
"selector",
"or",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__add_introjs_tour_step | Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attach to.
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.... | seleniumbase/fixtures/base_case.py | def __add_introjs_tour_step(self, message, selector=None, name=None,
title=None, alignment=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attac... | def __add_introjs_tour_step(self, message, selector=None, name=None,
title=None, alignment=None):
""" Allows the user to add tour steps for a website.
@Params
message - The message to display.
selector - The CSS Selector of the Element to attac... | [
"Allows",
"the",
"user",
"to",
"add",
"tour",
"steps",
"for",
"a",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1212-L1239 | [
"def",
"__add_introjs_tour_step",
"(",
"self",
",",
"message",
",",
"selector",
"=",
"None",
",",
"name",
"=",
"None",
",",
"title",
"=",
"None",
",",
"alignment",
"=",
"None",
")",
":",
"if",
"selector",
"!=",
"\"html\"",
":",
"element_row",
"=",
"\"ele... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.play_tour | Plays a tour on the current website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
interval - The delay time between autoplaying tour steps.
If set to 0 (default), the tour i... | seleniumbase/fixtures/base_case.py | def play_tour(self, name=None, interval=0):
""" Plays a tour on the current website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
interval - The delay time between autoplaying tour steps.
... | def play_tour(self, name=None, interval=0):
""" Plays a tour on the current website.
@Params
name - If creating multiple tours at the same time,
use this to select the tour you wish to add steps to.
interval - The delay time between autoplaying tour steps.
... | [
"Plays",
"a",
"tour",
"on",
"the",
"current",
"website",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1241-L1273 | [
"def",
"play_tour",
"(",
"self",
",",
"name",
"=",
"None",
",",
"interval",
"=",
"0",
")",
":",
"if",
"self",
".",
"headless",
":",
"return",
"# Tours should not run in headless mode.",
"if",
"not",
"name",
":",
"name",
"=",
"\"default\"",
"if",
"name",
"n... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.export_tour | Exports a tour as a JS file.
You can call self.export_tour() anywhere where you would
normally use self.play_tour() to play a tour.
It will include necessary resources as well, such as jQuery.
You'll be able to copy the tour directly into the Console of
any we... | seleniumbase/fixtures/base_case.py | def export_tour(self, name=None, filename="my_tour.js", url=None):
""" Exports a tour as a JS file.
You can call self.export_tour() anywhere where you would
normally use self.play_tour() to play a tour.
It will include necessary resources as well, such as jQuery.
... | def export_tour(self, name=None, filename="my_tour.js", url=None):
""" Exports a tour as a JS file.
You can call self.export_tour() anywhere where you would
normally use self.play_tour() to play a tour.
It will include necessary resources as well, such as jQuery.
... | [
"Exports",
"a",
"tour",
"as",
"a",
"JS",
"file",
".",
"You",
"can",
"call",
"self",
".",
"export_tour",
"()",
"anywhere",
"where",
"you",
"would",
"normally",
"use",
"self",
".",
"play_tour",
"()",
"to",
"play",
"a",
"tour",
".",
"It",
"will",
"include... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1275-L1290 | [
"def",
"export_tour",
"(",
"self",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"\"my_tour.js\"",
",",
"url",
"=",
"None",
")",
":",
"if",
"not",
"url",
":",
"url",
"=",
"self",
".",
"get_current_url",
"(",
")",
"tour_helper",
".",
"export_tour",
"(... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.set_messenger_theme | Sets a theme for posting messages.
Themes: ["flat", "future", "block", "air", "ice"]
Locations: ["top_left", "top_center", "top_right",
"bottom_left", "bottom_center", "bottom_right"]
max_messages is the limit of concurrent messages to display. | seleniumbase/fixtures/base_case.py | def set_messenger_theme(self, theme="default", location="default",
max_messages="default"):
""" Sets a theme for posting messages.
Themes: ["flat", "future", "block", "air", "ice"]
Locations: ["top_left", "top_center", "top_right",
"bot... | def set_messenger_theme(self, theme="default", location="default",
max_messages="default"):
""" Sets a theme for posting messages.
Themes: ["flat", "future", "block", "air", "ice"]
Locations: ["top_left", "top_center", "top_right",
"bot... | [
"Sets",
"a",
"theme",
"for",
"posting",
"messages",
".",
"Themes",
":",
"[",
"flat",
"future",
"block",
"air",
"ice",
"]",
"Locations",
":",
"[",
"top_left",
"top_center",
"top_right",
"bottom_left",
"bottom_center",
"bottom_right",
"]",
"max_messages",
"is",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1299-L1314 | [
"def",
"set_messenger_theme",
"(",
"self",
",",
"theme",
"=",
"\"default\"",
",",
"location",
"=",
"\"default\"",
",",
"max_messages",
"=",
"\"default\"",
")",
":",
"if",
"not",
"theme",
":",
"theme",
"=",
"\"default\"",
"# \"future\"",
"if",
"not",
"location"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.post_message | Post a message on the screen with Messenger.
Arguments:
message: The message to display.
duration: The time until the message vanishes. (Default: 2.55s)
pause: If True, the program waits until the message completes.
style: "info", "success", or... | seleniumbase/fixtures/base_case.py | def post_message(self, message, duration=None, pause=True, style="info"):
""" Post a message on the screen with Messenger.
Arguments:
message: The message to display.
duration: The time until the message vanishes. (Default: 2.55s)
pause: If True, the p... | def post_message(self, message, duration=None, pause=True, style="info"):
""" Post a message on the screen with Messenger.
Arguments:
message: The message to display.
duration: The time until the message vanishes. (Default: 2.55s)
pause: If True, the p... | [
"Post",
"a",
"message",
"on",
"the",
"screen",
"with",
"Messenger",
".",
"Arguments",
":",
"message",
":",
"The",
"message",
"to",
"display",
".",
"duration",
":",
"The",
"time",
"until",
"the",
"message",
"vanishes",
".",
"(",
"Default",
":",
"2",
".",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1316-L1336 | [
"def",
"post_message",
"(",
"self",
",",
"message",
",",
"duration",
"=",
"None",
",",
"pause",
"=",
"True",
",",
"style",
"=",
"\"info\"",
")",
":",
"if",
"not",
"duration",
":",
"if",
"not",
"self",
".",
"message_duration",
":",
"duration",
"=",
"set... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.bring_to_front | Updates the Z-index of a page element to bring it into view.
Useful when getting a WebDriverException, such as the one below:
{ Element is not clickable at point (#, #).
Other element would receive the click: ... } | seleniumbase/fixtures/base_case.py | def bring_to_front(self, selector, by=By.CSS_SELECTOR):
""" Updates the Z-index of a page element to bring it into view.
Useful when getting a WebDriverException, such as the one below:
{ Element is not clickable at point (#, #).
Other element would receive the clic... | def bring_to_front(self, selector, by=By.CSS_SELECTOR):
""" Updates the Z-index of a page element to bring it into view.
Useful when getting a WebDriverException, such as the one below:
{ Element is not clickable at point (#, #).
Other element would receive the clic... | [
"Updates",
"the",
"Z",
"-",
"index",
"of",
"a",
"page",
"element",
"to",
"bring",
"it",
"into",
"view",
".",
"Useful",
"when",
"getting",
"a",
"WebDriverException",
"such",
"as",
"the",
"one",
"below",
":",
"{",
"Element",
"is",
"not",
"clickable",
"at",... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1374-L1391 | [
"def",
"bring_to_front",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"if",
"page_utils",
".",
"is_xpath_selector",
"(",
"selector",
")",
":",
"by",
"=",
"By",
".",
"XPATH",
"self",
".",
"find_element",
"(",
"selecto... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.highlight | This method uses fancy JavaScript to highlight an element.
Used during demo_mode.
@Params
selector - the selector of the element to find
by - the type of selector to search by (Default: CSS)
loops - # of times to repeat the highlight animation
... | seleniumbase/fixtures/base_case.py | def highlight(self, selector, by=By.CSS_SELECTOR,
loops=settings.HIGHLIGHTS, scroll=True):
""" This method uses fancy JavaScript to highlight an element.
Used during demo_mode.
@Params
selector - the selector of the element to find
by - the type ... | def highlight(self, selector, by=By.CSS_SELECTOR,
loops=settings.HIGHLIGHTS, scroll=True):
""" This method uses fancy JavaScript to highlight an element.
Used during demo_mode.
@Params
selector - the selector of the element to find
by - the type ... | [
"This",
"method",
"uses",
"fancy",
"JavaScript",
"to",
"highlight",
"an",
"element",
".",
"Used",
"during",
"demo_mode",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1405-L1454 | [
"def",
"highlight",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"loops",
"=",
"settings",
".",
"HIGHLIGHTS",
",",
"scroll",
"=",
"True",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.scroll_to | Fast scroll to destination | seleniumbase/fixtures/base_case.py | def scroll_to(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
''' Fast scroll to destination '''
if self.demo_mode:
self.slow_scroll_to(selector, by=by, timeout=timeout)
return
if self.timeout_multiplier and timeout == settings.SMALL... | def scroll_to(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
''' Fast scroll to destination '''
if self.demo_mode:
self.slow_scroll_to(selector, by=by, timeout=timeout)
return
if self.timeout_multiplier and timeout == settings.SMALL... | [
"Fast",
"scroll",
"to",
"destination"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1462-L1479 | [
"def",
"scroll_to",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"demo_mode",
":",
"self",
".",
"slow_scroll_to",
"(",
"selector",
",",
"by",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.slow_scroll_to | Slow motion scroll to destination | seleniumbase/fixtures/base_case.py | def slow_scroll_to(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
''' Slow motion scroll to destination '''
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
element = self.wait_for... | def slow_scroll_to(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
''' Slow motion scroll to destination '''
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
element = self.wait_for... | [
"Slow",
"motion",
"scroll",
"to",
"destination"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1481-L1488 | [
"def",
"slow_scroll_to",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
".",
"SMALL_TIMEOU... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.js_click | Clicks an element using pure JS. Does not use jQuery. | seleniumbase/fixtures/base_case.py | def js_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using pure JS. Does not use jQuery. """
selector, by = self.__recalculate_selector(selector, by)
if by == By.LINK_TEXT:
message = (
"Pure JavaScript doesn't support clicking by Link Text. "
... | def js_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using pure JS. Does not use jQuery. """
selector, by = self.__recalculate_selector(selector, by)
if by == By.LINK_TEXT:
message = (
"Pure JavaScript doesn't support clicking by Link Text. "
... | [
"Clicks",
"an",
"element",
"using",
"pure",
"JS",
".",
"Does",
"not",
"use",
"jQuery",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1501-L1523 | [
"def",
"js_click",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"if",
"by",
"==",
"By",
".",
"LINK_TEXT",
":",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.jquery_click | Clicks an element using jQuery. Different from using pure JS. | seleniumbase/fixtures/base_case.py | def jquery_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using jQuery. Different from using pure JS. """
selector, by = self.__recalculate_selector(selector, by)
self.wait_for_element_present(
selector, by=by, timeout=settings.SMALL_TIMEOUT)
if self.is_elem... | def jquery_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using jQuery. Different from using pure JS. """
selector, by = self.__recalculate_selector(selector, by)
self.wait_for_element_present(
selector, by=by, timeout=settings.SMALL_TIMEOUT)
if self.is_elem... | [
"Clicks",
"an",
"element",
"using",
"jQuery",
".",
"Different",
"from",
"using",
"pure",
"JS",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1525-L1536 | [
"def",
"jquery_click",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"self",
".",
"wait_for_element_present",
"(",
"sel... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.submit | Alternative to self.driver.find_element_by_*(SELECTOR).submit() | seleniumbase/fixtures/base_case.py | def submit(self, selector, by=By.CSS_SELECTOR):
""" Alternative to self.driver.find_element_by_*(SELECTOR).submit() """
if page_utils.is_xpath_selector(selector):
by = By.XPATH
element = self.wait_for_element_visible(
selector, by=by, timeout=settings.SMALL_TIMEOUT)
... | def submit(self, selector, by=By.CSS_SELECTOR):
""" Alternative to self.driver.find_element_by_*(SELECTOR).submit() """
if page_utils.is_xpath_selector(selector):
by = By.XPATH
element = self.wait_for_element_visible(
selector, by=by, timeout=settings.SMALL_TIMEOUT)
... | [
"Alternative",
"to",
"self",
".",
"driver",
".",
"find_element_by_",
"*",
"(",
"SELECTOR",
")",
".",
"submit",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1538-L1545 | [
"def",
"submit",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"if",
"page_utils",
".",
"is_xpath_selector",
"(",
"selector",
")",
":",
"by",
"=",
"By",
".",
"XPATH",
"element",
"=",
"self",
".",
"wait_for_element_vis... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.hide_element | Hide the first element on the page that matches the selector. | seleniumbase/fixtures/base_case.py | def hide_element(self, selector, by=By.CSS_SELECTOR):
""" Hide the first element on the page that matches the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
selector = self.__make_css_match_first_element_onl... | def hide_element(self, selector, by=By.CSS_SELECTOR):
""" Hide the first element on the page that matches the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
selector = self.__make_css_match_first_element_onl... | [
"Hide",
"the",
"first",
"element",
"on",
"the",
"page",
"that",
"matches",
"the",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1547-L1553 | [
"def",
"hide_element",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"selector",
"=",
"self",
".",
"convert_to_css_sele... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.hide_elements | Hide all elements on the page that match the selector. | seleniumbase/fixtures/base_case.py | def hide_elements(self, selector, by=By.CSS_SELECTOR):
""" Hide all elements on the page that match the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
hide_script = """jQuery('%s').hide()""" % selector
... | def hide_elements(self, selector, by=By.CSS_SELECTOR):
""" Hide all elements on the page that match the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
hide_script = """jQuery('%s').hide()""" % selector
... | [
"Hide",
"all",
"elements",
"on",
"the",
"page",
"that",
"match",
"the",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1555-L1560 | [
"def",
"hide_elements",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"selector",
"=",
"self",
".",
"convert_to_css_sel... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.show_element | Show the first element on the page that matches the selector. | seleniumbase/fixtures/base_case.py | def show_element(self, selector, by=By.CSS_SELECTOR):
""" Show the first element on the page that matches the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
selector = self.__make_css_match_first_element_onl... | def show_element(self, selector, by=By.CSS_SELECTOR):
""" Show the first element on the page that matches the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
selector = self.__make_css_match_first_element_onl... | [
"Show",
"the",
"first",
"element",
"on",
"the",
"page",
"that",
"matches",
"the",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1562-L1568 | [
"def",
"show_element",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"selector",
"=",
"self",
".",
"convert_to_css_sele... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.show_elements | Show all elements on the page that match the selector. | seleniumbase/fixtures/base_case.py | def show_elements(self, selector, by=By.CSS_SELECTOR):
""" Show all elements on the page that match the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
show_script = """jQuery('%s').show(0)""" % selector
... | def show_elements(self, selector, by=By.CSS_SELECTOR):
""" Show all elements on the page that match the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
show_script = """jQuery('%s').show(0)""" % selector
... | [
"Show",
"all",
"elements",
"on",
"the",
"page",
"that",
"match",
"the",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1570-L1575 | [
"def",
"show_elements",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"selector",
"=",
"self",
".",
"convert_to_css_sel... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.remove_element | Remove the first element on the page that matches the selector. | seleniumbase/fixtures/base_case.py | def remove_element(self, selector, by=By.CSS_SELECTOR):
""" Remove the first element on the page that matches the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
selector = self.__make_css_match_first_element... | def remove_element(self, selector, by=By.CSS_SELECTOR):
""" Remove the first element on the page that matches the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
selector = self.__make_css_match_first_element... | [
"Remove",
"the",
"first",
"element",
"on",
"the",
"page",
"that",
"matches",
"the",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1577-L1583 | [
"def",
"remove_element",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"selector",
"=",
"self",
".",
"convert_to_css_se... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.remove_elements | Remove all elements on the page that match the selector. | seleniumbase/fixtures/base_case.py | def remove_elements(self, selector, by=By.CSS_SELECTOR):
""" Remove all elements on the page that match the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
remove_script = """jQuery('%s').remove()""" % select... | def remove_elements(self, selector, by=By.CSS_SELECTOR):
""" Remove all elements on the page that match the selector. """
selector, by = self.__recalculate_selector(selector, by)
selector = self.convert_to_css_selector(selector, by=by)
remove_script = """jQuery('%s').remove()""" % select... | [
"Remove",
"all",
"elements",
"on",
"the",
"page",
"that",
"match",
"the",
"selector",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1585-L1590 | [
"def",
"remove_elements",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
")",
":",
"selector",
",",
"by",
"=",
"self",
".",
"__recalculate_selector",
"(",
"selector",
",",
"by",
")",
"selector",
"=",
"self",
".",
"convert_to_css_s... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_beautiful_soup | BeautifulSoup is a toolkit for dissecting an HTML document
and extracting what you need. It's great for screen-scraping! | seleniumbase/fixtures/base_case.py | def get_beautiful_soup(self, source=None):
""" BeautifulSoup is a toolkit for dissecting an HTML document
and extracting what you need. It's great for screen-scraping! """
from bs4 import BeautifulSoup
if not source:
self.wait_for_ready_state_complete()
source... | def get_beautiful_soup(self, source=None):
""" BeautifulSoup is a toolkit for dissecting an HTML document
and extracting what you need. It's great for screen-scraping! """
from bs4 import BeautifulSoup
if not source:
self.wait_for_ready_state_complete()
source... | [
"BeautifulSoup",
"is",
"a",
"toolkit",
"for",
"dissecting",
"an",
"HTML",
"document",
"and",
"extracting",
"what",
"you",
"need",
".",
"It",
"s",
"great",
"for",
"screen",
"-",
"scraping!"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1615-L1623 | [
"def",
"get_beautiful_soup",
"(",
"self",
",",
"source",
"=",
"None",
")",
":",
"from",
"bs4",
"import",
"BeautifulSoup",
"if",
"not",
"source",
":",
"self",
".",
"wait_for_ready_state_complete",
"(",
")",
"source",
"=",
"self",
".",
"get_page_source",
"(",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_unique_links | Get all unique links in the html of the page source.
Page links include those obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". | seleniumbase/fixtures/base_case.py | def get_unique_links(self):
""" Get all unique links in the html of the page source.
Page links include those obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". """
page_url = self.get_current_url()
soup = self.get_beautiful_soup(self.get_page_... | def get_unique_links(self):
""" Get all unique links in the html of the page source.
Page links include those obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". """
page_url = self.get_current_url()
soup = self.get_beautiful_soup(self.get_page_... | [
"Get",
"all",
"unique",
"links",
"in",
"the",
"html",
"of",
"the",
"page",
"source",
".",
"Page",
"links",
"include",
"those",
"obtained",
"from",
":",
"a",
"-",
">",
"href",
"img",
"-",
">",
"src",
"link",
"-",
">",
"href",
"and",
"script",
"-",
"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1625-L1632 | [
"def",
"get_unique_links",
"(",
"self",
")",
":",
"page_url",
"=",
"self",
".",
"get_current_url",
"(",
")",
"soup",
"=",
"self",
".",
"get_beautiful_soup",
"(",
"self",
".",
"get_page_source",
"(",
")",
")",
"links",
"=",
"page_utils",
".",
"_get_unique_lin... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_link_status_code | Get the status code of a link.
If the timeout is exceeded, will return a 404.
For a list of available status codes, see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes | seleniumbase/fixtures/base_case.py | def get_link_status_code(self, link, allow_redirects=False, timeout=5):
""" Get the status code of a link.
If the timeout is exceeded, will return a 404.
For a list of available status codes, see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes """
status_code... | def get_link_status_code(self, link, allow_redirects=False, timeout=5):
""" Get the status code of a link.
If the timeout is exceeded, will return a 404.
For a list of available status codes, see:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes """
status_code... | [
"Get",
"the",
"status",
"code",
"of",
"a",
"link",
".",
"If",
"the",
"timeout",
"is",
"exceeded",
"will",
"return",
"a",
"404",
".",
"For",
"a",
"list",
"of",
"available",
"status",
"codes",
"see",
":",
"https",
":",
"//",
"en",
".",
"wikipedia",
"."... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1634-L1641 | [
"def",
"get_link_status_code",
"(",
"self",
",",
"link",
",",
"allow_redirects",
"=",
"False",
",",
"timeout",
"=",
"5",
")",
":",
"status_code",
"=",
"page_utils",
".",
"_get_link_status_code",
"(",
"link",
",",
"allow_redirects",
"=",
"allow_redirects",
",",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_no_404_errors | Assert no 404 errors from page links obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". | seleniumbase/fixtures/base_case.py | def assert_no_404_errors(self, multithreaded=True):
""" Assert no 404 errors from page links obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". """
links = self.get_unique_links()
if multithreaded:
from multiprocessing.dummy import Pool as Thre... | def assert_no_404_errors(self, multithreaded=True):
""" Assert no 404 errors from page links obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". """
links = self.get_unique_links()
if multithreaded:
from multiprocessing.dummy import Pool as Thre... | [
"Assert",
"no",
"404",
"errors",
"from",
"page",
"links",
"obtained",
"from",
":",
"a",
"-",
">",
"href",
"img",
"-",
">",
"src",
"link",
"-",
">",
"href",
"and",
"script",
"-",
">",
"src",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1648-L1660 | [
"def",
"assert_no_404_errors",
"(",
"self",
",",
"multithreaded",
"=",
"True",
")",
":",
"links",
"=",
"self",
".",
"get_unique_links",
"(",
")",
"if",
"multithreaded",
":",
"from",
"multiprocessing",
".",
"dummy",
"import",
"Pool",
"as",
"ThreadPool",
"pool",... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.print_unique_links_with_status_codes | Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href", "img"->"src", "link"->"href", and "script"->"src". | seleniumbase/fixtures/base_case.py | def print_unique_links_with_status_codes(self):
""" Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href",... | def print_unique_links_with_status_codes(self):
""" Finds all unique links in the html of the page source
and then prints out those links with their status codes.
Format: ["link" -> "status_code"] (per line)
Page links include those obtained from:
"a"->"href",... | [
"Finds",
"all",
"unique",
"links",
"in",
"the",
"html",
"of",
"the",
"page",
"source",
"and",
"then",
"prints",
"out",
"those",
"links",
"with",
"their",
"status",
"codes",
".",
"Format",
":",
"[",
"link",
"-",
">",
"status_code",
"]",
"(",
"per",
"lin... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1662-L1670 | [
"def",
"print_unique_links_with_status_codes",
"(",
"self",
")",
":",
"page_url",
"=",
"self",
".",
"get_current_url",
"(",
")",
"soup",
"=",
"self",
".",
"get_beautiful_soup",
"(",
"self",
".",
"get_page_source",
"(",
")",
")",
"page_utils",
".",
"_print_unique... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.safe_execute_script | When executing a script that contains a jQuery command,
it's important that the jQuery library has been loaded first.
This method will load jQuery if it wasn't already loaded. | seleniumbase/fixtures/base_case.py | def safe_execute_script(self, script):
""" When executing a script that contains a jQuery command,
it's important that the jQuery library has been loaded first.
This method will load jQuery if it wasn't already loaded. """
try:
self.execute_script(script)
exce... | def safe_execute_script(self, script):
""" When executing a script that contains a jQuery command,
it's important that the jQuery library has been loaded first.
This method will load jQuery if it wasn't already loaded. """
try:
self.execute_script(script)
exce... | [
"When",
"executing",
"a",
"script",
"that",
"contains",
"a",
"jQuery",
"command",
"it",
"s",
"important",
"that",
"the",
"jQuery",
"library",
"has",
"been",
"loaded",
"first",
".",
"This",
"method",
"will",
"load",
"jQuery",
"if",
"it",
"wasn",
"t",
"alrea... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1672-L1681 | [
"def",
"safe_execute_script",
"(",
"self",
",",
"script",
")",
":",
"try",
":",
"self",
".",
"execute_script",
"(",
"script",
")",
"except",
"Exception",
":",
"# The likely reason this fails is because: \"jQuery is not defined\"",
"self",
".",
"activate_jquery",
"(",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.create_folder | Creates a folder of the given name if it doesn't already exist. | seleniumbase/fixtures/base_case.py | def create_folder(self, folder):
""" Creates a folder of the given name if it doesn't already exist. """
if folder.endswith("/"):
folder = folder[:-1]
if len(folder) < 1:
raise Exception("Minimum folder name length = 1.")
if not os.path.exists(folder):
... | def create_folder(self, folder):
""" Creates a folder of the given name if it doesn't already exist. """
if folder.endswith("/"):
folder = folder[:-1]
if len(folder) < 1:
raise Exception("Minimum folder name length = 1.")
if not os.path.exists(folder):
... | [
"Creates",
"a",
"folder",
"of",
"the",
"given",
"name",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1683-L1693 | [
"def",
"create_folder",
"(",
"self",
",",
"folder",
")",
":",
"if",
"folder",
".",
"endswith",
"(",
"\"/\"",
")",
":",
"folder",
"=",
"folder",
"[",
":",
"-",
"1",
"]",
"if",
"len",
"(",
"folder",
")",
"<",
"1",
":",
"raise",
"Exception",
"(",
"\... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.save_element_as_image_file | Take a screenshot of an element and save it as an image file.
If no folder is specified, will save it to the current folder. | seleniumbase/fixtures/base_case.py | def save_element_as_image_file(self, selector, file_name, folder=None):
""" Take a screenshot of an element and save it as an image file.
If no folder is specified, will save it to the current folder. """
element = self.find_element(selector)
element_png = element.screenshot_as_png
... | def save_element_as_image_file(self, selector, file_name, folder=None):
""" Take a screenshot of an element and save it as an image file.
If no folder is specified, will save it to the current folder. """
element = self.find_element(selector)
element_png = element.screenshot_as_png
... | [
"Take",
"a",
"screenshot",
"of",
"an",
"element",
"and",
"save",
"it",
"as",
"an",
"image",
"file",
".",
"If",
"no",
"folder",
"is",
"specified",
"will",
"save",
"it",
"to",
"the",
"current",
"folder",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1695-L1714 | [
"def",
"save_element_as_image_file",
"(",
"self",
",",
"selector",
",",
"file_name",
",",
"folder",
"=",
"None",
")",
":",
"element",
"=",
"self",
".",
"find_element",
"(",
"selector",
")",
"element_png",
"=",
"element",
".",
"screenshot_as_png",
"if",
"len",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.download_file | Downloads the file from the url to the destination folder.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") | seleniumbase/fixtures/base_case.py | def download_file(self, file_url, destination_folder=None):
""" Downloads the file from the url to the destination folder.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") """
if not destination_folder:
... | def download_file(self, file_url, destination_folder=None):
""" Downloads the file from the url to the destination folder.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") """
if not destination_folder:
... | [
"Downloads",
"the",
"file",
"from",
"the",
"url",
"to",
"the",
"destination",
"folder",
".",
"If",
"no",
"destination",
"folder",
"is",
"specified",
"the",
"default",
"one",
"is",
"used",
".",
"(",
"The",
"default",
"downloads",
"folder",
"=",
".",
"/",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1716-L1722 | [
"def",
"download_file",
"(",
"self",
",",
"file_url",
",",
"destination_folder",
"=",
"None",
")",
":",
"if",
"not",
"destination_folder",
":",
"destination_folder",
"=",
"constants",
".",
"Files",
".",
"DOWNLOADS_FOLDER",
"page_utils",
".",
"_download_file_to",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.save_file_as | Similar to self.download_file(), except that you get to rename the
file being downloaded to whatever you want. | seleniumbase/fixtures/base_case.py | def save_file_as(self, file_url, new_file_name, destination_folder=None):
""" Similar to self.download_file(), except that you get to rename the
file being downloaded to whatever you want. """
if not destination_folder:
destination_folder = constants.Files.DOWNLOADS_FOLDER
... | def save_file_as(self, file_url, new_file_name, destination_folder=None):
""" Similar to self.download_file(), except that you get to rename the
file being downloaded to whatever you want. """
if not destination_folder:
destination_folder = constants.Files.DOWNLOADS_FOLDER
... | [
"Similar",
"to",
"self",
".",
"download_file",
"()",
"except",
"that",
"you",
"get",
"to",
"rename",
"the",
"file",
"being",
"downloaded",
"to",
"whatever",
"you",
"want",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1724-L1730 | [
"def",
"save_file_as",
"(",
"self",
",",
"file_url",
",",
"new_file_name",
",",
"destination_folder",
"=",
"None",
")",
":",
"if",
"not",
"destination_folder",
":",
"destination_folder",
"=",
"constants",
".",
"Files",
".",
"DOWNLOADS_FOLDER",
"page_utils",
".",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.save_data_as | Saves the data specified to a file of the name specified.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") | seleniumbase/fixtures/base_case.py | def save_data_as(self, data, file_name, destination_folder=None):
""" Saves the data specified to a file of the name specified.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") """
if not destination_folder:
... | def save_data_as(self, data, file_name, destination_folder=None):
""" Saves the data specified to a file of the name specified.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") """
if not destination_folder:
... | [
"Saves",
"the",
"data",
"specified",
"to",
"a",
"file",
"of",
"the",
"name",
"specified",
".",
"If",
"no",
"destination",
"folder",
"is",
"specified",
"the",
"default",
"one",
"is",
"used",
".",
"(",
"The",
"default",
"downloads",
"folder",
"=",
".",
"/"... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1732-L1738 | [
"def",
"save_data_as",
"(",
"self",
",",
"data",
",",
"file_name",
",",
"destination_folder",
"=",
"None",
")",
":",
"if",
"not",
"destination_folder",
":",
"destination_folder",
"=",
"constants",
".",
"Files",
".",
"DOWNLOADS_FOLDER",
"page_utils",
".",
"_save_... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.assert_no_js_errors | Asserts that there are no JavaScript "SEVERE"-level page errors.
Works ONLY for Chrome (non-headless) and Chrome-based browsers.
Does NOT work on Firefox, Edge, IE, and some other browsers:
* See https://github.com/SeleniumHQ/selenium/issues/1161
Based on the followin... | seleniumbase/fixtures/base_case.py | def assert_no_js_errors(self):
""" Asserts that there are no JavaScript "SEVERE"-level page errors.
Works ONLY for Chrome (non-headless) and Chrome-based browsers.
Does NOT work on Firefox, Edge, IE, and some other browsers:
* See https://github.com/SeleniumHQ/selenium/is... | def assert_no_js_errors(self):
""" Asserts that there are no JavaScript "SEVERE"-level page errors.
Works ONLY for Chrome (non-headless) and Chrome-based browsers.
Does NOT work on Firefox, Edge, IE, and some other browsers:
* See https://github.com/SeleniumHQ/selenium/is... | [
"Asserts",
"that",
"there",
"are",
"no",
"JavaScript",
"SEVERE",
"-",
"level",
"page",
"errors",
".",
"Works",
"ONLY",
"for",
"Chrome",
"(",
"non",
"-",
"headless",
")",
"and",
"Chrome",
"-",
"based",
"browsers",
".",
"Does",
"NOT",
"work",
"on",
"Firefo... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1769-L1792 | [
"def",
"assert_no_js_errors",
"(",
"self",
")",
":",
"try",
":",
"browser_logs",
"=",
"self",
".",
"driver",
".",
"get_log",
"(",
"'browser'",
")",
"except",
"(",
"ValueError",
",",
"WebDriverException",
")",
":",
"# If unable to get browser logs, skip the assert an... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.get_google_auth_password | Returns a time-based one-time password based on the
Google Authenticator password algorithm. Works with Authy.
If "totp_key" is not specified, defaults to using the one
provided in seleniumbase/config/settings.py
Google Auth passwords expire and change at 30-second interv... | seleniumbase/fixtures/base_case.py | def get_google_auth_password(self, totp_key=None):
""" Returns a time-based one-time password based on the
Google Authenticator password algorithm. Works with Authy.
If "totp_key" is not specified, defaults to using the one
provided in seleniumbase/config/settings.py
... | def get_google_auth_password(self, totp_key=None):
""" Returns a time-based one-time password based on the
Google Authenticator password algorithm. Works with Authy.
If "totp_key" is not specified, defaults to using the one
provided in seleniumbase/config/settings.py
... | [
"Returns",
"a",
"time",
"-",
"based",
"one",
"-",
"time",
"password",
"based",
"on",
"the",
"Google",
"Authenticator",
"password",
"algorithm",
".",
"Works",
"with",
"Authy",
".",
"If",
"totp_key",
"is",
"not",
"specified",
"defaults",
"to",
"using",
"the",
... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1794-L1820 | [
"def",
"get_google_auth_password",
"(",
"self",
",",
"totp_key",
"=",
"None",
")",
":",
"import",
"pyotp",
"if",
"not",
"totp_key",
":",
"totp_key",
"=",
"settings",
".",
"TOTP_KEY",
"epoch_interval",
"=",
"time",
".",
"time",
"(",
")",
"/",
"30.0",
"cycle... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.convert_to_css_selector | This method converts a selector to a CSS_SELECTOR.
jQuery commands require a CSS_SELECTOR for finding elements.
This method should only be used for jQuery/JavaScript actions.
Pure JavaScript doesn't support using a:contains("LINK_TEXT"). | seleniumbase/fixtures/base_case.py | def convert_to_css_selector(self, selector, by):
""" This method converts a selector to a CSS_SELECTOR.
jQuery commands require a CSS_SELECTOR for finding elements.
This method should only be used for jQuery/JavaScript actions.
Pure JavaScript doesn't support using a:contains... | def convert_to_css_selector(self, selector, by):
""" This method converts a selector to a CSS_SELECTOR.
jQuery commands require a CSS_SELECTOR for finding elements.
This method should only be used for jQuery/JavaScript actions.
Pure JavaScript doesn't support using a:contains... | [
"This",
"method",
"converts",
"a",
"selector",
"to",
"a",
"CSS_SELECTOR",
".",
"jQuery",
"commands",
"require",
"a",
"CSS_SELECTOR",
"for",
"finding",
"elements",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"for",
"jQuery",
"/",
"JavaScript",
"actio... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1825-L1849 | [
"def",
"convert_to_css_selector",
"(",
"self",
",",
"selector",
",",
"by",
")",
":",
"if",
"by",
"==",
"By",
".",
"CSS_SELECTOR",
":",
"return",
"selector",
"elif",
"by",
"==",
"By",
".",
"ID",
":",
"return",
"'#%s'",
"%",
"selector",
"elif",
"by",
"==... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.set_value | This method uses JavaScript to update a text field. | seleniumbase/fixtures/base_case.py | def set_value(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" This method uses JavaScript to update a text field. """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
if p... | def set_value(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" This method uses JavaScript to update a text field. """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
if p... | [
"This",
"method",
"uses",
"JavaScript",
"to",
"update",
"a",
"text",
"field",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1851-L1876 | [
"def",
"set_value",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
"."... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.js_update_text | Same as self.set_value() | seleniumbase/fixtures/base_case.py | def js_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Same as self.set_value() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
self.set_value(
... | def js_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" Same as self.set_value() """
if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
self.set_value(
... | [
"Same",
"as",
"self",
".",
"set_value",
"()"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1878-L1884 | [
"def",
"js_update_text",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"settings",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.jquery_update_text_value | This method uses jQuery to update a text field.
If the new_value string ends with the newline character,
WebDriver will finish the call, which simulates pressing
{Enter/Return} after the text is entered. | seleniumbase/fixtures/base_case.py | def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" This method uses jQuery to update a text field.
If the new_value string ends with the newline character,
WebDriver will finish the call, which... | def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" This method uses jQuery to update a text field.
If the new_value string ends with the newline character,
WebDriver will finish the call, which... | [
"This",
"method",
"uses",
"jQuery",
"to",
"update",
"a",
"text",
"field",
".",
"If",
"the",
"new_value",
"string",
"ends",
"with",
"the",
"newline",
"character",
"WebDriver",
"will",
"finish",
"the",
"call",
"which",
"simulates",
"pressing",
"{",
"Enter",
"/... | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1886-L1910 | [
"def",
"jquery_update_text_value",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"s... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.jquery_update_text | The shorter version of self.jquery_update_text_value()
(The longer version remains for backwards compatibility.) | seleniumbase/fixtures/base_case.py | def jquery_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of self.jquery_update_text_value()
(The longer version remains for backwards compatibility.) """
if self.timeout_multiplier and timeout ==... | def jquery_update_text(self, selector, new_value, by=By.CSS_SELECTOR,
timeout=settings.LARGE_TIMEOUT):
""" The shorter version of self.jquery_update_text_value()
(The longer version remains for backwards compatibility.) """
if self.timeout_multiplier and timeout ==... | [
"The",
"shorter",
"version",
"of",
"self",
".",
"jquery_update_text_value",
"()",
"(",
"The",
"longer",
"version",
"remains",
"for",
"backwards",
"compatibility",
".",
")"
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1912-L1919 | [
"def",
"jquery_update_text",
"(",
"self",
",",
"selector",
",",
"new_value",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
"==",
"setting... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.__select_option | Selects an HTML <select> option by specification.
Option specifications are by "text", "index", or "value".
Defaults to "text" if option_by is unspecified or unknown. | seleniumbase/fixtures/base_case.py | def __select_option(self, dropdown_selector, option,
dropdown_by=By.CSS_SELECTOR, option_by="text",
timeout=settings.SMALL_TIMEOUT):
""" Selects an HTML <select> option by specification.
Option specifications are by "text", "index", or "value".
... | def __select_option(self, dropdown_selector, option,
dropdown_by=By.CSS_SELECTOR, option_by="text",
timeout=settings.SMALL_TIMEOUT):
""" Selects an HTML <select> option by specification.
Option specifications are by "text", "index", or "value".
... | [
"Selects",
"an",
"HTML",
"<select",
">",
"option",
"by",
"specification",
".",
"Option",
"specifications",
"are",
"by",
"text",
"index",
"or",
"value",
".",
"Defaults",
"to",
"text",
"if",
"option_by",
"is",
"unspecified",
"or",
"unknown",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L1969-L2005 | [
"def",
"__select_option",
"(",
"self",
",",
"dropdown_selector",
",",
"option",
",",
"dropdown_by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"option_by",
"=",
"\"text\"",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"page_utils",
".",
"... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
train | BaseCase.select_option_by_text | Selects an HTML <select> option by option text.
@Params
dropdown_selector - the <select> selector
option - the text of the option | seleniumbase/fixtures/base_case.py | def select_option_by_text(self, dropdown_selector, option,
dropdown_by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Selects an HTML <select> option by option text.
@Params
dropdown_selector - the <select> selector
... | def select_option_by_text(self, dropdown_selector, option,
dropdown_by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
""" Selects an HTML <select> option by option text.
@Params
dropdown_selector - the <select> selector
... | [
"Selects",
"an",
"HTML",
"<select",
">",
"option",
"by",
"option",
"text",
"."
] | seleniumbase/SeleniumBase | python | https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2007-L2018 | [
"def",
"select_option_by_text",
"(",
"self",
",",
"dropdown_selector",
",",
"option",
",",
"dropdown_by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
")",
":",
"if",
"self",
".",
"timeout_multiplier",
"and",
"timeout",
... | 62e5b43ee1f90a9ed923841bdd53b1b38358f43a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.