_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q254100 | CCDr.create_graph_from_data | validation | def create_graph_from_data(self, data, **kwargs):
"""Apply causal discovery on observational data using CCDr.
Args:
data (pandas.DataFrame): DataFrame containing the data
Returns:
networkx.DiGraph: Solution given by the CCDR algorithm.
"""
# Building set... | python | {
"resource": ""
} |
q254101 | AcyclicGraphGenerator.to_csv | validation | def to_csv(self, fname_radical, **kwargs):
"""
Save data to the csv format by default, in two separate files.
Optional keyword arguments can be passed to pandas.
"""
if self.data is not None:
self.data.to_csv(fname_radical+'_data.csv', index=False, **kwargs)
... | python | {
"resource": ""
} |
q254102 | launch_R_script | validation | def launch_R_script(template, arguments, output_function=None,
verbose=True, debug=False):
"""Launch an R script, starting from a template and replacing text in file
before execution.
Args:
template (str): path to the template of the R script
arguments (dict): Arguments ... | python | {
"resource": ""
} |
q254103 | DefaultRPackages.check_R_package | validation | def check_R_package(self, package):
"""Execute a subprocess to check the package's availability.
Args:
package (str): Name of the package to be tested.
Returns:
| python | {
"resource": ""
} |
q254104 | AdjMI.predict | validation | def predict(self, a, b, **kwargs):
"""Perform the independence test.
:param a: input data
:param b: input data
:type a: array-like, numerical data
:type b: array-like, numerical data
:return: dependency statistic (1=Highly dependent, 0=Not dependent)
:rtype: floa... | python | {
"resource": ""
} |
q254105 | GraphModel.predict | validation | def predict(self, df_data, graph=None, **kwargs):
"""Orient a graph using the method defined by the arguments.
Depending on the type of `graph`, this function process to execute
different functions:
1. If ``graph`` is a ``networkx.DiGraph``, then ``self.orient_directed_graph`` is execu... | python | {
"resource": ""
} |
q254106 | graph_evaluation | validation | def graph_evaluation(data, adj_matrix, gpu=None, gpu_id=0, **kwargs):
"""Evaluate a graph taking account of the hardware."""
gpu = SETTINGS.get_default(gpu=gpu)
device = 'cuda:{}'.format(gpu_id) if gpu else 'cpu'
obs = th.FloatTensor(data).to(device) | python | {
"resource": ""
} |
q254107 | parallel_graph_evaluation | validation | def parallel_graph_evaluation(data, adj_matrix, nb_runs=16,
nb_jobs=None, **kwargs):
"""Parallelize the various runs of CGNN to evaluate a graph."""
nb_jobs = SETTINGS.get_default(nb_jobs=nb_jobs)
if nb_runs == 1:
return graph_evaluation(data, adj_matrix, **kwargs)
... | python | {
"resource": ""
} |
q254108 | CGNN_model.forward | validation | def forward(self):
"""Generate according to the topological order of the graph."""
self.noise.data.normal_()
if not self.confounding:
for i in self.topological_order:
self.generated[i] = self.blocks[i](th.cat([v for c in [
... | python | {
"resource": ""
} |
q254109 | CGNN_model.run | validation | def run(self, data, train_epochs=1000, test_epochs=1000, verbose=None,
idx=0, lr=0.01, **kwargs):
"""Run the CGNN on a given graph."""
verbose = SETTINGS.get_default(verbose=verbose)
optim = th.optim.Adam(self.parameters(), lr=lr)
self.score.zero_()
with trange(train_... | python | {
"resource": ""
} |
q254110 | CGNN.create_graph_from_data | validation | def create_graph_from_data(self, data):
"""Use CGNN to create a graph from scratch. All the possible structures
are tested, which leads to a super exponential complexity. It would be
preferable to start from a graph skeleton for large graphs.
Args:
data (pandas.DataFrame): O... | python | {
"resource": ""
} |
q254111 | CGNN.orient_directed_graph | validation | def orient_directed_graph(self, data, dag, alg='HC'):
"""Modify and improve a directed acyclic graph solution using CGNN.
Args:
data (pandas.DataFrame): Observational data on which causal
discovery has to be performed.
dag (nx.DiGraph): Graph that provides the ini... | python | {
"resource": ""
} |
q254112 | CGNN.orient_undirected_graph | validation | def orient_undirected_graph(self, data, umg, alg='HC'):
"""Orient the undirected graph using GNN and apply CGNN to improve the graph.
Args:
data (pandas.DataFrame): Observational data on which causal
discovery has to be performed.
umg (nx.Graph): Graph that provid... | python | {
"resource": ""
} |
q254113 | eval_entropy | validation | def eval_entropy(x):
"""Evaluate the entropy of the input variable.
:param x: input variable 1D
:return: entropy of x
"""
hx = 0.
sx = sorted(x)
for i, j in zip(sx[:-1], sx[1:]):
delta = j-i
| python | {
"resource": ""
} |
q254114 | integral_approx_estimator | validation | def integral_approx_estimator(x, y):
"""Integral approximation estimator for causal inference.
:param x: input variable x 1D
:param y: input variable y 1D
:return: Return value of the IGCI model >0 if x->y otherwise if return <0
"""
a, b = (0., 0.)
x = np.array(x)
y = np.array(y)
id... | python | {
"resource": ""
} |
q254115 | IGCI.predict_proba | validation | def predict_proba(self, a, b, **kwargs):
"""Evaluate a pair using the IGCI model.
:param a: Input variable 1D
:param b: Input variable 1D
:param kwargs: {refMeasure: Scaling method (gaussian, integral or None),
estimator: method used to evaluate the pairs (entrop... | python | {
"resource": ""
} |
q254116 | RCC.featurize_row | validation | def featurize_row(self, x, y):
""" Projects the causal pair to the RKHS using the sampled kernel approximation.
Args:
x (np.ndarray): Variable 1
y (np.ndarray): Variable 2
Returns:
np.ndarray: projected empirical distributions into a single fixed-size vector... | python | {
"resource": ""
} |
q254117 | RCC.fit | validation | def fit(self, x, y):
"""Train the model.
Args:
x_tr (pd.DataFrame): CEPC format dataframe containing the pairs
y_tr (pd.DataFrame or np.ndarray): labels associated to the pairs
"""
train = np.vstack((np.array([self.featurize_row(row.iloc[0],
... | python | {
"resource": ""
} |
q254118 | RCC.predict_proba | validation | def predict_proba(self, x, y=None, **kwargs):
""" Predict the causal score using a trained RCC model
Args:
x (numpy.array or pandas.DataFrame or pandas.Series): First variable or dataset.
args (numpy.array): second variable (optional depending on the 1st argument).
Retu... | python | {
"resource": ""
} |
q254119 | FSGNN.predict_features | validation | def predict_features(self, df_features, df_target, nh=20, idx=0, dropout=0.,
activation_function=th.nn.ReLU, lr=0.01, l1=0.1, batch_size=-1,
train_epochs=1000, test_epochs=1000, device=None,
verbose=None, nb_runs=3):
"""For one variable... | python | {
"resource": ""
} |
q254120 | IndependenceModel.predict_undirected_graph | validation | def predict_undirected_graph(self, data):
"""Build a skeleton using a pairwise independence criterion.
Args:
data (pandas.DataFrame): Raw data table
Returns:
networkx.Graph: Undirected graph representing the skeleton.
"""
graph = Graph()
for idx... | python | {
"resource": ""
} |
q254121 | FeatureSelectionModel.predict | validation | def predict(self, df_data, threshold=0.05, **kwargs):
"""Predict the skeleton of the graph from raw data.
Returns iteratively the feature selection algorithm on each node.
Args:
df_data (pandas.DataFrame): data to construct a graph from
threshold (float): cutoff value f... | python | {
"resource": ""
} |
q254122 | GIES.orient_undirected_graph | validation | def orient_undirected_graph(self, data, graph):
"""Run GIES on an undirected graph.
Args:
data (pandas.DataFrame): DataFrame containing the data
graph (networkx.Graph): Skeleton of the graph to orient
Returns:
networkx.DiGraph: Solution given by the GIES alg... | python | {
"resource": ""
} |
q254123 | GIES.create_graph_from_data | validation | def create_graph_from_data(self, data):
"""Run the GIES algorithm.
Args:
data (pandas.DataFrame): DataFrame containing the data
Returns:
networkx.DiGraph: Solution given by the GIES algorithm.
"""
# Building setup w/ arguments.
self.arguments['{S... | python | {
"resource": ""
} |
q254124 | GIES._run_gies | validation | def _run_gies(self, data, fixedGaps=None, verbose=True):
"""Setting up and running GIES with all arguments."""
# Run gies
id = str(uuid.uuid4())
os.makedirs('/tmp/cdt_gies' + id + '/')
self.arguments['{FOLDER}'] = '/tmp/cdt_gies' + id + '/'
def retrieve_result():
... | python | {
"resource": ""
} |
q254125 | plot_curves | validation | def plot_curves(i_batch, adv_loss, gen_loss, l1_reg, cols):
"""Plot SAM's various losses."""
from matplotlib import pyplot as plt
if i_batch == 0:
try:
ax.clear()
ax.plot(range(len(adv_plt)), adv_plt, "r-",
linewidth=1.5, markersize=4,
... | python | {
"resource": ""
} |
q254126 | plot_gen | validation | def plot_gen(epoch, batch, generated_variables, pairs_to_plot=[[0, 1]]):
"""Plot generated pairs of variables."""
from matplotlib import pyplot as plt
if epoch == 0:
plt.ion()
plt.clf()
for (i, j) in pairs_to_plot:
plt.scatter(generated_variables[i].data.cpu().numpy(
), batc... | python | {
"resource": ""
} |
q254127 | CNormalized_Linear.reset_parameters | validation | def reset_parameters(self):
"""Reset the parameters."""
stdv = 1. / math.sqrt(self.weight.size(1))
self.weight.data.uniform_(-stdv, stdv)
| python | {
"resource": ""
} |
q254128 | CNormalized_Linear.forward | validation | def forward(self, input):
"""Feed-forward through the network."""
return | python | {
"resource": ""
} |
q254129 | SAM.predict | validation | def predict(self, data, graph=None, nruns=6, njobs=None, gpus=0, verbose=None,
plot=False, plot_generated_pair=False, return_list_results=False):
"""Execute SAM on a dataset given a skeleton or not.
Args:
data (pandas.DataFrame): Observational data for estimation of causal r... | python | {
"resource": ""
} |
q254130 | RECI.predict_proba | validation | def predict_proba(self, a, b, **kwargs):
""" Infer causal relationships between 2 variables using the RECI statistic
:param a: Input variable 1 | python | {
"resource": ""
} |
q254131 | RECI.b_fit_score | validation | def b_fit_score(self, x, y):
""" Compute the RECI fit score
Args:
x (numpy.ndarray): Variable 1
y (numpy.ndarray): Variable 2
Returns:
float: RECI fit score
"""
x = np.reshape(minmax_scale(x), (-1, 1))
y = np.reshape(minmax_scale(y),... | python | {
"resource": ""
} |
q254132 | CDS.predict_proba | validation | def predict_proba(self, a, b, **kwargs):
""" Infer causal relationships between 2 variables using the CDS statistic
Args:
a (numpy.ndarray): Variable 1
b (numpy.ndarray): Variable 2
Returns:
| python | {
"resource": ""
} |
q254133 | ANM.predict_proba | validation | def predict_proba(self, a, b, **kwargs):
"""Prediction method for pairwise causal inference using the ANM model.
Args:
a (numpy.ndarray): Variable 1
b (numpy.ndarray): Variable 2
Returns:
float: Causation score | python | {
"resource": ""
} |
q254134 | ANM.anm_score | validation | def anm_score(self, x, y):
"""Compute the fitness score of the ANM model in the x->y direction.
Args:
a (numpy.ndarray): Variable seen as cause
b (numpy.ndarray): Variable seen as effect
Returns:
float: ANM fit score
| python | {
"resource": ""
} |
q254135 | PC.orient_undirected_graph | validation | def orient_undirected_graph(self, data, graph, **kwargs):
"""Run PC on an undirected graph.
Args:
data (pandas.DataFrame): DataFrame containing the data
graph (networkx.Graph): Skeleton of the graph to orient
Returns:
networkx.DiGraph: Solution given by PC o... | python | {
"resource": ""
} |
q254136 | PC.create_graph_from_data | validation | def create_graph_from_data(self, data, **kwargs):
"""Run the PC algorithm.
Args:
data (pandas.DataFrame): DataFrame containing the data
Returns:
networkx.DiGraph: Solution given by PC on the given data.
"""
# Building setup w/ arguments.
self.argu... | python | {
"resource": ""
} |
q254137 | PC._run_pc | validation | def _run_pc(self, data, fixedEdges=None, fixedGaps=None, verbose=True):
"""Setting up and running pc with all arguments."""
# Checking coherence of arguments
# print(self.arguments)
if (self.arguments['{CITEST}'] == self.dir_CI_test['hsic']
and self.arguments['{METHOD_INDEP}']... | python | {
"resource": ""
} |
q254138 | Glasso.predict | validation | def predict(self, data, alpha=0.01, max_iter=2000, **kwargs):
""" Predict the graph skeleton.
Args:
data (pandas.DataFrame): observational data
alpha (float): regularization parameter
max_iter (int): maximum number of iterations
Returns:
networkx... | python | {
"resource": ""
} |
q254139 | autoset_settings | validation | def autoset_settings(set_var):
"""Autoset GPU parameters using CUDA_VISIBLE_DEVICES variables.
Return default config if variable not set.
:param set_var: Variable to set. Must be of type ConfigSettings
"""
try:
devices = ast.literal_eval(os.environ["CUDA_VISIBLE_DEVICES"])
if type(d... | python | {
"resource": ""
} |
q254140 | check_cuda_devices | validation | def check_cuda_devices():
"""Output some information on CUDA-enabled devices on your computer,
including current memory usage. Modified to only get number of devices.
It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1
from C to Python with ctypes, so it can run without compilin... | python | {
"resource": ""
} |
q254141 | ConfigSettings.get_default | validation | def get_default(self, *args, **kwargs):
"""Get the default parameters as defined in the Settings instance.
This function proceeds to seamlessly retrieve the argument to pass
through, depending on either it was overidden or not: If no argument
was overridden in a function of the toolbox,... | python | {
"resource": ""
} |
q254142 | read_causal_pairs | validation | def read_causal_pairs(filename, scale=True, **kwargs):
"""Convert a ChaLearn Cause effect pairs challenge format into numpy.ndarray.
:param filename: path of the file to read or DataFrame containing the data
:type filename: str or pandas.DataFrame
:param scale: Scale the data
:type scale: bool
... | python | {
"resource": ""
} |
q254143 | MomentMatchingLoss.forward | validation | def forward(self, pred, target):
"""Compute the loss model.
:param pred: predicted Variable
:param target: Target Variable
:return: Loss
"""
loss = th.FloatTensor([0])
for i in range(1, self.moments):
| python | {
"resource": ""
} |
q254144 | PairwiseModel.predict | validation | def predict(self, x, *args, **kwargs):
"""Generic predict method, chooses which subfunction to use for a more
suited.
Depending on the type of `x` and of `*args`, this function process to execute
different functions in the priority order:
1. If ``args[0]`` is a ``networkx.(Di)G... | python | {
"resource": ""
} |
q254145 | PairwiseModel.predict_dataset | validation | def predict_dataset(self, x, **kwargs):
"""Generic dataset prediction function.
Runs the score independently on all pairs.
Args:
x (pandas.DataFrame): a CEPC format Dataframe.
kwargs (dict): additional arguments for the algorithms
Returns:
pandas.Da... | python | {
"resource": ""
} |
q254146 | PairwiseModel.orient_graph | validation | def orient_graph(self, df_data, graph, nb_runs=6, printout=None, **kwargs):
"""Orient an undirected graph using the pairwise method defined by the subclass.
The pairwise method is ran on every undirected edge.
Args:
df_data (pandas.DataFrame): Data
umg (networkx.Graph):... | python | {
"resource": ""
} |
q254147 | BNlearnAlgorithm.orient_undirected_graph | validation | def orient_undirected_graph(self, data, graph):
"""Run the algorithm on an undirected graph.
Args:
data (pandas.DataFrame): DataFrame containing the data
graph (networkx.Graph): Skeleton of the graph to orient
Returns:
networkx.DiGraph: Solution on the given... | python | {
"resource": ""
} |
q254148 | BNlearnAlgorithm.orient_directed_graph | validation | def orient_directed_graph(self, data, graph):
"""Run the algorithm on a directed_graph.
Args:
data (pandas.DataFrame): DataFrame containing the data
graph (networkx.DiGraph): Skeleton of the graph to orient
Returns:
networkx.DiGraph: Solution on the given sk... | python | {
"resource": ""
} |
q254149 | BNlearnAlgorithm.create_graph_from_data | validation | def create_graph_from_data(self, data):
"""Run the algorithm on data.
Args:
data (pandas.DataFrame): DataFrame containing the data
Returns:
networkx.DiGraph: Solution given by the algorithm.
"""
# Building setup w/ arguments.
self.arguments['{SC... | python | {
"resource": ""
} |
q254150 | computeGaussKernel | validation | def computeGaussKernel(x):
"""Compute the gaussian kernel on a | python | {
"resource": ""
} |
q254151 | normal_noise | validation | def normal_noise(points):
"""Init a noise variable."""
return np.random.rand(1) * | python | {
"resource": ""
} |
q254152 | uniform_noise | validation | def uniform_noise(points):
"""Init a uniform noise variable.""" | python | {
"resource": ""
} |
q254153 | Jarfo.predict_dataset | validation | def predict_dataset(self, df):
"""Runs Jarfo independently on all pairs.
Args:
x (pandas.DataFrame): a CEPC format Dataframe.
kwargs (dict): additional arguments for the algorithms
Returns:
pandas.DataFrame: a Dataframe with the predictions.
"""
... | python | {
"resource": ""
} |
q254154 | Jarfo.predict_proba | validation | def predict_proba(self, a, b, idx=0, **kwargs):
""" Use Jarfo to predict the causal direction of a pair of vars.
Args:
a (numpy.ndarray): Variable 1
b (numpy.ndarray): Variable 2
idx (int): (optional) index number for printing purposes
Returns:
| python | {
"resource": ""
} |
q254155 | clr | validation | def clr(M, **kwargs):
"""Implementation of the Context Likelihood or Relatedness Network algorithm.
Args:
mat (numpy.ndarray): matrix, if it is a square matrix, the program assumes
it is a relevance matrix where mat(i,j) represents the similarity content
between nodes i and j. Elements o... | python | {
"resource": ""
} |
q254156 | aracne | validation | def aracne(m, **kwargs):
"""Implementation of the ARACNE algorithm.
Args:
mat (numpy.ndarray): matrix, if it is a square matrix, the program assumes
it is a relevance matrix where mat(i,j) represents the similarity content
between nodes i and j. Elements of matrix should be
non-... | python | {
"resource": ""
} |
q254157 | remove_indirect_links | validation | def remove_indirect_links(g, alg="aracne", **kwargs):
"""Apply deconvolution to a networkx graph.
Args:
g (networkx.Graph): Graph to apply deconvolution to
alg (str): Algorithm to use ('aracne', 'clr', 'nd')
kwargs (dict): extra options for algorithms
Returns:
networkx.Graph: g... | python | {
"resource": ""
} |
q254158 | dagify_min_edge | validation | def dagify_min_edge(g):
"""Input a graph and output a DAG.
The heuristic is to reverse the edge with the lowest score of the cycle
if possible, else remove it.
Args:
g (networkx.DiGraph): Graph to modify to output a DAG
Returns:
networkx.DiGraph: DAG made out of the input graph.
... | python | {
"resource": ""
} |
q254159 | weighted_mean_and_std | validation | def weighted_mean_and_std(values, weights):
"""
Returns the weighted average and standard deviation.
values, weights -- numpy ndarrays with the same shape.
"""
average = np.average(values, weights=weights, axis=0)
| python | {
"resource": ""
} |
q254160 | GNN_instance | validation | def GNN_instance(x, idx=0, device=None, nh=20, **kwargs):
"""Run an instance of GNN, testing causal direction.
:param m: data corresponding to the config : (N, 2) data, [:, 0] cause and [:, 1] effect
:param pair_idx: print purposes
:param run: numner of the run (for GPU dispatch)
:param device: dev... | python | {
"resource": ""
} |
q254161 | GNN_model.forward | validation | def forward(self, x):
"""Pass data through the net structure.
:param x: input data: shape (:,1)
:type x: torch.Variable
:return: output of the shallow net
| python | {
"resource": ""
} |
q254162 | GNN_model.run | validation | def run(self, x, y, lr=0.01, train_epochs=1000, test_epochs=1000, idx=0, verbose=None, **kwargs):
"""Run the GNN on a pair x,y of FloatTensor data."""
verbose = SETTINGS.get_default(verbose=verbose)
optim = th.optim.Adam(self.parameters(), lr=lr)
running_loss = 0
teloss = 0
... | python | {
"resource": ""
} |
q254163 | GNN.predict_proba | validation | def predict_proba(self, a, b, nb_runs=6, nb_jobs=None, gpu=None,
idx=0, verbose=None, ttest_threshold=0.01,
nb_max_runs=16, train_epochs=1000, test_epochs=1000):
"""Run multiple times GNN to estimate the causal direction.
Args:
a (np.ndarray): Var... | python | {
"resource": ""
} |
q254164 | CAM.create_graph_from_data | validation | def create_graph_from_data(self, data, **kwargs):
"""Apply causal discovery on observational data using CAM.
Args:
data (pandas.DataFrame): DataFrame containing the data
Returns:
networkx.DiGraph: Solution given by the CAM algorithm.
"""
# Building setup... | python | {
"resource": ""
} |
q254165 | NCC_model.forward | validation | def forward(self, x):
"""Passing data through the network.
:param x: 2d tensor containing both (x,y) Variables
:return: output of the net
| python | {
"resource": ""
} |
q254166 | NCC.predict_proba | validation | def predict_proba(self, a, b, device=None):
"""Infer causal directions using the trained NCC pairwise model.
Args:
a (numpy.ndarray): Variable 1
b (numpy.ndarray): Variable 2
device (str): Device to run the algorithm on (defaults to ``cdt.SETTINGS.default_device``)
... | python | {
"resource": ""
} |
q254167 | VisualDirective.phrase_to_filename | validation | def phrase_to_filename(self, phrase):
"""Convert phrase to normilized file name."""
# remove non-word characters
name = re.sub(r"[^\w\s\.]", '', phrase.strip().lower())
| python | {
"resource": ""
} |
q254168 | Page.seed_url | validation | def seed_url(self):
"""A URL that can be used to open the page.
The URL is formatted from :py:attr:`URL_TEMPLATE`, which is then
appended to :py:attr:`base_url` unless the template results in an
absolute URL.
:return: URL that can be used to open the page.
:rtype: str
... | python | {
"resource": ""
} |
q254169 | Page.open | validation | def open(self):
"""Open the page.
Navigates to :py:attr:`seed_url` and calls :py:func:`wait_for_page_to_load`.
:return: The current page object.
:rtype: :py:class:`Page`
:raises: UsageError
"""
if self.seed_url:
| python | {
"resource": ""
} |
q254170 | Page.wait_for_page_to_load | validation | def wait_for_page_to_load(self):
"""Wait for the page to load."""
self.wait.until(lambda _: self.loaded)
| python | {
"resource": ""
} |
q254171 | register | validation | def register():
""" Register the Selenium specific driver implementation.
This register call is performed by the init module if
selenium is available.
"""
registerDriver(
ISelenium,
Selenium,
class_implements=[
Firefox,
Chrome,
Ie,... | python | {
"resource": ""
} |
q254172 | Region.root | validation | def root(self):
"""Root element for the page region.
Page regions should define a root element either by passing this on
instantiation or by defining a :py:attr:`_root_locator` attribute. To
reduce the chances of hitting :py:class:`~selenium.common.exceptions.StaleElementReferenceExcept... | python | {
"resource": ""
} |
q254173 | Region.wait_for_region_to_load | validation | def wait_for_region_to_load(self):
"""Wait for the page region to load."""
self.wait.until(lambda _: self.loaded)
| python | {
"resource": ""
} |
q254174 | Region.find_element | validation | def find_element(self, strategy, locator):
"""Finds an element on the page.
:param strategy: Location strategy to use. See :py:class:`~selenium.webdriver.common.by.By` or :py:attr:`~pypom.splinter_driver.ALLOWED_STRATEGIES`.
:param locator: Location of target element.
:type strategy: st... | python | {
"resource": ""
} |
q254175 | Region.find_elements | validation | def find_elements(self, strategy, locator):
"""Finds elements on the page.
:param strategy: Location strategy to use. See :py:class:`~selenium.webdriver.common.by.By` or :py:attr:`~pypom.splinter_driver.ALLOWED_STRATEGIES`.
:param locator: Location of target elements.
:type strategy: st... | python | {
"resource": ""
} |
q254176 | Region.is_element_present | validation | def is_element_present(self, strategy, locator):
"""Checks whether an element is present.
:param strategy: Location strategy to use. See :py:class:`~selenium.webdriver.common.by.By` or :py:attr:`~pypom.splinter_driver.ALLOWED_STRATEGIES`.
:param locator: Location of target element.
:typ... | python | {
"resource": ""
} |
q254177 | Region.is_element_displayed | validation | def is_element_displayed(self, strategy, locator):
"""Checks whether an element is displayed.
:param strategy: Location strategy to use. See :py:class:`~selenium.webdriver.common.by.By` or :py:attr:`~pypom.splinter_driver.ALLOWED_STRATEGIES`.
:param locator: Location of target element.
... | python | {
"resource": ""
} |
q254178 | registerDriver | validation | def registerDriver(iface, driver, class_implements=[]):
""" Register driver adapter used by page object"""
| python | {
"resource": ""
} |
q254179 | Lexer.t_intnumber | validation | def t_intnumber(self, t):
r'-?\d+'
| python | {
"resource": ""
} |
q254180 | Lexer.t_stringdollar_rbrace | validation | def t_stringdollar_rbrace(self, t):
r'\}'
t.lexer.braces -= 1
if t.lexer.braces == 0:
# End | python | {
"resource": ""
} |
q254181 | Lexer.t_tabbedheredoc | validation | def t_tabbedheredoc(self, t):
r'<<-\S+\r?\n'
t.lexer.is_tabbed = True
| python | {
"resource": ""
} |
q254182 | Lexer.t_heredoc | validation | def t_heredoc(self, t):
r'<<\S+\r?\n'
t.lexer.is_tabbed = False
| python | {
"resource": ""
} |
q254183 | _pre_install | validation | def _pre_install():
'''Initialize the parse table at install time'''
# Generate the parsetab.dat file at setup time
dat = join(setup_dir, 'src', 'hcl', 'parsetab.dat')
if exists(dat):
os.unlink(dat) | python | {
"resource": ""
} |
q254184 | RobotStatements.append | validation | def append(self, linenumber, raw_text, cells):
"""Add another row | python | {
"resource": ""
} |
q254185 | RobotFactory | validation | def RobotFactory(path, parent=None):
'''Return an instance of SuiteFile, ResourceFile, SuiteFolder
Exactly which is returned depends on whether it's a file or
folder, and if a file, the contents of the file. If there is a
testcase table, this will return an instance of SuiteFile,
otherwise it will ... | python | {
"resource": ""
} |
q254186 | SuiteFolder.walk | validation | def walk(self, *types):
'''
Iterator which visits all suites and suite files,
yielding test cases and keywords
'''
requested = types if len(types) > 0 else [SuiteFile, ResourceFile, SuiteFolder, Testcase, Keyword]
for thing in self.robot_files:
if thing.__cla... | python | {
"resource": ""
} |
q254187 | RobotFile._load | validation | def _load(self, path):
'''
The general idea is to do a quick parse, creating a list of
tables. Each table is nothing more than a list of rows, with
each row being a list of cells. Additional parsing such as
combining rows into statements is done on demand. This first
pas... | python | {
"resource": ""
} |
q254188 | RobotFile.type | validation | def type(self):
'''Return 'suite' or 'resource' or None
This will return 'suite' if a testcase table is found;
It will return 'resource' if at least one robot table
is found. If no tables are found it will return None
'''
robot_tables = [table for table in self.tables i... | python | {
"resource": ""
} |
q254189 | RobotFile.keywords | validation | def keywords(self):
'''Generator which returns all keywords in the suite'''
for table in self.tables:
if isinstance(table, KeywordTable):
| python | {
"resource": ""
} |
q254190 | RobotFile.dump | validation | def dump(self):
'''Regurgitate the tables and rows'''
for table in self.tables:
| python | {
"resource": ""
} |
q254191 | SuiteFile.settings | validation | def settings(self):
'''Generator which returns all of the statements in all of the settings tables'''
for table in self.tables:
| python | {
"resource": ""
} |
q254192 | SuiteFile.variables | validation | def variables(self):
'''Generator which returns all of the statements in all of the variables tables'''
for table in self.tables:
if isinstance(table, VariableTable): | python | {
"resource": ""
} |
q254193 | SimpleTableMixin.statements | validation | def statements(self):
'''Return a list of statements
This is done by joining together any rows that
have continuations
'''
# FIXME: no need to do this every time; we should cache the
# result
if len(self.rows) == 0:
return []
current_statemen... | python | {
"resource": ""
} |
q254194 | AbstractContainerTable.append | validation | def append(self, row):
'''
The idea is, we recognize when we have a new testcase by
checking the first cell. If it's not empty and not a comment,
we have a new test case.
'''
if len(row) == 0:
# blank line. Should we throw it away, or append a BlankLine ob... | python | {
"resource": ""
} |
q254195 | Rule.report | validation | def report(self, obj, message, linenum, char_offset=0):
"""Report an error or warning"""
self.controller.report(linenumber=linenum, filename=obj.path,
severity=self.severity, message=message,
| python | {
"resource": ""
} |
q254196 | RfLint.run | validation | def run(self, args):
"""Parse command line arguments, and run rflint"""
self.args = self.parse_and_process_args(args)
if self.args.version:
print(__version__)
return 0
if self.args.rulefile:
for filename in self.args.rulefile:
... | python | {
"resource": ""
} |
q254197 | RfLint.list_rules | validation | def list_rules(self):
"""Print a list of all rules"""
for rule in sorted(self.all_rules, key=lambda rule: rule.name): | python | {
"resource": ""
} |
q254198 | RfLint.report | validation | def report(self, linenumber, filename, severity, message, rulename, char):
"""Report a rule violation"""
if self._print_filename is not None:
# we print the filename only once. self._print_filename
# will get reset each time a new file is processed.
print("+ " + self... | python | {
"resource": ""
} |
q254199 | RfLint._get_rules | validation | def _get_rules(self, cls):
"""Returns a list of rules of a given class
Rules are treated as singletons - we only instantiate each
rule once.
"""
result = []
for rule_class in cls.__subclasses__():
rule_name = rule_class.__name__.lower()
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.