Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
open_stream_to_socket_listener
(socket_listener)
Connect to the given :class:`~trio.SocketListener`. This is particularly useful in tests when you want to let a server pick its own port, and then connect to it:: listeners = await trio.open_tcp_listeners(0) client = await trio.testing.open_stream_to_socket_listener(listeners[0]) Args: ...
Connect to the given :class:`~trio.SocketListener`.
async def open_stream_to_socket_listener(socket_listener): """Connect to the given :class:`~trio.SocketListener`. This is particularly useful in tests when you want to let a server pick its own port, and then connect to it:: listeners = await trio.open_tcp_listeners(0) client = await trio....
[ "async", "def", "open_stream_to_socket_listener", "(", "socket_listener", ")", ":", "family", "=", "socket_listener", ".", "socket", ".", "family", "sockaddr", "=", "socket_listener", ".", "socket", ".", "getsockname", "(", ")", "if", "family", "in", "(", "tsock...
[ 4, 0 ]
[ 33, 29 ]
python
en
['en', 'en', 'en']
True
Compile
(logger: logging.Logger, input_text: str, cache: Optional[Cache]=None, file_checker: Optional[IRFileChecker]=None, secret_handler: Optional[SecretHandler]=None, k8s=False, envoy_version="V2")
Compile is a helper function to take a bunch of YAML and compile it into an IR and, optionally, an Envoy config. The output is a dictionary: { "ir": the IR data structure } IFF v2 is True, there will be a toplevel "v2" key whose value is the Envoy V2 config. :param input_tex...
Compile is a helper function to take a bunch of YAML and compile it into an IR and, optionally, an Envoy config.
def Compile(logger: logging.Logger, input_text: str, cache: Optional[Cache]=None, file_checker: Optional[IRFileChecker]=None, secret_handler: Optional[SecretHandler]=None, k8s=False, envoy_version="V2") -> Dict[str, Union[IR, EnvoyConfig]]: """ Compile is a helper...
[ "def", "Compile", "(", "logger", ":", "logging", ".", "Logger", ",", "input_text", ":", "str", ",", "cache", ":", "Optional", "[", "Cache", "]", "=", "None", ",", "file_checker", ":", "Optional", "[", "IRFileChecker", "]", "=", "None", ",", "secret_handl...
[ 26, 0 ]
[ 74, 14 ]
python
en
['en', 'error', 'th']
False
simple_tmle
(y, w, q0w, q1w, p, alpha=0.0001)
Calculate the ATE and variances with the simplified TMLE method. Args: y (numpy.array): an outcome vector w (numpy.array): a treatment vector q0w (numpy.array): an outcome prediction vector given no treatment q1w (numpy.array): an outcome prediction vector given treatment p ...
Calculate the ATE and variances with the simplified TMLE method.
def simple_tmle(y, w, q0w, q1w, p, alpha=0.0001): """Calculate the ATE and variances with the simplified TMLE method. Args: y (numpy.array): an outcome vector w (numpy.array): a treatment vector q0w (numpy.array): an outcome prediction vector given no treatment q1w (numpy.array)...
[ "def", "simple_tmle", "(", "y", ",", "w", ",", "q0w", ",", "q1w", ",", "p", ",", "alpha", "=", "0.0001", ")", ":", "scaler", "=", "MinMaxScaler", "(", ")", "ystar", "=", "scaler", ".", "fit_transform", "(", "y", ".", "reshape", "(", "-", "1", ","...
[ 31, 0 ]
[ 67, 69 ]
python
en
['en', 'en', 'en']
True
TMLELearner.__init__
(self, learner, ate_alpha=.05, control_name=0, cv=None, calibrate_propensity=True)
Initialize a TMLE learner. Args: learner: a model to estimate the outcome ate_alpha (float, optional): the confidence level alpha of the ATE estimate control_name (str or int, optional): the name of the control group cv (sklearn.model_selection._BaseKFold, option...
Initialize a TMLE learner.
def __init__(self, learner, ate_alpha=.05, control_name=0, cv=None, calibrate_propensity=True): """Initialize a TMLE learner. Args: learner: a model to estimate the outcome ate_alpha (float, optional): the confidence level alpha of the ATE estimate control_name (str ...
[ "def", "__init__", "(", "self", ",", "learner", ",", "ate_alpha", "=", ".05", ",", "control_name", "=", "0", ",", "cv", "=", "None", ",", "calibrate_propensity", "=", "True", ")", ":", "self", ".", "model_tau", "=", "learner", "self", ".", "ate_alpha", ...
[ 76, 4 ]
[ 89, 56 ]
python
en
['en', 'en', 'en']
True
TMLELearner.estimate_ate
(self, X, treatment, y, p, segment=None, return_ci=False)
Estimate the Average Treatment Effect (ATE). Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series): an outcome vector p (np.ndarray or pd.Series or dict): an array of prop...
Estimate the Average Treatment Effect (ATE).
def estimate_ate(self, X, treatment, y, p, segment=None, return_ci=False): """Estimate the Average Treatment Effect (ATE). Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series): a treatment vector y (np.array or pd.Series...
[ "def", "estimate_ate", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "p", ",", "segment", "=", "None", ",", "return_ci", "=", "False", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_to_np", "(", "X", ",", "treatment", ",", "y...
[ 94, 4 ]
[ 178, 64 ]
python
en
['en', 'it', 'en']
True
UpliftTreeClassifier.fit
(self, X, treatment, y)
Fit the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array...
Fit the uplift model.
def fit(self, X, treatment, y): """ Fit the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatm...
[ "def", "fit", "(", "self", ",", "X", ",", "treatment", ",", "y", ")", ":", "assert", "len", "(", "X", ")", "==", "len", "(", "y", ")", "and", "len", "(", "X", ")", "==", "len", "(", "treatment", ")", ",", "'Data length must be equal for X, treatment,...
[ 166, 4 ]
[ 203, 68 ]
python
en
['en', 'en', 'en']
True
UpliftTreeClassifier.prune
(self, X, treatment, y, minGain=0.0001, rule='maxAbsDiff')
Prune the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-...
Prune the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-...
def prune(self, X, treatment, y, minGain=0.0001, rule='maxAbsDiff'): """ Prune the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] ...
[ "def", "prune", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "minGain", "=", "0.0001", ",", "rule", "=", "'maxAbsDiff'", ")", ":", "assert", "len", "(", "X", ")", "==", "len", "(", "y", ")", "and", "len", "(", "X", ")", "==", "len", ...
[ 206, 4 ]
[ 238, 19 ]
python
en
['en', 'no', 'en']
True
UpliftTreeClassifier.pruneTree
(self, X, treatment, y, tree, rule='maxAbsDiff', minGain=0., evaluationFunction=None, notify=False, n_reg=0, parentNodeSummary=None)
Prune one single tree node in the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each u...
Prune one single tree node in the uplift model. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each u...
def pruneTree(self, X, treatment, y, tree, rule='maxAbsDiff', minGain=0., evaluationFunction=None, notify=False, n_reg=0, parentNodeSummary=None): """Prune one single tree node in the uplift model. Args ---- X : ndarray, shape = [num_samples, num_featu...
[ "def", "pruneTree", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "tree", ",", "rule", "=", "'maxAbsDiff'", ",", "minGain", "=", "0.", ",", "evaluationFunction", "=", "None", ",", "notify", "=", "False", ",", "n_reg", "=", "0", ",", "parent...
[ 240, 4 ]
[ 392, 19 ]
python
en
['en', 'fy', 'en']
True
UpliftTreeClassifier.fill
(self, X, treatment, y)
Fill the data into an existing tree. This is a higher-level function to transform the original data inputs into lower level data inputs (list of list and tree). Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the...
Fill the data into an existing tree. This is a higher-level function to transform the original data inputs into lower level data inputs (list of list and tree).
def fill(self, X, treatment, y): """ Fill the data into an existing tree. This is a higher-level function to transform the original data inputs into lower level data inputs (list of list and tree). Args ---- X : ndarray, shape = [num_samples, num_features] An...
[ "def", "fill", "(", "self", ",", "X", ",", "treatment", ",", "y", ")", ":", "assert", "len", "(", "X", ")", "==", "len", "(", "y", ")", "and", "len", "(", "X", ")", "==", "len", "(", "treatment", ")", ",", "'Data length must be equal for X, treatment...
[ 394, 4 ]
[ 415, 19 ]
python
en
['en', 'en', 'en']
True
UpliftTreeClassifier.fillTree
(self, X, treatment, y, tree)
Fill the data into an existing tree. This is a lower-level function to execute on the tree filling task. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samp...
Fill the data into an existing tree. This is a lower-level function to execute on the tree filling task.
def fillTree(self, X, treatment, y, tree): """ Fill the data into an existing tree. This is a lower-level function to execute on the tree filling task. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift mo...
[ "def", "fillTree", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "tree", ")", ":", "# Current Node Summary for Validation Data Set", "currentNodeSummary", "=", "self", ".", "tree_node_summary", "(", "treatment", ",", "y", ",", "min_samples_treatment", "=...
[ 417, 4 ]
[ 466, 19 ]
python
en
['en', 'en', 'en']
True
UpliftTreeClassifier.predict
(self, X, full_output=False)
Returns the recommended treatment group and predicted optimal probability conditional on using the recommended treatment group. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. full_outp...
Returns the recommended treatment group and predicted optimal probability conditional on using the recommended treatment group.
def predict(self, X, full_output=False): ''' Returns the recommended treatment group and predicted optimal probability conditional on using the recommended treatment group. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariate...
[ "def", "predict", "(", "self", ",", "X", ",", "full_output", "=", "False", ")", ":", "p_hat_optimal", "=", "[", "]", "treatment_optimal", "=", "[", "]", "pred_nodes", "=", "{", "}", "upliftScores", "=", "[", "]", "for", "xi", "in", "range", "(", "len...
[ 468, 4 ]
[ 511, 51 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.divideSet
(X, treatment, y, column, value)
Tree node split. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : arra...
Tree node split.
def divideSet(X, treatment, y, column, value): ''' Tree node split. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array cont...
[ "def", "divideSet", "(", "X", ",", "treatment", ",", "y", ",", "column", ",", "value", ")", ":", "# for int and float values", "if", "isinstance", "(", "value", ",", "int", ")", "or", "isinstance", "(", "value", ",", "float", ")", ":", "filt", "=", "X"...
[ 514, 4 ]
[ 542, 86 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.group_uniqueCounts
(self, treatment, y)
Count sample size by experiment group. Args ---- treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-like, shape = [num_samples] An array containing the outcome of interest for each unit. ...
Count sample size by experiment group.
def group_uniqueCounts(self, treatment, y): ''' Count sample size by experiment group. Args ---- treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-like, shape = [num_samples] An array co...
[ "def", "group_uniqueCounts", "(", "self", ",", "treatment", ",", "y", ")", ":", "results", "=", "{", "}", "for", "t", "in", "self", ".", "treatment_group", ":", "filt", "=", "treatment", "==", "t", "n_t", "=", "y", "[", "filt", "]", ".", "sum", "("...
[ 544, 4 ]
[ 566, 22 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.kl_divergence
(pk, qk)
Calculate KL Divergence for binary classification. sum(np.array(pk) * np.log(np.array(pk) / np.array(qk))) Args ---- pk : float The probability of 1 in one distribution. qk : float The probability of 1 in the other distribution. Returns...
Calculate KL Divergence for binary classification.
def kl_divergence(pk, qk): ''' Calculate KL Divergence for binary classification. sum(np.array(pk) * np.log(np.array(pk) / np.array(qk))) Args ---- pk : float The probability of 1 in one distribution. qk : float The probability of 1 in th...
[ "def", "kl_divergence", "(", "pk", ",", "qk", ")", ":", "eps", "=", "1e-6", "qk", "=", "np", ".", "clip", "(", "qk", ",", "eps", ",", "1", "-", "eps", ")", "if", "pk", "==", "0", ":", "S", "=", "-", "np", ".", "log", "(", "1", "-", "qk", ...
[ 569, 4 ]
[ 598, 16 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.evaluate_KL
(self, nodeSummary, control_name)
Calculate KL Divergence as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string The control group name. Retur...
Calculate KL Divergence as split evaluation criterion for a given node.
def evaluate_KL(self, nodeSummary, control_name): ''' Calculate KL Divergence as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_nam...
[ "def", "evaluate_KL", "(", "self", ",", "nodeSummary", ",", "control_name", ")", ":", "if", "control_name", "not", "in", "nodeSummary", ":", "return", "0", "pc", "=", "nodeSummary", "[", "control_name", "]", "[", "0", "]", "d_res", "=", "0", "for", "trea...
[ 600, 4 ]
[ 624, 20 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.evaluate_ED
(nodeSummary, control_name)
Calculate Euclidean Distance as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string The control group name. ...
Calculate Euclidean Distance as split evaluation criterion for a given node.
def evaluate_ED(nodeSummary, control_name): ''' Calculate Euclidean Distance as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name...
[ "def", "evaluate_ED", "(", "nodeSummary", ",", "control_name", ")", ":", "if", "control_name", "not", "in", "nodeSummary", ":", "return", "0", "pc", "=", "nodeSummary", "[", "control_name", "]", "[", "0", "]", "d_res", "=", "0", "for", "treatment_group", "...
[ 627, 4 ]
[ 651, 20 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.evaluate_Chi
(nodeSummary, control_name)
Calculate Chi-Square statistic as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string The control group name. Returns ...
Calculate Chi-Square statistic as split evaluation criterion for a given node.
def evaluate_Chi(nodeSummary, control_name): ''' Calculate Chi-Square statistic as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string...
[ "def", "evaluate_Chi", "(", "nodeSummary", ",", "control_name", ")", ":", "if", "control_name", "not", "in", "nodeSummary", ":", "return", "0", "pc", "=", "nodeSummary", "[", "control_name", "]", "[", "0", "]", "d_res", "=", "0", "for", "treatment_group", ...
[ 654, 4 ]
[ 678, 20 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.evaluate_DDP
(nodeSummary, control_name)
Calculate Delta P as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string The control group name. Returns -------...
Calculate Delta P as split evaluation criterion for a given node.
def evaluate_DDP(nodeSummary, control_name): ''' Calculate Delta P as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string ...
[ "def", "evaluate_DDP", "(", "nodeSummary", ",", "control_name", ")", ":", "if", "control_name", "not", "in", "nodeSummary", ":", "return", "0", "pc", "=", "nodeSummary", "[", "control_name", "]", "[", "0", "]", "d_res", "=", "0", "for", "treatment_group", ...
[ 681, 4 ]
[ 704, 20 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.evaluate_CTS
(currentNodeSummary)
Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_name : string The control group name. ...
Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node.
def evaluate_CTS(currentNodeSummary): ''' Calculate CTS (conditional treatment selection) as split evaluation criterion for a given node. Args ---- nodeSummary : dictionary The tree node summary statistics, produced by tree_node_summary() method. control_nam...
[ "def", "evaluate_CTS", "(", "currentNodeSummary", ")", ":", "mu", "=", "0.0", "# iterate treatment group", "for", "r", "in", "currentNodeSummary", ":", "mu", "=", "max", "(", "mu", ",", "currentNodeSummary", "[", "r", "]", "[", "0", "]", ")", "return", "-"...
[ 707, 4 ]
[ 727, 18 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.entropyH
(p, q=None)
Entropy Entropy calculation for normalization. Args ---- p : float The probability used in the entropy calculation. q : float, optional, (default = None) The second probability used in the entropy calculation. Returns ------- ...
Entropy
def entropyH(p, q=None): ''' Entropy Entropy calculation for normalization. Args ---- p : float The probability used in the entropy calculation. q : float, optional, (default = None) The second probability used in the entropy calculation...
[ "def", "entropyH", "(", "p", ",", "q", "=", "None", ")", ":", "if", "q", "is", "None", "and", "p", ">", "0", ":", "return", "-", "p", "*", "np", ".", "log", "(", "p", ")", "elif", "q", ">", "0", ":", "return", "-", "p", "*", "np", ".", ...
[ 730, 4 ]
[ 753, 20 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.normI
(self, currentNodeSummary, leftNodeSummary, rightNodeSummary, control_name, alpha=0.9)
Normalization factor. Args ---- currentNodeSummary : dictionary The summary statistics of the current tree node. leftNodeSummary : dictionary The summary statistics of the left tree node. rightNodeSummary : dictionary The summary st...
Normalization factor.
def normI(self, currentNodeSummary, leftNodeSummary, rightNodeSummary, control_name, alpha=0.9): ''' Normalization factor. Args ---- currentNodeSummary : dictionary The summary statistics of the current tree node. leftNodeSummary : dictionary The...
[ "def", "normI", "(", "self", ",", "currentNodeSummary", ",", "leftNodeSummary", ",", "rightNodeSummary", ",", "control_name", ",", "alpha", "=", "0.9", ")", ":", "norm_res", "=", "0", "# n_t, n_c: sample size for all treatment, and control", "# pt_a, pc_a: % of treatment ...
[ 755, 4 ]
[ 815, 23 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.tree_node_summary
(self, treatment, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None)
Tree node summary statistics. Args ---- treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-like, shape = [num_samples] An array containing the outcome of interest for each unit. min_samp...
Tree node summary statistics.
def tree_node_summary(self, treatment, y, min_samples_treatment=10, n_reg=100, parentNodeSummary=None): ''' Tree node summary statistics. Args ---- treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-...
[ "def", "tree_node_summary", "(", "self", ",", "treatment", ",", "y", ",", "min_samples_treatment", "=", "10", ",", "n_reg", "=", "100", ",", "parentNodeSummary", "=", "None", ")", ":", "# returns {treatment_group: p(1)}", "results", "=", "self", ".", "group_uniq...
[ 817, 4 ]
[ 858, 26 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.uplift_classification_results
(self, treatment, y)
Classification probability for each treatment in the tree node. Args ---- treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-like, shape = [num_samples] An array containing the outcome of intere...
Classification probability for each treatment in the tree node.
def uplift_classification_results(self, treatment, y): ''' Classification probability for each treatment in the tree node. Args ---- treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. y : array-like, shape = [...
[ "def", "uplift_classification_results", "(", "self", ",", "treatment", ",", "y", ")", ":", "results", "=", "self", ".", "group_uniqueCounts", "(", "treatment", ",", "y", ")", "res", "=", "{", "}", "for", "r", "in", "results", ":", "p", "=", "float", "(...
[ 860, 4 ]
[ 881, 18 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.growDecisionTreeFrom
(self, X, treatment, y, evaluationFunction, max_depth=10, min_samples_leaf=100, depth=1, min_samples_treatment=10, n_reg=100, parentNodeSummary=None)
Train the uplift decision tree. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each unit. ...
Train the uplift decision tree.
def growDecisionTreeFrom(self, X, treatment, y, evaluationFunction, max_depth=10, min_samples_leaf=100, depth=1, min_samples_treatment=10, n_reg=100, parentNodeSummary=None): ''' Train the uplift decision tree. ...
[ "def", "growDecisionTreeFrom", "(", "self", ",", "X", ",", "treatment", ",", "y", ",", "evaluationFunction", ",", "max_depth", "=", "10", ",", "min_samples_leaf", "=", "100", ",", "depth", "=", "1", ",", "min_samples_treatment", "=", "10", ",", "n_reg", "=...
[ 883, 4 ]
[ 1098, 17 ]
python
en
['en', 'error', 'th']
False
UpliftTreeClassifier.classify
(observations, tree, dataMissing=False)
Classifies (prediction) the observations according to the tree. Args ---- observations : list of list The internal data format for the training data (combining X, Y, treatment). dataMissing: boolean, optional (default = False) An indicator for if data a...
Classifies (prediction) the observations according to the tree.
def classify(observations, tree, dataMissing=False): ''' Classifies (prediction) the observations according to the tree. Args ---- observations : list of list The internal data format for the training data (combining X, Y, treatment). dataMissing: boolean, o...
[ "def", "classify", "(", "observations", ",", "tree", ",", "dataMissing", "=", "False", ")", ":", "def", "classifyWithoutMissingData", "(", "observations", ",", "tree", ")", ":", "'''\n Classifies (prediction) the observations according to the tree, assuming without...
[ 1101, 4 ]
[ 1201, 65 ]
python
en
['en', 'error', 'th']
False
UpliftRandomForestClassifier.__init__
(self, n_estimators=10, max_features=10, random_state=2019, max_depth=5, min_samples_leaf=100, min_samples_treatment=10, n_reg=10, evaluationFunction=None, control_nam...
Initialize the UpliftRandomForestClassifier class.
Initialize the UpliftRandomForestClassifier class.
def __init__(self, n_estimators=10, max_features=10, random_state=2019, max_depth=5, min_samples_leaf=100, min_samples_treatment=10, n_reg=10, evaluationFunction=None, ...
[ "def", "__init__", "(", "self", ",", "n_estimators", "=", "10", ",", "max_features", "=", "10", ",", "random_state", "=", "2019", ",", "max_depth", "=", "5", ",", "min_samples_leaf", "=", "100", ",", "min_samples_treatment", "=", "10", ",", "n_reg", "=", ...
[ 1253, 4 ]
[ 1295, 40 ]
python
en
['en', 'error', 'th']
False
UpliftRandomForestClassifier.fit
(self, X, treatment, y)
Fit the UpliftRandomForestClassifier. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An array containing the treatment group for each ...
Fit the UpliftRandomForestClassifier.
def fit(self, X, treatment, y): """ Fit the UpliftRandomForestClassifier. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. treatment : array-like, shape = [num_samples] An arr...
[ "def", "fit", "(", "self", ",", "X", ",", "treatment", ",", "y", ")", ":", "np", ".", "random", ".", "seed", "(", "self", ".", "random_state", ")", "# Get treatment group keys", "treatment_group_keys", "=", "list", "(", "set", "(", "treatment", ")", ")",...
[ 1297, 4 ]
[ 1329, 68 ]
python
en
['en', 'error', 'th']
False
UpliftRandomForestClassifier.predict
(self, X, full_output=False)
Returns the recommended treatment group and predicted optimal probability conditional on using the recommended treatment group. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariates used to train the uplift model. full_outp...
Returns the recommended treatment group and predicted optimal probability conditional on using the recommended treatment group.
def predict(self, X, full_output=False): ''' Returns the recommended treatment group and predicted optimal probability conditional on using the recommended treatment group. Args ---- X : ndarray, shape = [num_samples, num_features] An ndarray of the covariate...
[ "def", "predict", "(", "self", ",", "X", ",", "full_output", "=", "False", ")", ":", "df_res", "=", "pd", ".", "DataFrame", "(", ")", "y_pred_ensemble", "=", "dict", "(", ")", "y_pred_list", "=", "np", ".", "zeros", "(", "(", "X", ".", "shape", "["...
[ 1341, 4 ]
[ 1406, 30 ]
python
en
['en', 'error', 'th']
False
num_to_str
(f, precision=DEFAULT_PRECISION, use_locale=False, no_scientific=False)
Convert the given float to a string, centralizing standards for precision and decisions about scientific notation. Adds an approximately equal sign in the event precision loss (e.g. rounding) has occurred. There's a good discussion of related issues here: https://stackoverflow.com/questions/38847690/co...
Convert the given float to a string, centralizing standards for precision and decisions about scientific notation. Adds an approximately equal sign in the event precision loss (e.g. rounding) has occurred.
def num_to_str(f, precision=DEFAULT_PRECISION, use_locale=False, no_scientific=False): """Convert the given float to a string, centralizing standards for precision and decisions about scientific notation. Adds an approximately equal sign in the event precision loss (e.g. rounding) has occurred. There's a g...
[ "def", "num_to_str", "(", "f", ",", "precision", "=", "DEFAULT_PRECISION", ",", "use_locale", "=", "False", ",", "no_scientific", "=", "False", ")", ":", "assert", "not", "(", "use_locale", "and", "no_scientific", ")", "if", "precision", "!=", "DEFAULT_PRECISI...
[ 18, 0 ]
[ 62, 17 ]
python
en
['en', 'en', 'en']
True
ordinal
(num)
Convert a number to ordinal
Convert a number to ordinal
def ordinal(num): """Convert a number to ordinal""" # Taken from https://codereview.stackexchange.com/questions/41298/producing-ordinal-numbers/41301 # Consider a library like num2word when internationalization comes if 10 <= num % 100 <= 20: suffix = "th" else: # the second paramete...
[ "def", "ordinal", "(", "num", ")", ":", "# Taken from https://codereview.stackexchange.com/questions/41298/producing-ordinal-numbers/41301", "# Consider a library like num2word when internationalization comes", "if", "10", "<=", "num", "%", "100", "<=", "20", ":", "suffix", "=", ...
[ 68, 0 ]
[ 77, 28 ]
python
en
['en', 'su', 'en']
True
substitute_none_for_missing
(kwargs, kwarg_list)
Utility function to plug Nones in when optional parameters are not specified in expectation kwargs. Example: Input: kwargs={"a":1, "b":2}, kwarg_list=["c", "d"] Output: {"a":1, "b":2, "c": None, "d": None} This is helpful for standardizing the input objects for renderi...
Utility function to plug Nones in when optional parameters are not specified in expectation kwargs.
def substitute_none_for_missing(kwargs, kwarg_list): """Utility function to plug Nones in when optional parameters are not specified in expectation kwargs. Example: Input: kwargs={"a":1, "b":2}, kwarg_list=["c", "d"] Output: {"a":1, "b":2, "c": None, "d": None} Thi...
[ "def", "substitute_none_for_missing", "(", "kwargs", ",", "kwarg_list", ")", ":", "new_kwargs", "=", "copy", ".", "deepcopy", "(", "kwargs", ")", "for", "kwarg", "in", "kwarg_list", ":", "if", "kwarg", "not", "in", "new_kwargs", ":", "new_kwargs", "[", "kwar...
[ 114, 0 ]
[ 132, 21 ]
python
en
['en', 'en', 'en']
True
handle_strict_min_max
(params: dict)
Utility function for the at least and at most conditions based on strictness. Args: params: dictionary containing "strict_min" and "strict_max" booleans. Returns: tuple of strings to use for the at least condition and the at most condition
Utility function for the at least and at most conditions based on strictness.
def handle_strict_min_max(params: dict) -> (str, str): """ Utility function for the at least and at most conditions based on strictness. Args: params: dictionary containing "strict_min" and "strict_max" booleans. Returns: tuple of strings to use for the at least condition and the at mo...
[ "def", "handle_strict_min_max", "(", "params", ":", "dict", ")", "->", "(", "str", ",", "str", ")", ":", "at_least_str", "=", "(", "\"greater than\"", "if", "params", ".", "get", "(", "\"strict_min\"", ")", "is", "True", "else", "\"greater than or equal to\"",...
[ 178, 0 ]
[ 198, 36 ]
python
en
['en', 'error', 'th']
False
DataConnector.__init__
( self, name: str, datasource_name: str, execution_engine: Optional[ExecutionEngine] = None, batch_spec_passthrough: Optional[dict] = None, )
Base class for DataConnectors Args: name (str): required name for DataConnector datasource_name (str): required name for datasource execution_engine (ExecutionEngine): optional reference to ExecutionEngine batch_spec_passthrough (dict): dictionary with k...
Base class for DataConnectors
def __init__( self, name: str, datasource_name: str, execution_engine: Optional[ExecutionEngine] = None, batch_spec_passthrough: Optional[dict] = None, ): """ Base class for DataConnectors Args: name (str): required name for DataConnector ...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "datasource_name", ":", "str", ",", "execution_engine", ":", "Optional", "[", "ExecutionEngine", "]", "=", "None", ",", "batch_spec_passthrough", ":", "Optional", "[", "dict", "]", "=", "None", ...
[ 35, 4 ]
[ 59, 67 ]
python
en
['en', 'error', 'th']
False
DataConnector.get_batch_data_and_metadata
( self, batch_definition: BatchDefinition, )
Uses batch_definition to retrieve batch_data and batch_markers by building a batch_spec from batch_definition, then using execution_engine to return batch_data and batch_markers Args: batch_definition (BatchDefinition): required batch_definition parameter for retrieval
Uses batch_definition to retrieve batch_data and batch_markers by building a batch_spec from batch_definition, then using execution_engine to return batch_data and batch_markers
def get_batch_data_and_metadata( self, batch_definition: BatchDefinition, ) -> Tuple[Any, BatchSpec, BatchMarkers,]: # batch_data """ Uses batch_definition to retrieve batch_data and batch_markers by building a batch_spec from batch_definition, then using execution_engine to...
[ "def", "get_batch_data_and_metadata", "(", "self", ",", "batch_definition", ":", "BatchDefinition", ",", ")", "->", "Tuple", "[", "Any", ",", "BatchSpec", ",", "BatchMarkers", ",", "]", ":", "# batch_data", "batch_spec", ":", "BatchSpec", "=", "self", ".", "bu...
[ 81, 4 ]
[ 102, 9 ]
python
en
['en', 'error', 'th']
False
DataConnector.build_batch_spec
(self, batch_definition: BatchDefinition)
Builds batch_spec from batch_definition by generating batch_spec params and adding any pass_through params Args: batch_definition (BatchDefinition): required batch_definition parameter for retrieval Returns: BatchSpec object built from BatchDefinition
Builds batch_spec from batch_definition by generating batch_spec params and adding any pass_through params
def build_batch_spec(self, batch_definition: BatchDefinition) -> BatchSpec: """ Builds batch_spec from batch_definition by generating batch_spec params and adding any pass_through params Args: batch_definition (BatchDefinition): required batch_definition parameter for retrieval ...
[ "def", "build_batch_spec", "(", "self", ",", "batch_definition", ":", "BatchDefinition", ")", "->", "BatchSpec", ":", "batch_spec_params", ":", "dict", "=", "(", "self", ".", "_generate_batch_spec_parameters_from_batch_definition", "(", "batch_definition", "=", "batch_d...
[ 104, 4 ]
[ 128, 25 ]
python
en
['en', 'error', 'th']
False
DataConnector._get_data_reference_list
( self, data_asset_name: Optional[str] = None )
List objects in the underlying data store to create a list of data_references. This method is used to refresh the cache by classes that extend this base DataConnector class Args: data_asset_name (str): optional data_asset_name to retrieve more specific results
List objects in the underlying data store to create a list of data_references. This method is used to refresh the cache by classes that extend this base DataConnector class
def _get_data_reference_list( self, data_asset_name: Optional[str] = None ) -> List[str]: """ List objects in the underlying data store to create a list of data_references. This method is used to refresh the cache by classes that extend this base DataConnector class Args: ...
[ "def", "_get_data_reference_list", "(", "self", ",", "data_asset_name", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "str", "]", ":", "raise", "NotImplementedError" ]
[ 135, 4 ]
[ 146, 33 ]
python
en
['en', 'error', 'th']
False
DataConnector._get_data_reference_list_from_cache_by_data_asset_name
( self, data_asset_name: str )
Fetch data_references corresponding to data_asset_name from the cache.
Fetch data_references corresponding to data_asset_name from the cache.
def _get_data_reference_list_from_cache_by_data_asset_name( self, data_asset_name: str ) -> List[Any]: """ Fetch data_references corresponding to data_asset_name from the cache. """ raise NotImplementedError
[ "def", "_get_data_reference_list_from_cache_by_data_asset_name", "(", "self", ",", "data_asset_name", ":", "str", ")", "->", "List", "[", "Any", "]", ":", "raise", "NotImplementedError" ]
[ 148, 4 ]
[ 154, 33 ]
python
en
['en', 'error', 'th']
False
DataConnector.get_available_data_asset_names
(self)
Return the list of asset names known by this data connector. Returns: A list of available names
Return the list of asset names known by this data connector.
def get_available_data_asset_names(self) -> List[str]: """Return the list of asset names known by this data connector. Returns: A list of available names """ raise NotImplementedError
[ "def", "get_available_data_asset_names", "(", "self", ")", "->", "List", "[", "str", "]", ":", "raise", "NotImplementedError" ]
[ 162, 4 ]
[ 168, 33 ]
python
en
['en', 'en', 'en']
True
DataConnector.self_check
(self, pretty_print=True, max_examples=3)
Checks the configuration of the current DataConnector by doing the following : 1. refresh or create data_reference_cache 2. print batch_definition_count and example_data_references for each data_asset_names 3. also print unmatched data_references, and allow the user to modify the regex...
Checks the configuration of the current DataConnector by doing the following :
def self_check(self, pretty_print=True, max_examples=3): """ Checks the configuration of the current DataConnector by doing the following : 1. refresh or create data_reference_cache 2. print batch_definition_count and example_data_references for each data_asset_names 3. also pri...
[ "def", "self_check", "(", "self", ",", "pretty_print", "=", "True", ",", "max_examples", "=", "3", ")", ":", "if", "len", "(", "self", ".", "_data_references_cache", ")", "==", "0", ":", "self", ".", "_refresh_data_references_cache", "(", ")", "if", "prett...
[ 191, 4 ]
[ 307, 25 ]
python
en
['en', 'error', 'th']
False
DataConnector._self_check_fetch_batch
( self, pretty_print: bool, example_data_reference: Any, data_asset_name: str, )
Helper function for self_check() to retrieve batch using example_data_reference and data_asset_name, all while printing helpful messages. First 5 rows of batch_data are printed by default. Args: pretty_print (bool): print to console? example_data_reference (Any): data_r...
Helper function for self_check() to retrieve batch using example_data_reference and data_asset_name, all while printing helpful messages. First 5 rows of batch_data are printed by default.
def _self_check_fetch_batch( self, pretty_print: bool, example_data_reference: Any, data_asset_name: str, ): """ Helper function for self_check() to retrieve batch using example_data_reference and data_asset_name, all while printing helpful messages. First 5 r...
[ "def", "_self_check_fetch_batch", "(", "self", ",", "pretty_print", ":", "bool", ",", "example_data_reference", ":", "Any", ",", "data_asset_name", ":", "str", ",", ")", ":", "if", "pretty_print", ":", "print", "(", "f\"\\n\\t\\tFetching batch data...\"", ")", "ba...
[ 309, 4 ]
[ 378, 9 ]
python
en
['en', 'error', 'th']
False
DataConnector._validate_batch_request
(self, batch_request: BatchRequest)
Validate batch_request by checking: 1. if configured datasource_name matches batch_request's datasource_name 2. if current data_connector_name matches batch_request's data_connector_name Args: batch_request (BatchRequest): batch_request to validate
Validate batch_request by checking: 1. if configured datasource_name matches batch_request's datasource_name 2. if current data_connector_name matches batch_request's data_connector_name Args: batch_request (BatchRequest): batch_request to validate
def _validate_batch_request(self, batch_request: BatchRequest): """ Validate batch_request by checking: 1. if configured datasource_name matches batch_request's datasource_name 2. if current data_connector_name matches batch_request's data_connector_name Args: ...
[ "def", "_validate_batch_request", "(", "self", ",", "batch_request", ":", "BatchRequest", ")", ":", "if", "batch_request", ".", "datasource_name", "!=", "self", ".", "datasource_name", ":", "raise", "ValueError", "(", "f\"\"\"datasource_name in BatchRequest: \"{batch_requ...
[ 380, 4 ]
[ 396, 13 ]
python
en
['en', 'error', 'th']
False
set_data_source
(context, data_source_type=None)
TODO: Needs a docstring and tests.
TODO: Needs a docstring and tests.
def set_data_source(context, data_source_type=None): """ TODO: Needs a docstring and tests. """ data_source_name = None if not data_source_type: configured_datasources = [ datasource for datasource in context.list_datasources() ] if len(configured_datasources) ...
[ "def", "set_data_source", "(", "context", ",", "data_source_type", "=", "None", ")", ":", "data_source_name", "=", "None", "if", "not", "data_source_type", ":", "configured_datasources", "=", "[", "datasource", "for", "datasource", "in", "context", ".", "list_data...
[ 24, 0 ]
[ 130, 27 ]
python
en
['en', 'error', 'th']
False
setup_notebook_logging
(logger=None, log_level=logging.INFO)
Set up the provided logger for the GE default logging configuration. Args: logger - the logger to configure
Set up the provided logger for the GE default logging configuration.
def setup_notebook_logging(logger=None, log_level=logging.INFO): """Set up the provided logger for the GE default logging configuration. Args: logger - the logger to configure """ def posix2local(timestamp, tz=tzlocal.get_localzone()): """Seconds since the epoch -> local time as an awa...
[ "def", "setup_notebook_logging", "(", "logger", "=", "None", ",", "log_level", "=", "logging", ".", "INFO", ")", ":", "def", "posix2local", "(", "timestamp", ",", "tz", "=", "tzlocal", ".", "get_localzone", "(", ")", ")", ":", "\"\"\"Seconds since the epoch ->...
[ 133, 0 ]
[ 171, 5 ]
python
en
['en', 'en', 'en']
True
show_available_data_asset_names
(context, data_source_name=None)
List asset names found in the current context.
List asset names found in the current context.
def show_available_data_asset_names(context, data_source_name=None): """List asset names found in the current context.""" # TODO: Needs tests. styles = """ <style type='text/css'> ul.data-assets { margin-top: 0px; } ul.data-assets li { line-height: 1.2em; list-style-t...
[ "def", "show_available_data_asset_names", "(", "context", ",", "data_source_name", "=", "None", ")", ":", "# TODO: Needs tests.", "styles", "=", "\"\"\"\n <style type='text/css'>\n ul.data-assets {\n margin-top: 0px;\n }\n ul.data-assets li {\n line-height: 1.2em;...
[ 178, 0 ]
[ 253, 27 ]
python
en
['en', 'en', 'en']
True
display_column_expectations_as_section
( expectation_suite, column, include_styling=True, return_without_displaying=False, )
This is a utility function to render all of the Expectations in an ExpectationSuite with the same column name as an HTML block. By default, the HTML block is rendered using ExpectationSuiteColumnSectionRenderer and the view is rendered using DefaultJinjaSectionView. Therefore, it should look exactly the same a...
This is a utility function to render all of the Expectations in an ExpectationSuite with the same column name as an HTML block.
def display_column_expectations_as_section( expectation_suite, column, include_styling=True, return_without_displaying=False, ): """This is a utility function to render all of the Expectations in an ExpectationSuite with the same column name as an HTML block. By default, the HTML block is rende...
[ "def", "display_column_expectations_as_section", "(", "expectation_suite", ",", "column", ",", "include_styling", "=", "True", ",", "return_without_displaying", "=", "False", ",", ")", ":", "# TODO: replace this with a generic utility function, preferably a method on an Expectation...
[ 328, 0 ]
[ 364, 5 ]
python
en
['en', 'en', 'en']
True
display_profiled_column_evrs_as_section
( evrs, column, include_styling=True, return_without_displaying=False, )
This is a utility function to render all of the EVRs in an ExpectationSuite with the same column name as an HTML block. By default, the HTML block is rendered using ExpectationSuiteColumnSectionRenderer and the view is rendered using DefaultJinjaSectionView. Therefore, it should look exactly the same as the de...
This is a utility function to render all of the EVRs in an ExpectationSuite with the same column name as an HTML block.
def display_profiled_column_evrs_as_section( evrs, column, include_styling=True, return_without_displaying=False, ): """This is a utility function to render all of the EVRs in an ExpectationSuite with the same column name as an HTML block. By default, the HTML block is rendered using Expectatio...
[ "def", "display_profiled_column_evrs_as_section", "(", "evrs", ",", "column", ",", "include_styling", "=", "True", ",", "return_without_displaying", "=", "False", ",", ")", ":", "# TODO: replace this with a generic utility function, preferably a method on an ExpectationSuite class"...
[ 367, 0 ]
[ 408, 5 ]
python
en
['en', 'en', 'en']
True
display_column_evrs_as_section
( evrs, column, include_styling=True, return_without_displaying=False, )
Display validation results for a single column as a section. WARNING: This method is experimental.
Display validation results for a single column as a section.
def display_column_evrs_as_section( evrs, column, include_styling=True, return_without_displaying=False, ): """ Display validation results for a single column as a section. WARNING: This method is experimental. """ # TODO: replace this with a generic utility function, preferably a ...
[ "def", "display_column_evrs_as_section", "(", "evrs", ",", "column", ",", "include_styling", "=", "True", ",", "return_without_displaying", "=", "False", ",", ")", ":", "# TODO: replace this with a generic utility function, preferably a method on an ExpectationSuite class", "colu...
[ 411, 0 ]
[ 447, 5 ]
python
en
['en', 'error', 'th']
False
ACPragma.__init__
(self, rkey: str, location: str="-pragma-", *, name: str="-pragma-", kind: str="Pragma", apiVersion: Optional[str]=None, serialization: Optional[str]=None, **kwargs)
Initialize an ACPragma from the raw fields of its ACResource.
Initialize an ACPragma from the raw fields of its ACResource.
def __init__(self, rkey: str, location: str="-pragma-", *, name: str="-pragma-", kind: str="Pragma", apiVersion: Optional[str]=None, serialization: Optional[str]=None, **kwargs) -> None: """ Initialize an ACPragma from...
[ "def", "__init__", "(", "self", ",", "rkey", ":", "str", ",", "location", ":", "str", "=", "\"-pragma-\"", ",", "*", ",", "name", ":", "str", "=", "\"-pragma-\"", ",", "kind", ":", "str", "=", "\"Pragma\"", ",", "apiVersion", ":", "Optional", "[", "s...
[ 29, 4 ]
[ 48, 34 ]
python
en
['en', 'error', 'th']
False
test_func
()
My cool test.name
My cool test.name
def test_func(): """ My cool test.name """ assert True
[ "def", "test_func", "(", ")", ":", "assert", "True" ]
[ 0, 0 ]
[ 2, 15 ]
python
en
['en', 'en', 'en']
True
declaration_matcher_t.__init__
( self, name=None, decl_type=None, header_dir=None, header_file=None)
:param decl_type: declaration type to match by. For example :class:`enumeration_t`. :type decl_type: any class that derives from :class:`declaration_t` class :param name: declaration name, could be full name. :type name: str :param header_dir: absolute director...
:param decl_type: declaration type to match by. For example :class:`enumeration_t`. :type decl_type: any class that derives from :class:`declaration_t` class
def __init__( self, name=None, decl_type=None, header_dir=None, header_file=None): """ :param decl_type: declaration type to match by. For example :class:`enumeration_t`. :type decl_type: any class that derives from :class:`decl...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ")", ":", "# An other option is that pygccxml will create absolute path using", "# os.path.abspath function. But I t...
[ 29, 4 ]
[ 78, 77 ]
python
en
['en', 'error', 'th']
False
variable_matcher_t.__init__
( self, name=None, decl_type=None, header_dir=None, header_file=None)
:param decl_type: variable type :type decl_type: string or instance of :class:`type_t` derived class
:param decl_type: variable type :type decl_type: string or instance of :class:`type_t` derived class
def __init__( self, name=None, decl_type=None, header_dir=None, header_file=None): """ :param decl_type: variable type :type decl_type: string or instance of :class:`type_t` derived class """ declaration_matcher_t.__ini...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ")", ":", "declaration_matcher_t", ".", "__init__", "(", "self", ",", "name", "=", "name", ",", "d...
[ 189, 4 ]
[ 206, 35 ]
python
en
['en', 'error', 'th']
False
calldef_matcher_t.__init__
( self, name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None)
:param return_type: callable return type :type return_type: string or instance of :class:`type_t` derived class :type arg_types: list :param arg_types: list of function argument types. `arg_types` can contain. Any item within the list...
:param return_type: callable return type :type return_type: string or instance of :class:`type_t` derived class
def __init__( self, name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): """ :param return_type: callable return type :type return_type: string or instance of :class:`t...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ")", ":", "if", "None", "is", "d...
[ 260, 4 ]
[ 299, 34 ]
python
en
['en', 'error', 'th']
False
operator_matcher_t.__init__
( self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None)
:param symbol: operator symbol :type symbol: str
:param symbol: operator symbol :type symbol: str
def __init__( self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): """ :param symbol: operator symbol :type symbol: str """ ...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "symbol", "=", "None", ",", "return_type", "=", "None", ",", "arg_types", "=", "None", ",", "decl_type", "=", "None", ",", "header_dir", "=", "None", ",", "header_file", "=", "None", ")", ...
[ 358, 4 ]
[ 381, 28 ]
python
en
['en', 'error', 'th']
False
current_default_thread_limiter
()
Get the default `~trio.CapacityLimiter` used by `trio.to_thread.run_sync`. The most common reason to call this would be if you want to modify its :attr:`~trio.CapacityLimiter.total_tokens` attribute.
Get the default `~trio.CapacityLimiter` used by `trio.to_thread.run_sync`.
def current_default_thread_limiter(): """Get the default `~trio.CapacityLimiter` used by `trio.to_thread.run_sync`. The most common reason to call this would be if you want to modify its :attr:`~trio.CapacityLimiter.total_tokens` attribute. """ try: limiter = _limiter_local.get() e...
[ "def", "current_default_thread_limiter", "(", ")", ":", "try", ":", "limiter", "=", "_limiter_local", ".", "get", "(", ")", "except", "LookupError", ":", "limiter", "=", "CapacityLimiter", "(", "DEFAULT_LIMIT", ")", "_limiter_local", ".", "set", "(", "limiter", ...
[ 32, 0 ]
[ 45, 18 ]
python
en
['en', 'en', 'en']
True
to_thread_run_sync
(sync_fn, *args, cancellable=False, limiter=None)
Convert a blocking operation into an async operation using a thread. These two lines are equivalent:: sync_fn(*args) await trio.to_thread.run_sync(sync_fn, *args) except that if ``sync_fn`` takes a long time, then the first line will block the Trio loop while it runs, while the second lin...
Convert a blocking operation into an async operation using a thread.
async def to_thread_run_sync(sync_fn, *args, cancellable=False, limiter=None): """Convert a blocking operation into an async operation using a thread. These two lines are equivalent:: sync_fn(*args) await trio.to_thread.run_sync(sync_fn, *args) except that if ``sync_fn`` takes a long time...
[ "async", "def", "to_thread_run_sync", "(", "sync_fn", ",", "*", "args", ",", "cancellable", "=", "False", ",", "limiter", "=", "None", ")", ":", "await", "trio", ".", "lowlevel", ".", "checkpoint_if_cancelled", "(", ")", "if", "limiter", "is", "None", ":",...
[ 58, 0 ]
[ 206, 59 ]
python
en
['en', 'en', 'en']
True
_run_fn_as_system_task
(cb, fn, *args, trio_token=None)
Helper function for from_thread.run and from_thread.run_sync. Since this internally uses TrioToken.run_sync_soon, all warnings about raised exceptions canceling all tasks should be noted.
Helper function for from_thread.run and from_thread.run_sync.
def _run_fn_as_system_task(cb, fn, *args, trio_token=None): """Helper function for from_thread.run and from_thread.run_sync. Since this internally uses TrioToken.run_sync_soon, all warnings about raised exceptions canceling all tasks should be noted. """ if trio_token and not isinstance(trio_token...
[ "def", "_run_fn_as_system_task", "(", "cb", ",", "fn", ",", "*", "args", ",", "trio_token", "=", "None", ")", ":", "if", "trio_token", "and", "not", "isinstance", "(", "trio_token", ",", "TrioToken", ")", ":", "raise", "RuntimeError", "(", "\"Passed kwarg tr...
[ 209, 0 ]
[ 237, 27 ]
python
en
['en', 'en', 'en']
True
from_thread_run
(afn, *args, trio_token=None)
Run the given async function in the parent Trio thread, blocking until it is complete. Returns: Whatever ``afn(*args)`` returns. Returns or raises whatever the given function returns or raises. It can also raise exceptions of its own: Raises: RunFinishedError: if the corresponding c...
Run the given async function in the parent Trio thread, blocking until it is complete.
def from_thread_run(afn, *args, trio_token=None): """Run the given async function in the parent Trio thread, blocking until it is complete. Returns: Whatever ``afn(*args)`` returns. Returns or raises whatever the given function returns or raises. It can also raise exceptions of its own: ...
[ "def", "from_thread_run", "(", "afn", ",", "*", "args", ",", "trio_token", "=", "None", ")", ":", "def", "callback", "(", "q", ",", "afn", ",", "args", ")", ":", "@", "disable_ki_protection", "async", "def", "unprotected_afn", "(", ")", ":", "coro", "=...
[ 240, 0 ]
[ 291, 78 ]
python
en
['en', 'en', 'en']
True
from_thread_run_sync
(fn, *args, trio_token=None)
Run the given sync function in the parent Trio thread, blocking until it is complete. Returns: Whatever ``fn(*args)`` returns. Returns or raises whatever the given function returns or raises. It can also raise exceptions of its own: Raises: RunFinishedError: if the corresponding cal...
Run the given sync function in the parent Trio thread, blocking until it is complete.
def from_thread_run_sync(fn, *args, trio_token=None): """Run the given sync function in the parent Trio thread, blocking until it is complete. Returns: Whatever ``fn(*args)`` returns. Returns or raises whatever the given function returns or raises. It can also raise exceptions of its own: ...
[ "def", "from_thread_run_sync", "(", "fn", ",", "*", "args", ",", "trio_token", "=", "None", ")", ":", "def", "callback", "(", "q", ",", "fn", ",", "args", ")", ":", "@", "disable_ki_protection", "def", "unprotected_fn", "(", ")", ":", "ret", "=", "fn",...
[ 294, 0 ]
[ 343, 77 ]
python
en
['en', 'en', 'en']
True
ExpectColumnDistinctValuesToBeInSet.validate_configuration
(self, configuration: Optional[ExpectationConfiguration])
Validating that user has inputted a value set and that configuration has been initialized
Validating that user has inputted a value set and that configuration has been initialized
def validate_configuration(self, configuration: Optional[ExpectationConfiguration]): """Validating that user has inputted a value set and that configuration has been initialized""" super().validate_configuration(configuration) try: assert "value_set" in configuration.kwargs, "value_...
[ "def", "validate_configuration", "(", "self", ",", "configuration", ":", "Optional", "[", "ExpectationConfiguration", "]", ")", ":", "super", "(", ")", ".", "validate_configuration", "(", "configuration", ")", "try", ":", "assert", "\"value_set\"", "in", "configur...
[ 271, 4 ]
[ 287, 19 ]
python
en
['en', 'en', 'en']
True
bind_aliases
(decls)
This function binds between class and it's typedefs. Deprecated since 1.9.0, will be removed in 2.0.0 :param decls: list of all declarations :rtype: None
This function binds between class and it's typedefs.
def bind_aliases(decls): """ This function binds between class and it's typedefs. Deprecated since 1.9.0, will be removed in 2.0.0 :param decls: list of all declarations :rtype: None """ warnings.warn( "The bind_aliases function is deprecated", DeprecationWarning) declaratio...
[ "def", "bind_aliases", "(", "decls", ")", ":", "warnings", ".", "warn", "(", "\"The bind_aliases function is deprecated\"", ",", "DeprecationWarning", ")", "declarations_joiner", ".", "bind_aliases", "(", "decls", ")" ]
[ 491, 0 ]
[ 505, 43 ]
python
en
['en', 'error', 'th']
False
source_reader_t.__init__
(self, configuration, cache=None, decl_factory=None)
:param configuration: Instance of :class:`xml_generator_configuration_t` class, that contains GCC-XML or CastXML configuration. :param cache: Reference to cache object, that will be updated after a file has been parsed. :type ...
:param configuration: Instance of :class:`xml_generator_configuration_t` class, that contains GCC-XML or CastXML configuration.
def __init__(self, configuration, cache=None, decl_factory=None): """ :param configuration: Instance of :class:`xml_generator_configuration_t` class, that contains GCC-XML or CastXML configuration. :param cache: Reference to cache object, that will ...
[ "def", "__init__", "(", "self", ",", "configuration", ",", "cache", "=", "None", ",", "decl_factory", "=", "None", ")", ":", "self", ".", "logger", "=", "utils", ".", "loggers", ".", "cxx_parser", "self", ".", "__search_directories", "=", "[", "]", "self...
[ 42, 4 ]
[ 71, 49 ]
python
en
['en', 'error', 'th']
False
source_reader_t.xml_generator_from_xml_file
(self)
Configuration object containing information about the xml generator read from the xml file. Returns: utils.xml_generators: configuration object
Configuration object containing information about the xml generator read from the xml file.
def xml_generator_from_xml_file(self): """ Configuration object containing information about the xml generator read from the xml file. Returns: utils.xml_generators: configuration object """ return self.__xml_generator_from_xml_file
[ "def", "xml_generator_from_xml_file", "(", "self", ")", ":", "return", "self", ".", "__xml_generator_from_xml_file" ]
[ 74, 4 ]
[ 82, 49 ]
python
en
['en', 'error', 'th']
False
source_reader_t.__create_command_line
(self, source_file, xml_file)
Generate the command line used to build xml files. Depending on the chosen xml_generator a different command line is built. The gccxml option may be removed once gccxml support is dropped (this was the original c++ xml_generator, castxml is replacing it now).
Generate the command line used to build xml files.
def __create_command_line(self, source_file, xml_file): """ Generate the command line used to build xml files. Depending on the chosen xml_generator a different command line is built. The gccxml option may be removed once gccxml support is dropped (this was the original c++ xml_...
[ "def", "__create_command_line", "(", "self", ",", "source_file", ",", "xml_file", ")", ":", "if", "self", ".", "__config", ".", "xml_generator", "==", "\"gccxml\"", ":", "return", "self", ".", "__create_command_line_gccxml", "(", "source_file", ",", "xml_file", ...
[ 84, 4 ]
[ 98, 76 ]
python
en
['en', 'error', 'th']
False
source_reader_t.__add_symbols
(self, cmd)
Add all additional defined and undefined symbols.
Add all additional defined and undefined symbols.
def __add_symbols(self, cmd): """ Add all additional defined and undefined symbols. """ if self.__config.define_symbols: symbols = self.__config.define_symbols cmd.append(''.join( [' -D"%s"' % def_symbol for def_symbol in symbols])) if s...
[ "def", "__add_symbols", "(", "self", ",", "cmd", ")", ":", "if", "self", ".", "__config", ".", "define_symbols", ":", "symbols", "=", "self", ".", "__config", ".", "define_symbols", "cmd", ".", "append", "(", "''", ".", "join", "(", "[", "' -D\"%s\"'", ...
[ 239, 4 ]
[ 255, 18 ]
python
en
['en', 'error', 'th']
False
source_reader_t.create_xml_file
(self, source_file, destination=None)
This method will generate a xml file using an external tool. The external tool can be either gccxml or castxml. The method will return the file path of the generated xml file. :param source_file: path to the source file that should be parsed. :type source_file: str :p...
This method will generate a xml file using an external tool.
def create_xml_file(self, source_file, destination=None): """ This method will generate a xml file using an external tool. The external tool can be either gccxml or castxml. The method will return the file path of the generated xml file. :param source_file: path to the source f...
[ "def", "create_xml_file", "(", "self", ",", "source_file", ",", "destination", "=", "None", ")", ":", "xml_file", "=", "destination", "# If file specified, remove it to start else create new file name", "if", "xml_file", ":", "utils", ".", "remove_file_no_raise", "(", "...
[ 257, 4 ]
[ 330, 23 ]
python
en
['en', 'error', 'th']
False
source_reader_t.create_xml_file_from_string
(self, content, destination=None)
Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for GCC-XML generated file :type destination: str :rtype: returns file name of GCC-XML generated file
Creates XML file from text.
def create_xml_file_from_string(self, content, destination=None): """ Creates XML file from text. :param content: C++ source code :type content: str :param destination: file name for GCC-XML generated file :type destination: str :rtype: returns file name of GCC...
[ "def", "create_xml_file_from_string", "(", "self", ",", "content", ",", "destination", "=", "None", ")", ":", "header_file", "=", "utils", ".", "create_temp_file_name", "(", "suffix", "=", "'.h'", ")", "try", ":", "with", "open", "(", "header_file", ",", "\"...
[ 332, 4 ]
[ 352, 23 ]
python
en
['en', 'error', 'th']
False
source_reader_t.read_cpp_source_file
(self, source_file)
Reads C++ source file and returns declarations tree :param source_file: path to C++ source file :type source_file: str
Reads C++ source file and returns declarations tree
def read_cpp_source_file(self, source_file): """ Reads C++ source file and returns declarations tree :param source_file: path to C++ source file :type source_file: str """ xml_file = '' try: ffname = self.__file_full_name(source_file) se...
[ "def", "read_cpp_source_file", "(", "self", ",", "source_file", ")", ":", "xml_file", "=", "''", "try", ":", "ffname", "=", "self", ".", "__file_full_name", "(", "source_file", ")", "self", ".", "logger", ".", "debug", "(", "\"Reading source file: [%s].\"", ",...
[ 357, 4 ]
[ 389, 20 ]
python
en
['en', 'error', 'th']
False
source_reader_t.read_xml_file
(self, xml_file)
Read generated XML file. :param xml_file: path to xml file :type xml_file: str :rtype: declarations tree
Read generated XML file.
def read_xml_file(self, xml_file): """ Read generated XML file. :param xml_file: path to xml file :type xml_file: str :rtype: declarations tree """ assert self.__config is not None ffname = self.__file_full_name(xml_file) self.logger.debug("Re...
[ "def", "read_xml_file", "(", "self", ",", "xml_file", ")", ":", "assert", "self", ".", "__config", "is", "not", "None", "ffname", "=", "self", ".", "__file_full_name", "(", "xml_file", ")", "self", ".", "logger", ".", "debug", "(", "\"Reading xml file: [%s]\...
[ 391, 4 ]
[ 415, 20 ]
python
en
['en', 'error', 'th']
False
source_reader_t.read_string
(self, content)
Reads a Python string that contains C++ code, and return the declarations tree.
Reads a Python string that contains C++ code, and return the declarations tree.
def read_string(self, content): """ Reads a Python string that contains C++ code, and return the declarations tree. """ header_file = utils.create_temp_file_name(suffix='.h') with open(header_file, "w+") as f: f.write(content) try: decls...
[ "def", "read_string", "(", "self", ",", "content", ")", ":", "header_file", "=", "utils", ".", "create_temp_file_name", "(", "suffix", "=", "'.h'", ")", "with", "open", "(", "header_file", ",", "\"w+\"", ")", "as", "f", ":", "f", ".", "write", "(", "co...
[ 417, 4 ]
[ 435, 20 ]
python
en
['en', 'error', 'th']
False
Load
(build_files, format, default_variables={}, includes=[], depth='.', params=None, check=False, circular_check=True, duplicate_basename_check=True)
Loads one or more specified build files. default_variables and includes will be copied before use. Returns the generator for the specified format and the data returned by loading the specified build files.
Loads one or more specified build files. default_variables and includes will be copied before use. Returns the generator for the specified format and the data returned by loading the specified build files.
def Load(build_files, format, default_variables={}, includes=[], depth='.', params=None, check=False, circular_check=True, duplicate_basename_check=True): """ Loads one or more specified build files. default_variables and includes will be copied before use. Returns the generator for the specif...
[ "def", "Load", "(", "build_files", ",", "format", ",", "default_variables", "=", "{", "}", ",", "includes", "=", "[", "]", ",", "depth", "=", "'.'", ",", "params", "=", "None", ",", "check", "=", "False", ",", "circular_check", "=", "True", ",", "dup...
[ 49, 0 ]
[ 130, 29 ]
python
en
['en', 'error', 'th']
False
NameValueListToDict
(name_value_list)
Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary of the pairs. If a string is simply NAME, then the value in the dictionary is set to True. If VALUE can be converted to an integer, it is.
Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary of the pairs. If a string is simply NAME, then the value in the dictionary is set to True. If VALUE can be converted to an integer, it is.
def NameValueListToDict(name_value_list): """ Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary of the pairs. If a string is simply NAME, then the value in the dictionary is set to True. If VALUE can be converted to an integer, it is. """ result = { } for item in name_value_lis...
[ "def", "NameValueListToDict", "(", "name_value_list", ")", ":", "result", "=", "{", "}", "for", "item", "in", "name_value_list", ":", "tokens", "=", "item", ".", "split", "(", "'='", ",", "1", ")", "if", "len", "(", "tokens", ")", "==", "2", ":", "# ...
[ 132, 0 ]
[ 152, 15 ]
python
en
['en', 'error', 'th']
False
RegenerateAppendFlag
(flag, values, predicate, env_name, options)
Regenerate a list of command line flags, for an option of action='append'. The |env_name|, if given, is checked in the environment and used to generate an initial list of options, then the options that were specified on the command line (given in |values|) are appended. This matches the handling of environmen...
Regenerate a list of command line flags, for an option of action='append'.
def RegenerateAppendFlag(flag, values, predicate, env_name, options): """Regenerate a list of command line flags, for an option of action='append'. The |env_name|, if given, is checked in the environment and used to generate an initial list of options, then the options that were specified on the command line (...
[ "def", "RegenerateAppendFlag", "(", "flag", ",", "values", ",", "predicate", ",", "env_name", ",", "options", ")", ":", "flags", "=", "[", "]", "if", "options", ".", "use_environment", "and", "env_name", ":", "for", "flag_value", "in", "ShlexEnv", "(", "en...
[ 165, 0 ]
[ 185, 14 ]
python
en
['en', 'en', 'en']
True
RegenerateFlags
(options)
Given a parsed options object, and taking the environment variables into account, returns a list of flags that should regenerate an equivalent options object (even in the absence of the environment variables.) Any path options will be normalized relative to depth. The format flag is not included, as it is ass...
Given a parsed options object, and taking the environment variables into account, returns a list of flags that should regenerate an equivalent options object (even in the absence of the environment variables.)
def RegenerateFlags(options): """Given a parsed options object, and taking the environment variables into account, returns a list of flags that should regenerate an equivalent options object (even in the absence of the environment variables.) Any path options will be normalized relative to depth. The format...
[ "def", "RegenerateFlags", "(", "options", ")", ":", "def", "FixPath", "(", "path", ")", ":", "path", "=", "gyp", ".", "common", ".", "FixIfRelativePath", "(", "path", ",", "options", ".", "depth", ")", "if", "not", "path", ":", "return", "os", ".", "...
[ 187, 0 ]
[ 235, 14 ]
python
en
['en', 'en', 'en']
True
RegeneratableOptionParser.add_option
(self, *args, **kw)
Add an option to the parser. This accepts the same arguments as OptionParser.add_option, plus the following: regenerate: can be set to False to prevent this option from being included in regeneration. env_name: name of environment variable that additional values for this ...
Add an option to the parser.
def add_option(self, *args, **kw): """Add an option to the parser. This accepts the same arguments as OptionParser.add_option, plus the following: regenerate: can be set to False to prevent this option from being included in regeneration. env_name: name of environment variable...
[ "def", "add_option", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "env_name", "=", "kw", ".", "pop", "(", "'env_name'", ",", "None", ")", "if", "'dest'", "in", "kw", "and", "kw", ".", "pop", "(", "'regenerate'", ",", "True", ")",...
[ 242, 2 ]
[ 271, 55 ]
python
en
['en', 'en', 'en']
True
aws_credentials
()
Mocked AWS Credentials for moto.
Mocked AWS Credentials for moto.
def aws_credentials(): """Mocked AWS Credentials for moto.""" os.environ["AWS_ACCESS_KEY_ID"] = "testing" os.environ["AWS_SECRET_ACCESS_KEY"] = "testing" os.environ["AWS_SECURITY_TOKEN"] = "testing" os.environ["AWS_SESSION_TOKEN"] = "testing"
[ "def", "aws_credentials", "(", ")", ":", "os", ".", "environ", "[", "\"AWS_ACCESS_KEY_ID\"", "]", "=", "\"testing\"", "os", ".", "environ", "[", "\"AWS_SECRET_ACCESS_KEY\"", "]", "=", "\"testing\"", "os", ".", "environ", "[", "\"AWS_SECURITY_TOKEN\"", "]", "=", ...
[ 335, 0 ]
[ 340, 47 ]
python
en
['en', 'en', 'en']
True
LatexFormatter.get_style_defs
(self, arg='')
Return the command sequences needed to define the commands used to format text in the verbatim environment. ``arg`` is ignored.
Return the command sequences needed to define the commands used to format text in the verbatim environment. ``arg`` is ignored.
def get_style_defs(self, arg=''): """ Return the command sequences needed to define the commands used to format text in the verbatim environment. ``arg`` is ignored. """ cp = self.commandprefix styles = [] for name, definition in iteritems(self.cmd2def): ...
[ "def", "get_style_defs", "(", "self", ",", "arg", "=", "''", ")", ":", "cp", "=", "self", ".", "commandprefix", "styles", "=", "[", "]", "for", "name", ",", "definition", "in", "iteritems", "(", "self", ".", "cmd2def", ")", ":", "styles", ".", "appen...
[ 317, 4 ]
[ 328, 61 ]
python
en
['en', 'error', 'th']
False
lone_object_filter
(image, min_size=2, connectivity=1, kernel_size=3)
Replaces isolated, contiguous regions of values in a raster with values representing the surrounding pixels. More specifically, this reduces noise in a raster by setting contiguous regions of values greater than a specified minimum size to the modal value in a specified neighborhood. The defa...
Replaces isolated, contiguous regions of values in a raster with values representing the surrounding pixels.
def lone_object_filter(image, min_size=2, connectivity=1, kernel_size=3): """ Replaces isolated, contiguous regions of values in a raster with values representing the surrounding pixels. More specifically, this reduces noise in a raster by setting contiguous regions of values greater than a specifi...
[ "def", "lone_object_filter", "(", "image", ",", "min_size", "=", "2", ",", "connectivity", "=", "1", ",", "kernel_size", "=", "3", ")", ":", "assert", "kernel_size", "%", "2", "==", "1", ",", "\"The parameter `kernel_size` must be an odd number.\"", "image_min", ...
[ 9, 0 ]
[ 66, 26 ]
python
en
['en', 'error', 'th']
False
apply_filter
(statistic, filter_output, padded_arr, filter_shape)
Creates a mean, median, or standard deviation filtered version of an `xarray.DataArray`. Parameters ---------- filter_output: xarray.DataArray The `xarray.DataArray` to store the filtered values in. Must contain the values to filter. This object is modified.** statistic: string...
Creates a mean, median, or standard deviation filtered version of an `xarray.DataArray`.
def apply_filter(statistic, filter_output, padded_arr, filter_shape): """ Creates a mean, median, or standard deviation filtered version of an `xarray.DataArray`. Parameters ---------- filter_output: xarray.DataArray The `xarray.DataArray` to store the filtered values in. Must c...
[ "def", "apply_filter", "(", "statistic", ",", "filter_output", ",", "padded_arr", ",", "filter_shape", ")", ":", "# For each point in the first two dimensions of `dataarray`...", "for", "i", "in", "range", "(", "filter_output", ".", "shape", "[", "0", "]", ")", ":",...
[ 72, 0 ]
[ 102, 24 ]
python
en
['en', 'error', 'th']
False
stats_filter_3d_composite_2d
(dataarray, statistic, filter_size=1, time_dim='time')
Returns a mean, median, or standard deviation filter composite of a 3D `xarray.DataArray` with a time dimension. This makes a 2D composite of a 3D array by stretching the filter kernel across time. This function is more accurate than using SciPy or scikit-image methods, because those don't handle t...
Returns a mean, median, or standard deviation filter composite of a 3D `xarray.DataArray` with a time dimension. This makes a 2D composite of a 3D array by stretching the filter kernel across time. This function is more accurate than using SciPy or scikit-image methods, because those don't handle t...
def stats_filter_3d_composite_2d(dataarray, statistic, filter_size=1, time_dim='time'): """ Returns a mean, median, or standard deviation filter composite of a 3D `xarray.DataArray` with a time dimension. This makes a 2D composite of a 3D array by stretching the filter k...
[ "def", "stats_filter_3d_composite_2d", "(", "dataarray", ",", "statistic", ",", "filter_size", "=", "1", ",", "time_dim", "=", "'time'", ")", ":", "time_ax_num", "=", "dataarray", ".", "get_axis_num", "(", "time_dim", ")", "dataarray_non_time_dims", "=", "np", "...
[ 105, 0 ]
[ 158, 24 ]
python
en
['en', 'error', 'th']
False
stats_filter_2d
(dataarray, statistic, filter_size=3)
Returns a mean, median, or standard deviation filter of a 2D `xarray.DataArray`. This function is more accurate than using SciPy or scikit-image methods, because those don't handle the extremities ideally (edges and corners). Specifically, only values actually inside the filter should be considered, ...
Returns a mean, median, or standard deviation filter of a 2D `xarray.DataArray`. This function is more accurate than using SciPy or scikit-image methods, because those don't handle the extremities ideally (edges and corners). Specifically, only values actually inside the filter should be considered, ...
def stats_filter_2d(dataarray, statistic, filter_size=3): """ Returns a mean, median, or standard deviation filter of a 2D `xarray.DataArray`. This function is more accurate than using SciPy or scikit-image methods, because those don't handle the extremities ideally (edges and corners). Specifically...
[ "def", "stats_filter_2d", "(", "dataarray", ",", "statistic", ",", "filter_size", "=", "3", ")", ":", "if", "filter_size", "==", "1", ":", "return", "dataarray", "filter_output", "=", "dataarray", ".", "copy", "(", ")", "kernel", "=", "np", ".", "ones", ...
[ 161, 0 ]
[ 201, 24 ]
python
en
['en', 'error', 'th']
False
AdminSiteTests.test_users_listed
(self)
Test that users are listed on user page
Test that users are listed on user page
def test_users_listed(self): """Test that users are listed on user page""" url = reverse('admin:core_user_changelist') res = self.client.get(url) self.assertContains(res, self.user.name) self.assertContains(res, self.user.email)
[ "def", "test_users_listed", "(", "self", ")", ":", "url", "=", "reverse", "(", "'admin:core_user_changelist'", ")", "res", "=", "self", ".", "client", ".", "get", "(", "url", ")", "self", ".", "assertContains", "(", "res", ",", "self", ".", "user", ".", ...
[ 20, 4 ]
[ 26, 49 ]
python
en
['en', 'en', 'en']
True
AdminSiteTests.test_user_change_page
(self)
Test that the user edit page works
Test that the user edit page works
def test_user_change_page(self): """Test that the user edit page works""" url = reverse('admin:core_user_change', args=[self.user.id]) res = self.client.get(url) self.assertEqual(res.status_code, 200)
[ "def", "test_user_change_page", "(", "self", ")", ":", "url", "=", "reverse", "(", "'admin:core_user_change'", ",", "args", "=", "[", "self", ".", "user", ".", "id", "]", ")", "res", "=", "self", ".", "client", ".", "get", "(", "url", ")", "self", "....
[ 28, 4 ]
[ 33, 46 ]
python
en
['en', 'en', 'en']
True
AdminSiteTests.test_create_user_page
(self)
Test that the create user page works
Test that the create user page works
def test_create_user_page(self): """Test that the create user page works""" url = reverse('admin:core_user_add') res = self.client.get(url) self.assertEqual(res.status_code, 200)
[ "def", "test_create_user_page", "(", "self", ")", ":", "url", "=", "reverse", "(", "'admin:core_user_add'", ")", "res", "=", "self", ".", "client", ".", "get", "(", "url", ")", "self", ".", "assertEqual", "(", "res", ".", "status_code", ",", "200", ")" ]
[ 35, 4 ]
[ 40, 46 ]
python
en
['en', 'en', 'en']
True
TeamcityServiceMessages.testStarted
(self, testName, captureStandardOutput=None, flowId=None, metainfo=None)
:param metainfo: Used to pass any payload from test runner to Intellij. See IDEA-176950
def testStarted(self, testName, captureStandardOutput=None, flowId=None, metainfo=None): """ :param metainfo: Used to pass any payload from test runner to Intellij. See IDEA-176950 """ self.message('testStarted', name=testName, captureStandardOutput=captureStandardOutput, flowId=flowId,...
[ "def", "testStarted", "(", "self", ",", "testName", ",", "captureStandardOutput", "=", "None", ",", "flowId", "=", "None", ",", "metainfo", "=", "None", ")", ":", "self", ".", "message", "(", "'testStarted'", ",", "name", "=", "testName", ",", "captureStan...
[ 144, 4 ]
[ 149, 129 ]
python
en
['en', 'error', 'th']
False
_library_not_loaded_test
( tmp_path_factory, cli_input, library_name, library_import_name, my_caplog, monkeypatch, )
This test requires that a library is NOT installed. It tests that: - a helpful error message is returned to install the missing library - the expected tree structure is in place - the config yml contains an empty dict in its datasource entry
This test requires that a library is NOT installed. It tests that: - a helpful error message is returned to install the missing library - the expected tree structure is in place - the config yml contains an empty dict in its datasource entry
def _library_not_loaded_test( tmp_path_factory, cli_input, library_name, library_import_name, my_caplog, monkeypatch, ): """ This test requires that a library is NOT installed. It tests that: - a helpful error message is returned to install the missing library - the expected tree...
[ "def", "_library_not_loaded_test", "(", "tmp_path_factory", ",", "cli_input", ",", "library_name", ",", "library_import_name", ",", "my_caplog", ",", "monkeypatch", ",", ")", ":", "basedir", "=", "tmp_path_factory", ".", "mktemp", "(", "\"test_cli_init_diff\"", ")", ...
[ 14, 0 ]
[ 102, 63 ]
python
en
['en', 'error', 'th']
False
test_init_install_sqlalchemy
(caplog, tmp_path_factory, monkeypatch)
WARNING: THIS TEST IS AWFUL AND WE HATE IT.
WARNING: THIS TEST IS AWFUL AND WE HATE IT.
def test_init_install_sqlalchemy(caplog, tmp_path_factory, monkeypatch): """WARNING: THIS TEST IS AWFUL AND WE HATE IT.""" # This test is as much about changing the entire test environment with side effects as it is about actually testing # the observed behavior. library_import_name = "sqlalchemy" l...
[ "def", "test_init_install_sqlalchemy", "(", "caplog", ",", "tmp_path_factory", ",", "monkeypatch", ")", ":", "# This test is as much about changing the entire test environment with side effects as it is about actually testing", "# the observed behavior.", "library_import_name", "=", "\"s...
[ 114, 0 ]
[ 142, 77 ]
python
en
['en', 'en', 'en']
True
MetaPandasDataset.column_map_expectation
(cls, func)
Constructs an expectation using column-map semantics. The MetaPandasDataset implementation replaces the "column" parameter supplied by the user with a pandas Series object containing the actual column from the relevant pandas dataframe. This simplifies the implementing expectation logic while ...
Constructs an expectation using column-map semantics.
def column_map_expectation(cls, func): """Constructs an expectation using column-map semantics. The MetaPandasDataset implementation replaces the "column" parameter supplied by the user with a pandas Series object containing the actual column from the relevant pandas dataframe. This simplifies...
[ "def", "column_map_expectation", "(", "cls", ",", "func", ")", ":", "argspec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "[", "0", "]", "[", "1", ":", "]", "@", "cls", ".", "expectation", "(", "argspec", ")", "@", "wraps", "(", "func",...
[ 43, 4 ]
[ 159, 28 ]
python
en
['en', 'lb', 'en']
True
MetaPandasDataset.column_pair_map_expectation
(cls, func)
The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a pair of columns.
The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a pair of columns.
def column_pair_map_expectation(cls, func): """ The column_pair_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a pair of columns. """ argspec = inspect.getfullargspec(func)[0...
[ "def", "column_pair_map_expectation", "(", "cls", ",", "func", ")", ":", "argspec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "[", "0", "]", "[", "1", ":", "]", "@", "cls", ".", "expectation", "(", "argspec", ")", "@", "wraps", "(", "f...
[ 162, 4 ]
[ 264, 28 ]
python
en
['en', 'error', 'th']
False
MetaPandasDataset.multicolumn_map_expectation
(cls, func)
The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a set of columns.
The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a set of columns.
def multicolumn_map_expectation(cls, func): """ The multicolumn_map_expectation decorator handles boilerplate issues surrounding the common pattern of evaluating truthiness of some condition on a per row basis across a set of columns. """ argspec = inspect.getfullargspec(func)[0]...
[ "def", "multicolumn_map_expectation", "(", "cls", ",", "func", ")", ":", "argspec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "[", "0", "]", "[", "1", ":", "]", "@", "cls", ".", "expectation", "(", "argspec", ")", "@", "wraps", "(", "f...
[ 267, 4 ]
[ 336, 28 ]
python
en
['en', 'error', 'th']
False
PandasDataset.get_crosstab
( self, column_A, column_B, bins_A=None, bins_B=None, n_bins_A=None, n_bins_B=None, )
Get crosstab of column_A and column_B, binning values if necessary
Get crosstab of column_A and column_B, binning values if necessary
def get_crosstab( self, column_A, column_B, bins_A=None, bins_B=None, n_bins_A=None, n_bins_B=None, ): """Get crosstab of column_A and column_B, binning values if necessary""" series_A = self.get_binned_values(self[column_A], bins_A, n_bins_A) ...
[ "def", "get_crosstab", "(", "self", ",", "column_A", ",", "column_B", ",", "bins_A", "=", "None", ",", "bins_B", "=", "None", ",", "n_bins_A", "=", "None", ",", "n_bins_B", "=", "None", ",", ")", ":", "series_A", "=", "self", ".", "get_binned_values", ...
[ 542, 4 ]
[ 554, 54 ]
python
en
['en', 'en', 'en']
True
PandasDataset.get_binned_values
(self, series, bins, n_bins)
Get binned values of series. Args: Series (pd.Series): Input series bins (list): Bins for the series. List of numeric if series is numeric or list of list of series values else. n_bins (int): Number of bins. Ignored if bins is not Non...
Get binned values of series.
def get_binned_values(self, series, bins, n_bins): """ Get binned values of series. Args: Series (pd.Series): Input series bins (list): Bins for the series. List of numeric if series is numeric or list of list of series values else. ...
[ "def", "get_binned_values", "(", "self", ",", "series", ",", "bins", ",", "n_bins", ")", ":", "if", "n_bins", "is", "None", ":", "n_bins", "=", "10", "if", "series", ".", "dtype", "in", "[", "\"int\"", ",", "\"float\"", "]", ":", "if", "bins", "is", ...
[ 556, 4 ]
[ 617, 13 ]
python
en
['en', 'error', 'th']
False
PandasDataset.expect_column_values_to_be_of_type
( self, column, type_, **kwargs # Since we've now received the default arguments *before* the expectation decorator, we need to # ensure we only pass what we actually received. Hence, we'll use kwargs # mostly=None, # result_format=None, # row_cond...
The pandas implementation of this expectation takes kwargs mostly, result_format, include_config, catch_exceptions, and meta as other expectations, however it declares **kwargs because it needs to be able to fork into either aggregate or map semantics depending on the column type (see below). ...
The pandas implementation of this expectation takes kwargs mostly, result_format, include_config, catch_exceptions, and meta as other expectations, however it declares **kwargs because it needs to be able to fork into either aggregate or map semantics depending on the column type (see below).
def expect_column_values_to_be_of_type( self, column, type_, **kwargs # Since we've now received the default arguments *before* the expectation decorator, we need to # ensure we only pass what we actually received. Hence, we'll use kwargs # mostly=None, # ...
[ "def", "expect_column_values_to_be_of_type", "(", "self", ",", "column", ",", "type_", ",", "*", "*", "kwargs", "# Since we've now received the default arguments *before* the expectation decorator, we need to", "# ensure we only pass what we actually received. Hence, we'll use kwargs", "...
[ 671, 4 ]
[ 782, 18 ]
python
en
['en', 'error', 'th']
False
PandasDataset.expect_column_values_to_be_in_type_list
( self, column, type_list, **kwargs # Since we've now received the default arguments *before* the expectation decorator, we need to # ensure we only pass what we actually received. Hence, we'll use kwargs # mostly=None, # result_format = None, # ro...
The pandas implementation of this expectation takes kwargs mostly, result_format, include_config, catch_exceptions, and meta as other expectations, however it declares **kwargs because it needs to be able to fork into either aggregate or map semantics depending on the column type (see below). ...
The pandas implementation of this expectation takes kwargs mostly, result_format, include_config, catch_exceptions, and meta as other expectations, however it declares **kwargs because it needs to be able to fork into either aggregate or map semantics depending on the column type (see below).
def expect_column_values_to_be_in_type_list( self, column, type_list, **kwargs # Since we've now received the default arguments *before* the expectation decorator, we need to # ensure we only pass what we actually received. Hence, we'll use kwargs # mostly=None, ...
[ "def", "expect_column_values_to_be_in_type_list", "(", "self", ",", "column", ",", "type_list", ",", "*", "*", "kwargs", "# Since we've now received the default arguments *before* the expectation decorator, we need to", "# ensure we only pass what we actually received. Hence, we'll use kwa...
[ 899, 4 ]
[ 1007, 18 ]
python
en
['en', 'error', 'th']
False
PandasDataset.expect_multicolumn_sum_to_equal
( self, column_list, sum_total, result_format=None, include_config=True, catch_exceptions=None, meta=None, )
Multi-Column Map Expectation Expects that sum of all rows for a set of columns is equal to a specific value Args: column_list (List[str]): \ Set of columns to be checked sum_total (int): \ expected sum of columns
Multi-Column Map Expectation
def expect_multicolumn_sum_to_equal( self, column_list, sum_total, result_format=None, include_config=True, catch_exceptions=None, meta=None, ): """ Multi-Column Map Expectation Expects that sum of all rows for a set of columns is equal to a s...
[ "def", "expect_multicolumn_sum_to_equal", "(", "self", ",", "column_list", ",", "sum_total", ",", "result_format", "=", "None", ",", "include_config", "=", "True", ",", "catch_exceptions", "=", "None", ",", "meta", "=", "None", ",", ")", ":", "return", "column...
[ 1856, 4 ]
[ 1875, 51 ]
python
en
['es', 'en', 'en']
True
LegacyDatasource.from_configuration
(cls, **kwargs)
Build a new datasource from a configuration dictionary. Args: **kwargs: configuration key-value pairs Returns: datasource (Datasource): the newly-created datasource
Build a new datasource from a configuration dictionary.
def from_configuration(cls, **kwargs): """ Build a new datasource from a configuration dictionary. Args: **kwargs: configuration key-value pairs Returns: datasource (Datasource): the newly-created datasource """ return cls(**kwargs)
[ "def", "from_configuration", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "return", "cls", "(", "*", "*", "kwargs", ")" ]
[ 113, 4 ]
[ 124, 28 ]
python
en
['en', 'error', 'th']
False
LegacyDatasource.build_configuration
( cls, class_name, module_name="great_expectations.datasource", data_asset_type=None, batch_kwargs_generators=None, **kwargs )
Build a full configuration object for a datasource, potentially including batch kwargs generators with defaults. Args: class_name: The name of the class for which to build the config module_name: The name of the module in which the datasource class is located data_a...
Build a full configuration object for a datasource, potentially including batch kwargs generators with defaults.
def build_configuration( cls, class_name, module_name="great_expectations.datasource", data_asset_type=None, batch_kwargs_generators=None, **kwargs ): """ Build a full configuration object for a datasource, potentially including batch kwargs generators...
[ "def", "build_configuration", "(", "cls", ",", "class_name", ",", "module_name", "=", "\"great_expectations.datasource\"", ",", "data_asset_type", "=", "None", ",", "batch_kwargs_generators", "=", "None", ",", "*", "*", "kwargs", ")", ":", "verify_dynamic_loading_supp...
[ 127, 4 ]
[ 156, 28 ]
python
en
['en', 'error', 'th']
False
LegacyDatasource.__init__
( self, name, data_context=None, data_asset_type=None, batch_kwargs_generators=None, **kwargs )
Build a new datasource. Args: name: the name for the datasource data_context: data context to which to connect data_asset_type (ClassConfig): the type of DataAsset to produce batch_kwargs_generators: BatchKwargGenerators to add to the datasource
Build a new datasource.
def __init__( self, name, data_context=None, data_asset_type=None, batch_kwargs_generators=None, **kwargs ): """ Build a new datasource. Args: name: the name for the datasource data_context: data context to which to con...
[ "def", "__init__", "(", "self", ",", "name", ",", "data_context", "=", "None", ",", "data_asset_type", "=", "None", ",", "batch_kwargs_generators", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_data_context", "=", "data_context", "self", "...
[ 158, 4 ]
[ 188, 88 ]
python
en
['en', 'error', 'th']
False
LegacyDatasource.name
(self)
Property for datasource name
Property for datasource name
def name(self): """ Property for datasource name """ return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 191, 4 ]
[ 195, 25 ]
python
en
['en', 'error', 'th']
False
LegacyDatasource.data_context
(self)
Property for attached DataContext
Property for attached DataContext
def data_context(self): """ Property for attached DataContext """ return self._data_context
[ "def", "data_context", "(", "self", ")", ":", "return", "self", ".", "_data_context" ]
[ 202, 4 ]
[ 206, 33 ]
python
en
['en', 'error', 'th']
False
LegacyDatasource._build_generators
(self)
Build batch kwargs generator objects from the datasource configuration. Returns: None
Build batch kwargs generator objects from the datasource configuration.
def _build_generators(self): """ Build batch kwargs generator objects from the datasource configuration. Returns: None """ try: for generator in self._datasource_config["batch_kwargs_generators"].keys(): self.get_batch_kwargs_generator(gen...
[ "def", "_build_generators", "(", "self", ")", ":", "try", ":", "for", "generator", "in", "self", ".", "_datasource_config", "[", "\"batch_kwargs_generators\"", "]", ".", "keys", "(", ")", ":", "self", ".", "get_batch_kwargs_generator", "(", "generator", ")", "...
[ 208, 4 ]
[ 219, 16 ]
python
en
['en', 'error', 'th']
False