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
UnboundedQueue.get_batch_nowait
(self)
Attempt to get the next batch from the queue, without blocking. Returns: list: A list of dequeued items, in order. On a successful call this list is always non-empty; if it would be empty we raise :exc:`~trio.WouldBlock` instead. Raises: ~trio.WouldBlock...
Attempt to get the next batch from the queue, without blocking.
def get_batch_nowait(self): """Attempt to get the next batch from the queue, without blocking. Returns: list: A list of dequeued items, in order. On a successful call this list is always non-empty; if it would be empty we raise :exc:`~trio.WouldBlock` instead. ...
[ "def", "get_batch_nowait", "(", "self", ")", ":", "if", "not", "self", ".", "_can_get", ":", "raise", "_core", ".", "WouldBlock", "return", "self", ".", "_get_batch_protected", "(", ")" ]
[ 96, 4 ]
[ 110, 42 ]
python
en
['en', 'en', 'en']
True
UnboundedQueue.get_batch
(self)
Get the next batch from the queue, blocking as necessary. Returns: list: A list of dequeued items, in order. This list is always non-empty.
Get the next batch from the queue, blocking as necessary.
async def get_batch(self): """Get the next batch from the queue, blocking as necessary. Returns: list: A list of dequeued items, in order. This list is always non-empty. """ await _core.checkpoint_if_cancelled() if not self._can_get: await se...
[ "async", "def", "get_batch", "(", "self", ")", ":", "await", "_core", ".", "checkpoint_if_cancelled", "(", ")", "if", "not", "self", ".", "_can_get", ":", "await", "self", ".", "_lot", ".", "park", "(", ")", "return", "self", ".", "_get_batch_protected", ...
[ 112, 4 ]
[ 128, 56 ]
python
en
['en', 'en', 'en']
True
UnboundedQueue.statistics
(self)
Return an object containing debugging information. Currently the following fields are defined: * ``qsize``: The number of items currently in the queue. * ``tasks_waiting``: The number of tasks blocked on this queue's :meth:`get_batch` method.
Return an object containing debugging information.
def statistics(self): """Return an object containing debugging information. Currently the following fields are defined: * ``qsize``: The number of items currently in the queue. * ``tasks_waiting``: The number of tasks blocked on this queue's :meth:`get_batch` method. ...
[ "def", "statistics", "(", "self", ")", ":", "return", "_UnboundedQueueStats", "(", "qsize", "=", "len", "(", "self", ".", "_data", ")", ",", "tasks_waiting", "=", "self", ".", "_lot", ".", "statistics", "(", ")", ".", "tasks_waiting", ")" ]
[ 130, 4 ]
[ 142, 9 ]
python
en
['id', 'en', 'en']
True
IRCORS._cors_normalize
(value: Any)
List values get turned into a comma-separated string. Other values are returned unaltered.
List values get turned into a comma-separated string. Other values are returned unaltered.
def _cors_normalize(value: Any) -> Any: """ List values get turned into a comma-separated string. Other values are returned unaltered. """ if type(value) == list: return ", ".join([ str(x) for x in value ]) else: return value
[ "def", "_cors_normalize", "(", "value", ":", "Any", ")", "->", "Any", ":", "if", "type", "(", "value", ")", "==", "list", ":", "return", "\", \"", ".", "join", "(", "[", "str", "(", "x", ")", "for", "x", "in", "value", "]", ")", "else", ":", "r...
[ 68, 4 ]
[ 77, 24 ]
python
en
['en', 'error', 'th']
False
clean_text
(text)
Preprocess text for NLP applications: Lowercase, remove markups :param text: raw text :return: processed tokenized text
Preprocess text for NLP applications: Lowercase, remove markups :param text: raw text :return: processed tokenized text
def clean_text(text): """ Preprocess text for NLP applications: Lowercase, remove markups :param text: raw text :return: processed tokenized text """ # Lowercase text text = text.lower() # Remove carriage returns and new lines text = re.sub('\r?\n|\r', ' ', text) # Remove Trade...
[ "def", "clean_text", "(", "text", ")", ":", "# Lowercase text", "text", "=", "text", ".", "lower", "(", ")", "# Remove carriage returns and new lines", "text", "=", "re", ".", "sub", "(", "'\\r?\\n|\\r'", ",", "' '", ",", "text", ")", "# Remove Trademarks, Copyr...
[ 19, 0 ]
[ 34, 15 ]
python
en
['en', 'error', 'th']
False
remove_custom_stopwords
(text)
Removes custom stopwords from text :param text: :return:
Removes custom stopwords from text :param text: :return:
def remove_custom_stopwords(text): """ Removes custom stopwords from text :param text: :return: """ tokens = spacy_tokenization(text) tokens_no_stop = [token for token in tokens if token not in custom_stop_words] return ' '.join(tokens_no_stop)
[ "def", "remove_custom_stopwords", "(", "text", ")", ":", "tokens", "=", "spacy_tokenization", "(", "text", ")", "tokens_no_stop", "=", "[", "token", "for", "token", "in", "tokens", "if", "token", "not", "in", "custom_stop_words", "]", "return", "' '", ".", "...
[ 37, 0 ]
[ 48, 35 ]
python
en
['en', 'error', 'th']
False
spacy_tokenization
(text)
Leverage SpaCy for tokenization :param text: :return:
Leverage SpaCy for tokenization :param text: :return:
def spacy_tokenization(text): """ Leverage SpaCy for tokenization :param text: :return: """ doc = nlp(text) tokens = [] for token in doc: if not token.is_punct: tokens.append(token.text) return tokens
[ "def", "spacy_tokenization", "(", "text", ")", ":", "doc", "=", "nlp", "(", "text", ")", "tokens", "=", "[", "]", "for", "token", "in", "doc", ":", "if", "not", "token", ".", "is_punct", ":", "tokens", ".", "append", "(", "token", ".", "text", ")",...
[ 51, 0 ]
[ 66, 17 ]
python
en
['en', 'error', 'th']
False
spacy_embedding
(iterable_of_text, nlp=nlp)
Embed text with SpaCy :param iterable_of_text: :param nlp: SpaCy Model, default to en_core_web_lg :return: Mapped vectors from SpaCy simplex
Embed text with SpaCy :param iterable_of_text: :param nlp: SpaCy Model, default to en_core_web_lg :return: Mapped vectors from SpaCy simplex
def spacy_embedding(iterable_of_text, nlp=nlp): """ Embed text with SpaCy :param iterable_of_text: :param nlp: SpaCy Model, default to en_core_web_lg :return: Mapped vectors from SpaCy simplex """ counter = 0 embeddings = [] for iterable in iterable_of_text: embeddings.appe...
[ "def", "spacy_embedding", "(", "iterable_of_text", ",", "nlp", "=", "nlp", ")", ":", "counter", "=", "0", "embeddings", "=", "[", "]", "for", "iterable", "in", "iterable_of_text", ":", "embeddings", ".", "append", "(", "nlp", "(", "iterable", ")", ".", "...
[ 69, 0 ]
[ 90, 17 ]
python
en
['en', 'error', 'th']
False
test_golden_path_sql_datasource_configuration
( mock_emit, empty_data_context_stats_enabled, sa, test_connectable_postgresql_db )
Tests the golden path for setting up a StreamlinedSQLDatasource using test_yaml_config
Tests the golden path for setting up a StreamlinedSQLDatasource using test_yaml_config
def test_golden_path_sql_datasource_configuration( mock_emit, empty_data_context_stats_enabled, sa, test_connectable_postgresql_db ): """Tests the golden path for setting up a StreamlinedSQLDatasource using test_yaml_config""" context: DataContext = empty_data_context_stats_enabled os.chdir(context.roo...
[ "def", "test_golden_path_sql_datasource_configuration", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ",", "sa", ",", "test_connectable_postgresql_db", ")", ":", "context", ":", "DataContext", "=", "empty_data_context_stats_enabled", "os", ".", "chdir", "(", "c...
[ 619, 0 ]
[ 713, 17 ]
python
en
['en', 'en', 'en']
True
test_golden_path_inferred_asset_pandas_datasource_configuration
( mock_emit, empty_data_context_stats_enabled, test_df, tmp_path_factory )
Tests the golden path for InferredAssetFilesystemDataConnector with PandasExecutionEngine using test_yaml_config
Tests the golden path for InferredAssetFilesystemDataConnector with PandasExecutionEngine using test_yaml_config
def test_golden_path_inferred_asset_pandas_datasource_configuration( mock_emit, empty_data_context_stats_enabled, test_df, tmp_path_factory ): """ Tests the golden path for InferredAssetFilesystemDataConnector with PandasExecutionEngine using test_yaml_config """ base_directory = str( tmp_pa...
[ "def", "test_golden_path_inferred_asset_pandas_datasource_configuration", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ",", "test_df", ",", "tmp_path_factory", ")", ":", "base_directory", "=", "str", "(", "tmp_path_factory", ".", "mktemp", "(", "\"test_golden_pa...
[ 730, 0 ]
[ 895, 36 ]
python
en
['en', 'error', 'th']
False
test_golden_path_configured_asset_pandas_datasource_configuration
( mock_emit, empty_data_context_stats_enabled, test_df, tmp_path_factory )
Tests the golden path for InferredAssetFilesystemDataConnector with PandasExecutionEngine using test_yaml_config
Tests the golden path for InferredAssetFilesystemDataConnector with PandasExecutionEngine using test_yaml_config
def test_golden_path_configured_asset_pandas_datasource_configuration( mock_emit, empty_data_context_stats_enabled, test_df, tmp_path_factory ): """ Tests the golden path for InferredAssetFilesystemDataConnector with PandasExecutionEngine using test_yaml_config """ base_directory = str( tmp_...
[ "def", "test_golden_path_configured_asset_pandas_datasource_configuration", "(", "mock_emit", ",", "empty_data_context_stats_enabled", ",", "test_df", ",", "tmp_path_factory", ")", ":", "base_directory", "=", "str", "(", "tmp_path_factory", ".", "mktemp", "(", "\"test_golden_...
[ 901, 0 ]
[ 1093, 36 ]
python
en
['en', 'error', 'th']
False
is_token_subtype
(ttype, other)
Return True if ``ttype`` is a subtype of ``other``. exists for backwards compatibility. use ``ttype in other`` now.
Return True if ``ttype`` is a subtype of ``other``.
def is_token_subtype(ttype, other): """ Return True if ``ttype`` is a subtype of ``other``. exists for backwards compatibility. use ``ttype in other`` now. """ return ttype in other
[ "def", "is_token_subtype", "(", "ttype", ",", "other", ")", ":", "return", "ttype", "in", "other" ]
[ 84, 0 ]
[ 90, 25 ]
python
en
['en', 'error', 'th']
False
string_to_tokentype
(s)
Convert a string into a token type:: >>> string_to_token('String.Double') Token.Literal.String.Double >>> string_to_token('Token.Literal.Number') Token.Literal.Number >>> string_to_token('') Token Tokens that are already tokens are returned unchanged: ...
Convert a string into a token type::
def string_to_tokentype(s): """ Convert a string into a token type:: >>> string_to_token('String.Double') Token.Literal.String.Double >>> string_to_token('Token.Literal.Number') Token.Literal.Number >>> string_to_token('') Token Tokens that are already token...
[ "def", "string_to_tokentype", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "_TokenType", ")", ":", "return", "s", "if", "not", "s", ":", "return", "Token", "node", "=", "Token", "for", "item", "in", "s", ".", "split", "(", "'.'", ")", ":"...
[ 93, 0 ]
[ 116, 15 ]
python
en
['en', 'error', 'th']
False
infer_camera_intrinsics
(points2d, points3d)
Infer camera instrinsics from 2D<->3D point correspondences.
Infer camera instrinsics from 2D<->3D point correspondences.
def infer_camera_intrinsics(points2d, points3d): """Infer camera instrinsics from 2D<->3D point correspondences.""" pose2d = points2d.reshape(-1, 2) pose3d = points3d.reshape(-1, 3) x3d = np.stack([pose3d[:, 0], pose3d[:, 2]], axis=-1) x2d = (pose2d[:, 0] * pose3d[:, 2]) alpha_x, x_0 = list(np.l...
[ "def", "infer_camera_intrinsics", "(", "points2d", ",", "points3d", ")", ":", "pose2d", "=", "points2d", ".", "reshape", "(", "-", "1", ",", "2", ")", "pose3d", "=", "points3d", ".", "reshape", "(", "-", "1", ",", "3", ")", "x3d", "=", "np", ".", "...
[ 56, 0 ]
[ 66, 49 ]
python
en
['en', 'en', 'en']
True
project_to_2d
(X, camera_params)
Project 3D points to 2D using the Human3.6M camera projection function. This is a differentiable and batched reimplementation of the original MATLAB script. Arguments: X -- 3D points in *camera space* to transform (N, *, 3) camera_params -- intrinsic parameteres (N, 2+2+3+2=9)
Project 3D points to 2D using the Human3.6M camera projection function. This is a differentiable and batched reimplementation of the original MATLAB script.
def project_to_2d(X, camera_params): """ Project 3D points to 2D using the Human3.6M camera projection function. This is a differentiable and batched reimplementation of the original MATLAB script. Arguments: X -- 3D points in *camera space* to transform (N, *, 3) camera_params -- intrinsic par...
[ "def", "project_to_2d", "(", "X", ",", "camera_params", ")", ":", "assert", "X", ".", "shape", "[", "-", "1", "]", "==", "3", "assert", "len", "(", "camera_params", ".", "shape", ")", "==", "2", "assert", "camera_params", ".", "shape", "[", "-", "1",...
[ 69, 0 ]
[ 100, 22 ]
python
en
['en', 'error', 'th']
False
project_to_2d_linear
(X, camera_params)
Project 3D points to 2D using only linear parameters (focal length and principal point). Arguments: X -- 3D points in *camera space* to transform (N, *, 3) camera_params -- intrinsic parameteres (N, 2+2+3+2=9)
Project 3D points to 2D using only linear parameters (focal length and principal point).
def project_to_2d_linear(X, camera_params): """ Project 3D points to 2D using only linear parameters (focal length and principal point). Arguments: X -- 3D points in *camera space* to transform (N, *, 3) camera_params -- intrinsic parameteres (N, 2+2+3+2=9) """ assert X.shape[-1] == 3 a...
[ "def", "project_to_2d_linear", "(", "X", ",", "camera_params", ")", ":", "assert", "X", ".", "shape", "[", "-", "1", "]", "==", "3", "assert", "len", "(", "camera_params", ".", "shape", ")", "==", "2", "assert", "camera_params", ".", "shape", "[", "-",...
[ 103, 0 ]
[ 129, 21 ]
python
en
['en', 'error', 'th']
False
reprojection
(pose_3d, abs_depth, camera)
:param pose_3d: predicted 3d or normed 3d with pixel unit :param abs_depth: absolute depth root Z in the camera coordinate :param camera: camera intrinsic parameters :return: 3d pose in the camera cooridinate with millimeter unit, root joint: zero-center
:param pose_3d: predicted 3d or normed 3d with pixel unit :param abs_depth: absolute depth root Z in the camera coordinate :param camera: camera intrinsic parameters :return: 3d pose in the camera cooridinate with millimeter unit, root joint: zero-center
def reprojection(pose_3d, abs_depth, camera): """ :param pose_3d: predicted 3d or normed 3d with pixel unit :param abs_depth: absolute depth root Z in the camera coordinate :param camera: camera intrinsic parameters :return: 3d pose in the camera cooridinate with millimeter unit, root joint: zero-ce...
[ "def", "reprojection", "(", "pose_3d", ",", "abs_depth", ",", "camera", ")", ":", "camera", "=", "camera", ".", "unsqueeze", "(", "dim", "=", "1", ")", ".", "unsqueeze", "(", "dim", "=", "1", ")", "cx", ",", "cy", ",", "fx", ",", "fy", "=", "came...
[ 132, 0 ]
[ 147, 19 ]
python
en
['en', 'error', 'th']
False
BaseDRIVLearner.__init__
( self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=0.05, control_name=0, )
Initialize a DR-learner. Args: learner (optional): a model to estimate outcomes and treatment effects in both the control and treatment groups control_outcome_learner (optional): a model to estimate outcomes in the control group treatment_outcome_learner (opt...
Initialize a DR-learner.
def __init__( self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=0.05, control_name=0, ): """Initialize a DR-learner. Args: learner (optional): a model to esti...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "control_outcome_learner", "=", "None", ",", "treatment_outcome_learner", "=", "None", ",", "treatment_effect_learner", "=", "None", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ...
[ 29, 4 ]
[ 76, 37 ]
python
en
['en', 'en', 'it']
True
BaseDRIVLearner.fit
( self, X, assignment, treatment, y, p=None, pZ=None, seed=None, calibrate=True )
Fit the inference model. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix assignment (np.array or pd.Series): a (0,1)-valued assignment vector. The assignment is the instrumental variable that does not depend on unknown confounders. The assignment status...
Fit the inference model.
def fit( self, X, assignment, treatment, y, p=None, pZ=None, seed=None, calibrate=True ): """Fit the inference model. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix assignment (np.array or pd.Series): a (0,1)-valued assignment vector. The assignmen...
[ "def", "fit", "(", "self", ",", "X", ",", "assignment", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "pZ", "=", "None", ",", "seed", "=", "None", ",", "calibrate", "=", "True", ")", ":", "X", ",", "treatment", ",", "assignment", ",", ...
[ 90, 4 ]
[ 266, 88 ]
python
en
['en', 'en', 'en']
True
BaseDRIVLearner.predict
(self, X, treatment=None, y=None, return_components=False, verbose=True)
Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Series, optional): an outcome vector verbose (bool, optional): whether to output progres...
Predict treatment effects.
def predict(self, X, treatment=None, y=None, return_components=False, verbose=True): """Predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix treatment (np.array or pd.Series, optional): a treatment vector y (np.array or pd.Seri...
[ "def", "predict", "(", "self", ",", "X", ",", "treatment", "=", "None", ",", "y", "=", "None", ",", "return_components", "=", "False", ",", "verbose", "=", "True", ")", ":", "X", ",", "treatment", ",", "y", "=", "convert_pd_to_np", "(", "X", ",", "...
[ 268, 4 ]
[ 314, 39 ]
python
en
['fr', 'en', 'en']
True
BaseDRIVLearner.fit_predict
( self, X, assignment, treatment, y, p=None, pZ=None, return_ci=False, n_bootstraps=1000, bootstrap_size=10000, return_components=False, verbose=True, seed=None, calibrate=True, )
Fit the treatment effect and outcome models of the R learner and predict treatment effects. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix assignment (np.array or pd.Series): a (0,1)-valued assignment vector. The assignment is the instrumental variable...
Fit the treatment effect and outcome models of the R learner and predict treatment effects.
def fit_predict( self, X, assignment, treatment, y, p=None, pZ=None, return_ci=False, n_bootstraps=1000, bootstrap_size=10000, return_components=False, verbose=True, seed=None, calibrate=True, ): ...
[ "def", "fit_predict", "(", "self", ",", "X", ",", "assignment", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "pZ", "=", "None", ",", "return_ci", "=", "False", ",", "n_bootstraps", "=", "1000", ",", "bootstrap_size", "=", "10000", ",", "re...
[ 316, 4 ]
[ 425, 43 ]
python
en
['en', 'en', 'en']
True
BaseDRIVLearner.estimate_ate
( self, X, assignment, treatment, y, p=None, pz=None, bootstrap_ci=False, n_bootstraps=1000, bootstrap_size=10000, seed=None, calibrate=True, )
Estimate the Average Treatment Effect (ATE) for compliers. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix assignment (np.array or pd.Series): an assignment vector. The assignment is the instrumental variable that does not depend on unknown confounders....
Estimate the Average Treatment Effect (ATE) for compliers.
def estimate_ate( self, X, assignment, treatment, y, p=None, pz=None, bootstrap_ci=False, n_bootstraps=1000, bootstrap_size=10000, seed=None, calibrate=True, ): """Estimate the Average Treatment Effect (ATE) for ...
[ "def", "estimate_ate", "(", "self", ",", "X", ",", "assignment", ",", "treatment", ",", "y", ",", "p", "=", "None", ",", "pz", "=", "None", ",", "bootstrap_ci", "=", "False", ",", "n_bootstraps", "=", "1000", ",", "bootstrap_size", "=", "10000", ",", ...
[ 427, 4 ]
[ 589, 44 ]
python
en
['en', 'en', 'en']
True
BaseDRIVLearner.bootstrap
(self, X, assignment, treatment, y, p, pZ, size=10000, seed=None)
Runs a single bootstrap. Fits on bootstrapped sample, then predicts on whole population.
Runs a single bootstrap. Fits on bootstrapped sample, then predicts on whole population.
def bootstrap(self, X, assignment, treatment, y, p, pZ, size=10000, seed=None): """Runs a single bootstrap. Fits on bootstrapped sample, then predicts on whole population.""" idxs = np.random.choice(np.arange(0, X.shape[0]), size=size) X_b = X[idxs] if isinstance(p[0], (np.ndarray, pd.S...
[ "def", "bootstrap", "(", "self", ",", "X", ",", "assignment", ",", "treatment", ",", "y", ",", "p", ",", "pZ", ",", "size", "=", "10000", ",", "seed", "=", "None", ")", ":", "idxs", "=", "np", ".", "random", ".", "choice", "(", "np", ".", "aran...
[ 591, 4 ]
[ 619, 19 ]
python
en
['en', 'en', 'en']
True
BaseDRIVLearner.get_importance
( self, X=None, tau=None, model_tau_feature=None, features=None, method="auto", normalize=True, test_size=0.3, random_state=None, )
Builds a model (using X to predict estimated/actual tau), and then calculates feature importances based on a specified method. Currently supported methods are: - auto (calculates importance based on estimator's default implementation of feature importance; estim...
Builds a model (using X to predict estimated/actual tau), and then calculates feature importances based on a specified method.
def get_importance( self, X=None, tau=None, model_tau_feature=None, features=None, method="auto", normalize=True, test_size=0.3, random_state=None, ): """ Builds a model (using X to predict estimated/actual tau), and then calcul...
[ "def", "get_importance", "(", "self", ",", "X", "=", "None", ",", "tau", "=", "None", ",", "model_tau_feature", "=", "None", ",", "features", "=", "None", ",", "method", "=", "\"auto\"", ",", "normalize", "=", "True", ",", "test_size", "=", "0.3", ",",...
[ 621, 4 ]
[ 669, 41 ]
python
en
['en', 'error', 'th']
False
BaseDRIVLearner.get_shap_values
(self, X=None, model_tau_feature=None, tau=None, features=None)
Builds a model (using X to predict estimated/actual tau), and then calculates shapley values. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix tau (np.array): a treatment effect vector (estimated/actual) model_tau_feature (sklearn/lightgbm/xgboost mo...
Builds a model (using X to predict estimated/actual tau), and then calculates shapley values. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix tau (np.array): a treatment effect vector (estimated/actual) model_tau_feature (sklearn/lightgbm/xgboost mo...
def get_shap_values(self, X=None, model_tau_feature=None, tau=None, features=None): """ Builds a model (using X to predict estimated/actual tau), and then calculates shapley values. Args: X (np.matrix or np.array or pd.Dataframe): a feature matrix tau (np.array): a treatm...
[ "def", "get_shap_values", "(", "self", ",", "X", "=", "None", ",", "model_tau_feature", "=", "None", ",", "tau", "=", "None", ",", "features", "=", "None", ")", ":", "explainer", "=", "Explainer", "(", "method", "=", "\"shapley\"", ",", "control_name", "...
[ 671, 4 ]
[ 689, 42 ]
python
en
['en', 'error', 'th']
False
BaseDRIVLearner.plot_importance
( self, X=None, tau=None, model_tau_feature=None, features=None, method="auto", normalize=True, test_size=0.3, random_state=None, )
Builds a model (using X to predict estimated/actual tau), and then plots feature importances based on a specified method. Currently supported methods are: - auto (calculates importance based on estimator's default implementation of feature importance; estimator ...
Builds a model (using X to predict estimated/actual tau), and then plots feature importances based on a specified method.
def plot_importance( self, X=None, tau=None, model_tau_feature=None, features=None, method="auto", normalize=True, test_size=0.3, random_state=None, ): """ Builds a model (using X to predict estimated/actual tau), and then plots...
[ "def", "plot_importance", "(", "self", ",", "X", "=", "None", ",", "tau", "=", "None", ",", "model_tau_feature", "=", "None", ",", "features", "=", "None", ",", "method", "=", "\"auto\"", ",", "normalize", "=", "True", ",", "test_size", "=", "0.3", ","...
[ 691, 4 ]
[ 739, 35 ]
python
en
['en', 'error', 'th']
False
BaseDRIVLearner.plot_shap_values
( self, X=None, tau=None, model_tau_feature=None, features=None, shap_dict=None, **kwargs )
Plots distribution of shapley values. If shapley values have been pre-computed, pass it through the shap_dict parameter. If shap_dict is not provided, this builds a new model (using X to predict estimated/actual tau), and then calculates shapley values. Args: X (np...
Plots distribution of shapley values.
def plot_shap_values( self, X=None, tau=None, model_tau_feature=None, features=None, shap_dict=None, **kwargs ): """ Plots distribution of shapley values. If shapley values have been pre-computed, pass it through the shap_dict paramete...
[ "def", "plot_shap_values", "(", "self", ",", "X", "=", "None", ",", "tau", "=", "None", ",", "model_tau_feature", "=", "None", ",", "features", "=", "None", ",", "shap_dict", "=", "None", ",", "*", "*", "kwargs", ")", ":", "override_checks", "=", "Fals...
[ 741, 4 ]
[ 775, 55 ]
python
en
['en', 'error', 'th']
False
BaseDRIVLearner.plot_shap_dependence
( self, treatment_group, feature_idx, X, tau, model_tau_feature=None, features=None, shap_dict=None, interaction_idx="auto", **kwargs )
Plots dependency of shapley values for a specified feature, colored by an interaction feature. If shapley values have been pre-computed, pass it through the shap_dict parameter. If shap_dict is not provided, this builds a new model (using X to predict estimated/actual tau), and then ca...
Plots dependency of shapley values for a specified feature, colored by an interaction feature.
def plot_shap_dependence( self, treatment_group, feature_idx, X, tau, model_tau_feature=None, features=None, shap_dict=None, interaction_idx="auto", **kwargs ): """ Plots dependency of shapley values for a specified feat...
[ "def", "plot_shap_dependence", "(", "self", ",", "treatment_group", ",", "feature_idx", ",", "X", ",", "tau", ",", "model_tau_feature", "=", "None", ",", "features", "=", "None", ",", "shap_dict", "=", "None", ",", "interaction_idx", "=", "\"auto\"", ",", "*...
[ 777, 4 ]
[ 831, 9 ]
python
en
['en', 'error', 'th']
False
BaseDRIVRegressor.__init__
( self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=0.05, control_name=0, )
Initialize a DRIV-learner regressor. Args: learner (optional): a model to estimate outcomes and treatment effects in both the control and treatment groups control_outcome_learner (optional): a model to estimate outcomes in the control group treatment_outcome_...
Initialize a DRIV-learner regressor.
def __init__( self, learner=None, control_outcome_learner=None, treatment_outcome_learner=None, treatment_effect_learner=None, ate_alpha=0.05, control_name=0, ): """Initialize a DRIV-learner regressor. Args: learner (optional): a m...
[ "def", "__init__", "(", "self", ",", "learner", "=", "None", ",", "control_outcome_learner", "=", "None", ",", "treatment_outcome_learner", "=", "None", ",", "treatment_effect_learner", "=", "None", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ...
[ 839, 4 ]
[ 868, 9 ]
python
co
['en', 'co', 'it']
False
XGBDRIVRegressor.__init__
(self, ate_alpha=0.05, control_name=0, *args, **kwargs)
Initialize a DRIV-learner with two XGBoost models.
Initialize a DRIV-learner with two XGBoost models.
def __init__(self, ate_alpha=0.05, control_name=0, *args, **kwargs): """Initialize a DRIV-learner with two XGBoost models.""" super().__init__( learner=XGBRegressor(*args, **kwargs), ate_alpha=ate_alpha, control_name=control_name, )
[ "def", "__init__", "(", "self", ",", "ate_alpha", "=", "0.05", ",", "control_name", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "learner", "=", "XGBRegressor", "(", "*", "args", ",", "*", ...
[ 872, 4 ]
[ 878, 9 ]
python
en
['en', 'en', 'en']
True
open_ssl_over_tcp_stream
( host, port, *, https_compatible=False, ssl_context=None, # No trailing comma b/c bpo-9232 (fixed in py36) happy_eyeballs_delay=DEFAULT_DELAY, )
Make a TLS-encrypted Connection to the given host and port over TCP. This is a convenience wrapper that calls :func:`open_tcp_stream` and wraps the result in an :class:`~trio.SSLStream`. This function does not perform the TLS handshake; you can do it manually by calling :meth:`~trio.SSLStream.do_hands...
Make a TLS-encrypted Connection to the given host and port over TCP.
async def open_ssl_over_tcp_stream( host, port, *, https_compatible=False, ssl_context=None, # No trailing comma b/c bpo-9232 (fixed in py36) happy_eyeballs_delay=DEFAULT_DELAY, ): """Make a TLS-encrypted Connection to the given host and port over TCP. This is a convenience wrapper ...
[ "async", "def", "open_ssl_over_tcp_stream", "(", "host", ",", "port", ",", "*", ",", "https_compatible", "=", "False", ",", "ssl_context", "=", "None", ",", "# No trailing comma b/c bpo-9232 (fixed in py36)", "happy_eyeballs_delay", "=", "DEFAULT_DELAY", ",", ")", ":"...
[ 15, 0 ]
[ 57, 5 ]
python
en
['en', 'en', 'en']
True
open_ssl_over_tcp_listeners
( port, ssl_context, *, host=None, https_compatible=False, backlog=None )
Start listening for SSL/TLS-encrypted TCP connections to the given port. Args: port (int): The port to listen on. See :func:`open_tcp_listeners`. ssl_context (~ssl.SSLContext): The SSL context to use for all incoming connections. host (str, bytes, or None): The address to bind to; use `...
Start listening for SSL/TLS-encrypted TCP connections to the given port.
async def open_ssl_over_tcp_listeners( port, ssl_context, *, host=None, https_compatible=False, backlog=None ): """Start listening for SSL/TLS-encrypted TCP connections to the given port. Args: port (int): The port to listen on. See :func:`open_tcp_listeners`. ssl_context (~ssl.SSLContext): The...
[ "async", "def", "open_ssl_over_tcp_listeners", "(", "port", ",", "ssl_context", ",", "*", ",", "host", "=", "None", ",", "https_compatible", "=", "False", ",", "backlog", "=", "None", ")", ":", "tcp_listeners", "=", "await", "trio", ".", "open_tcp_listeners", ...
[ 60, 0 ]
[ 80, 24 ]
python
en
['en', 'en', 'en']
True
serve_ssl_over_tcp
( handler, port, ssl_context, *, host=None, https_compatible=False, backlog=None, handler_nursery=None, task_status=trio.TASK_STATUS_IGNORED, )
Listen for incoming TCP connections, and for each one start a task running ``handler(stream)``. This is a thin convenience wrapper around :func:`open_ssl_over_tcp_listeners` and :func:`serve_listeners` – see them for full details. .. warning:: If ``handler`` raises an exception, then this ...
Listen for incoming TCP connections, and for each one start a task running ``handler(stream)``.
async def serve_ssl_over_tcp( handler, port, ssl_context, *, host=None, https_compatible=False, backlog=None, handler_nursery=None, task_status=trio.TASK_STATUS_IGNORED, ): """Listen for incoming TCP connections, and for each one start a task running ``handler(stream)``. ...
[ "async", "def", "serve_ssl_over_tcp", "(", "handler", ",", "port", ",", "ssl_context", ",", "*", ",", "host", "=", "None", ",", "https_compatible", "=", "False", ",", "backlog", "=", "None", ",", "handler_nursery", "=", "None", ",", "task_status", "=", "tr...
[ 83, 0 ]
[ 150, 5 ]
python
en
['en', 'en', 'en']
True
JsonSchemaProfiler._create_boolean_expectation
( self, key: str, details: dict )
https://json-schema.org/understanding-json-schema/reference/boolean.html
https://json-schema.org/understanding-json-schema/reference/boolean.html
def _create_boolean_expectation( self, key: str, details: dict ) -> Optional[ExpectationConfiguration]: """https://json-schema.org/understanding-json-schema/reference/boolean.html""" object_types = self._get_object_types(details=details) if JsonSchemaTypes.BOOLEAN.value not in objec...
[ "def", "_create_boolean_expectation", "(", "self", ",", "key", ":", "str", ",", "details", ":", "dict", ")", "->", "Optional", "[", "ExpectationConfiguration", "]", ":", "object_types", "=", "self", ".", "_get_object_types", "(", "details", "=", "details", ")"...
[ 196, 4 ]
[ 207, 84 ]
python
de
['de', 'de', 'nl']
False
JsonSchemaProfiler._create_range_expectation
( self, key: str, details: dict )
https://json-schema.org/understanding-json-schema/reference/numeric.html#range
https://json-schema.org/understanding-json-schema/reference/numeric.html#range
def _create_range_expectation( self, key: str, details: dict ) -> Optional[ExpectationConfiguration]: """https://json-schema.org/understanding-json-schema/reference/numeric.html#range""" object_types = self._get_object_types(details=details) object_types = filter( lambda ...
[ "def", "_create_range_expectation", "(", "self", ",", "key", ":", "str", ",", "details", ":", "dict", ")", "->", "Optional", "[", "ExpectationConfiguration", "]", ":", "object_types", "=", "self", ".", "_get_object_types", "(", "details", "=", "details", ")", ...
[ 209, 4 ]
[ 268, 85 ]
python
de
['de', 'de', 'sw']
False
JsonSchemaProfiler._create_string_length_expectation
( self, key: str, details: dict )
https://json-schema.org/understanding-json-schema/reference/string.html#length
https://json-schema.org/understanding-json-schema/reference/string.html#length
def _create_string_length_expectation( self, key: str, details: dict ) -> Optional[ExpectationConfiguration]: """https://json-schema.org/understanding-json-schema/reference/string.html#length""" object_types = self._get_object_types(details=details) if JsonSchemaTypes.STRING.value n...
[ "def", "_create_string_length_expectation", "(", "self", ",", "key", ":", "str", ",", "details", ":", "dict", ")", "->", "Optional", "[", "ExpectationConfiguration", "]", ":", "object_types", "=", "self", ".", "_get_object_types", "(", "details", "=", "details",...
[ 270, 4 ]
[ 314, 9 ]
python
de
['de', 'de', 'en']
False
JsonSchemaProfiler._create_set_expectation
( self, key: str, details: dict )
https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values
https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values
def _create_set_expectation( self, key: str, details: dict ) -> Optional[ExpectationConfiguration]: """https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values""" enum_list = self._get_enum_list(details=details) if not enum_list: return ...
[ "def", "_create_set_expectation", "(", "self", ",", "key", ":", "str", ",", "details", ":", "dict", ")", "->", "Optional", "[", "ExpectationConfiguration", "]", ":", "enum_list", "=", "self", ".", "_get_enum_list", "(", "details", "=", "details", ")", "if", ...
[ 316, 4 ]
[ 330, 84 ]
python
de
['de', 'de', 'en']
False
JsonSchemaProfiler._create_null_or_not_null_column_expectation
( self, key: str, details: dict )
https://json-schema.org/understanding-json-schema/reference/null.html
https://json-schema.org/understanding-json-schema/reference/null.html
def _create_null_or_not_null_column_expectation( self, key: str, details: dict ) -> Optional[ExpectationConfiguration]: """https://json-schema.org/understanding-json-schema/reference/null.html""" object_types = self._get_object_types(details=details) enum_list = self._get_enum_list(d...
[ "def", "_create_null_or_not_null_column_expectation", "(", "self", ",", "key", ":", "str", ",", "details", ":", "dict", ")", "->", "Optional", "[", "ExpectationConfiguration", "]", ":", "object_types", "=", "self", ".", "_get_object_types", "(", "details", "=", ...
[ 332, 4 ]
[ 351, 19 ]
python
de
['de', 'de', 'en']
False
deltas
(errors, epsilon, mean, std)
Compute mean and std deltas. delta_mean = mean(errors) - mean(all errors below epsilon) delta_std = std(errors) - std(all errors below epsilon) Args: errors (ndarray): Array of errors. epsilon (ndarray): Threshold value. mean (float): Mean of err...
Compute mean and std deltas.
def deltas(errors, epsilon, mean, std): """Compute mean and std deltas. delta_mean = mean(errors) - mean(all errors below epsilon) delta_std = std(errors) - std(all errors below epsilon) Args: errors (ndarray): Array of errors. epsilon (ndarray): Threshold value...
[ "def", "deltas", "(", "errors", ",", "epsilon", ",", "mean", ",", "std", ")", ":", "below", "=", "errors", "[", "errors", "<=", "epsilon", "]", "if", "not", "len", "(", "below", ")", ":", "return", "0", ",", "0", "return", "mean", "-", "below", "...
[ 10, 0 ]
[ 35, 49 ]
python
en
['en', 'es', 'en']
True
count_above
(errors, epsilon)
Count number of errors and continuous sequences above epsilon. Continuous sequences are counted by shifting and counting the number of positions where there was a change and the original value was true, which means that a sequence started at that position. Args: errors (ndarray): A...
Count number of errors and continuous sequences above epsilon.
def count_above(errors, epsilon): """Count number of errors and continuous sequences above epsilon. Continuous sequences are counted by shifting and counting the number of positions where there was a change and the original value was true, which means that a sequence started at that position. Args...
[ "def", "count_above", "(", "errors", ",", "epsilon", ")", ":", "above", "=", "errors", ">", "epsilon", "total_above", "=", "len", "(", "errors", "[", "above", "]", ")", "above", "=", "pd", ".", "Series", "(", "above", ")", "shift", "=", "above", ".",...
[ 38, 0 ]
[ 65, 41 ]
python
en
['en', 'en', 'en']
True
z_cost
(z, errors, mean, std)
Compute how bad a z value is. The original formula is:: (delta_mean/mean) + (delta_std/std) ------------------------------------------------------ number of errors above + (number of sequences above)^2 which computes the "goodness" of `z`, meaning that the higher the value ...
Compute how bad a z value is.
def z_cost(z, errors, mean, std): """Compute how bad a z value is. The original formula is:: (delta_mean/mean) + (delta_std/std) ------------------------------------------------------ number of errors above + (number of sequences above)^2 which computes the "goodness" of ...
[ "def", "z_cost", "(", "z", ",", "errors", ",", "mean", ",", "std", ")", ":", "epsilon", "=", "mean", "+", "z", "*", "std", "delta_mean", ",", "delta_std", "=", "deltas", "(", "errors", ",", "epsilon", ",", "mean", ",", "std", ")", "above", ",", "...
[ 68, 0 ]
[ 108, 34 ]
python
en
['en', 'en', 'en']
True
_find_threshold
(errors, z_range)
Find the ideal threshold. The ideal threshold is the one that minimizes the z_cost function. Scipy.fmin is used to find the minimum, using the values from z_range as starting points. Args: errors (ndarray): Array of errors. z_range (list): List of two values denotin...
Find the ideal threshold.
def _find_threshold(errors, z_range): """Find the ideal threshold. The ideal threshold is the one that minimizes the z_cost function. Scipy.fmin is used to find the minimum, using the values from z_range as starting points. Args: errors (ndarray): Array of errors. z_range (...
[ "def", "_find_threshold", "(", "errors", ",", "z_range", ")", ":", "mean", "=", "errors", ".", "mean", "(", ")", "std", "=", "errors", ".", "std", "(", ")", "min_z", ",", "max_z", "=", "z_range", "best_z", "=", "min_z", "best_cost", "=", "np", ".", ...
[ 111, 0 ]
[ 140, 30 ]
python
en
['en', 'en', 'en']
True
_fixed_threshold
(errors, k=4)
Calculate the threshold. The fixed threshold is defined as k standard deviations away from the mean. Args: errors (ndarray): Array of errors. Returns: float: Calculated threshold value.
Calculate the threshold.
def _fixed_threshold(errors, k=4): """Calculate the threshold. The fixed threshold is defined as k standard deviations away from the mean. Args: errors (ndarray): Array of errors. Returns: float: Calculated threshold value. """ mean = errors.mean() ...
[ "def", "_fixed_threshold", "(", "errors", ",", "k", "=", "4", ")", ":", "mean", "=", "errors", ".", "mean", "(", ")", "std", "=", "errors", ".", "std", "(", ")", "return", "mean", "+", "k", "*", "std" ]
[ 143, 0 ]
[ 159, 25 ]
python
en
['en', 'en', 'en']
True
_find_sequences
(errors, epsilon, anomaly_padding)
Find sequences of values that are above epsilon. This is done following this steps: * create a boolean mask that indicates which values are above epsilon. * mark certain range of errors around True values with a True as well. * shift this mask by one place, filing the empty gap with a Fals...
Find sequences of values that are above epsilon.
def _find_sequences(errors, epsilon, anomaly_padding): """Find sequences of values that are above epsilon. This is done following this steps: * create a boolean mask that indicates which values are above epsilon. * mark certain range of errors around True values with a True as well. * ...
[ "def", "_find_sequences", "(", "errors", ",", "epsilon", ",", "anomaly_padding", ")", ":", "above", "=", "pd", ".", "Series", "(", "errors", ">", "epsilon", ")", "index_above", "=", "np", ".", "argwhere", "(", "above", ".", "values", ")", "for", "idx", ...
[ 162, 0 ]
[ 209, 48 ]
python
en
['en', 'en', 'en']
True
_get_max_errors
(errors, sequences, max_below)
Get the maximum error for each anomalous sequence. Also add a row with the max error which was not considered anomalous. Table containing a ``max_error`` column with the maximum error of each sequence and the columns ``start`` and ``stop`` with the corresponding start and stop indexes, sorted descendi...
Get the maximum error for each anomalous sequence.
def _get_max_errors(errors, sequences, max_below): """Get the maximum error for each anomalous sequence. Also add a row with the max error which was not considered anomalous. Table containing a ``max_error`` column with the maximum error of each sequence and the columns ``start`` and ``stop`` with the...
[ "def", "_get_max_errors", "(", "errors", ",", "sequences", ",", "max_below", ")", ":", "max_errors", "=", "[", "{", "'max_error'", ":", "max_below", ",", "'start'", ":", "-", "1", ",", "'stop'", ":", "-", "1", "}", "]", "for", "sequence", "in", "sequen...
[ 212, 0 ]
[ 249, 44 ]
python
en
['en', 'en', 'en']
True
_prune_anomalies
(max_errors, min_percent)
Prune anomalies to mitigate false positives. This is done by following these steps: * Shift the errors 1 negative step to compare each value with the next one. * Drop the last row, which we do not want to compare. * Calculate the percentage increase for each row. * Find rows which ...
Prune anomalies to mitigate false positives.
def _prune_anomalies(max_errors, min_percent): """Prune anomalies to mitigate false positives. This is done by following these steps: * Shift the errors 1 negative step to compare each value with the next one. * Drop the last row, which we do not want to compare. * Calculate the percen...
[ "def", "_prune_anomalies", "(", "max_errors", ",", "min_percent", ")", ":", "next_error", "=", "max_errors", "[", "'max_error'", "]", ".", "shift", "(", "-", "1", ")", ".", "iloc", "[", ":", "-", "1", "]", "max_error", "=", "max_errors", "[", "'max_error...
[ 252, 0 ]
[ 286, 84 ]
python
en
['en', 'en', 'de']
True
_compute_scores
(pruned_anomalies, errors, threshold, window_start)
Compute the score of the anomalies. Calculate the score of the anomalies proportional to the maximum error in the sequence and add window_start timestamp to make the index absolute. Args: pruned_anomalies (ndarray): Array of anomalies containing the start, end and max_error for all ano...
Compute the score of the anomalies.
def _compute_scores(pruned_anomalies, errors, threshold, window_start): """Compute the score of the anomalies. Calculate the score of the anomalies proportional to the maximum error in the sequence and add window_start timestamp to make the index absolute. Args: pruned_anomalies (ndarray): ...
[ "def", "_compute_scores", "(", "pruned_anomalies", ",", "errors", ",", "threshold", ",", "window_start", ")", ":", "anomalies", "=", "list", "(", ")", "denominator", "=", "errors", ".", "mean", "(", ")", "+", "errors", ".", "std", "(", ")", "for", "row",...
[ 289, 0 ]
[ 318, 20 ]
python
en
['en', 'en', 'en']
True
_merge_sequences
(sequences)
Merge consecutive and overlapping sequences. We iterate over a list of start, end, score triples and merge together overlapping or consecutive sequences. The score of a merged sequence is the average of the single scores, weighted by the length of the corresponding sequences. Args: sequenc...
Merge consecutive and overlapping sequences.
def _merge_sequences(sequences): """Merge consecutive and overlapping sequences. We iterate over a list of start, end, score triples and merge together overlapping or consecutive sequences. The score of a merged sequence is the average of the single scores, weighted by the length of the correspondi...
[ "def", "_merge_sequences", "(", "sequences", ")", ":", "if", "len", "(", "sequences", ")", "==", "0", ":", "return", "np", ".", "array", "(", "[", "]", ")", "sorted_sequences", "=", "sorted", "(", "sequences", ",", "key", "=", "lambda", "entry", ":", ...
[ 321, 0 ]
[ 359, 34 ]
python
en
['en', 'en', 'en']
True
_find_window_sequences
(window, z_range, anomaly_padding, min_percent, window_start, fixed_threshold)
Find sequences of values that are anomalous. We first find the threshold for the window, then find all sequences above that threshold. After that, we get the max errors of the sequences and prune the anomalies. Lastly, the score of the anomalies is computed. Args: window (ndarray): ...
Find sequences of values that are anomalous.
def _find_window_sequences(window, z_range, anomaly_padding, min_percent, window_start, fixed_threshold): """Find sequences of values that are anomalous. We first find the threshold for the window, then find all sequences above that threshold. After that, we get the max errors of...
[ "def", "_find_window_sequences", "(", "window", ",", "z_range", ",", "anomaly_padding", ",", "min_percent", ",", "window_start", ",", "fixed_threshold", ")", ":", "if", "fixed_threshold", ":", "threshold", "=", "_fixed_threshold", "(", "window", ")", "else", ":", ...
[ 362, 0 ]
[ 403, 27 ]
python
en
['en', 'en', 'en']
True
find_anomalies
(errors, index, z_range=(0, 10), window_size=None, window_size_portion=None, window_step_size=None, window_step_size_portion=None, min_percent=0.1, anomaly_padding=50, lower_threshold=False, fixed_threshold=None)
Find sequences of error values that are anomalous. We first define the window of errors, that we want to analyze. We then find the anomalous sequences in that window and store the start/stop index pairs that correspond to each sequence, along with its score. Optionally, we can flip the error sequence aroun...
Find sequences of error values that are anomalous.
def find_anomalies(errors, index, z_range=(0, 10), window_size=None, window_size_portion=None, window_step_size=None, window_step_size_portion=None, min_percent=0.1, anomaly_padding=50, lower_threshold=False, fixed_threshold=None): """Find sequences of error values that are ano...
[ "def", "find_anomalies", "(", "errors", ",", "index", ",", "z_range", "=", "(", "0", ",", "10", ")", ",", "window_size", "=", "None", ",", "window_size_portion", "=", "None", ",", "window_step_size", "=", "None", ",", "window_step_size_portion", "=", "None",...
[ 406, 0 ]
[ 493, 32 ]
python
en
['en', 'en', 'en']
True
multibatch_generic_csv_generator
()
Construct a series of csv files with many data types for use in multibatch testing
Construct a series of csv files with many data types for use in multibatch testing
def multibatch_generic_csv_generator(): """ Construct a series of csv files with many data types for use in multibatch testing """ def _multibatch_generic_csv_generator( data_path: str, start_date: Optional[datetime.datetime] = None, num_event_batches: Optional[int] = 20, ...
[ "def", "multibatch_generic_csv_generator", "(", ")", ":", "def", "_multibatch_generic_csv_generator", "(", "data_path", ":", "str", ",", "start_date", ":", "Optional", "[", "datetime", ".", "datetime", "]", "=", "None", ",", "num_event_batches", ":", "Optional", "...
[ 19, 0 ]
[ 73, 44 ]
python
en
['en', 'error', 'th']
False
test_batches_are_accessible
( monkeypatch, multibatch_generic_csv_generator, multibatch_generic_csv_generator_context, )
What does this test and why? Batches created in the multibatch_generic_csv_generator fixture should be available using the multibatch_generic_csv_generator_context This test most likely duplicates tests elsewhere, but it is more of a test of the configurable fixture.
What does this test and why? Batches created in the multibatch_generic_csv_generator fixture should be available using the multibatch_generic_csv_generator_context This test most likely duplicates tests elsewhere, but it is more of a test of the configurable fixture.
def test_batches_are_accessible( monkeypatch, multibatch_generic_csv_generator, multibatch_generic_csv_generator_context, ): """ What does this test and why? Batches created in the multibatch_generic_csv_generator fixture should be available using the multibatch_generic_csv_generator_context...
[ "def", "test_batches_are_accessible", "(", "monkeypatch", ",", "multibatch_generic_csv_generator", ",", "multibatch_generic_csv_generator_context", ",", ")", ":", "context", ":", "DataContext", "=", "multibatch_generic_csv_generator_context", "data_relative_path", "=", "\"../data...
[ 149, 0 ]
[ 258, 74 ]
python
en
['en', 'error', 'th']
False
dircmp.phase3
(self)
Find out differences between common files. Ensure we are using content comparison with shallow=False.
Find out differences between common files. Ensure we are using content comparison with shallow=False.
def phase3(self): """ Find out differences between common files. Ensure we are using content comparison with shallow=False. """ fcomp = filecmp.cmpfiles(self.left, self.right, self.common_files, shallow = False) self.same_files, self.diff_files, self.funny_files = fcomp
[ "def", "phase3", "(", "self", ")", ":", "fcomp", "=", "filecmp", ".", "cmpfiles", "(", "self", ".", "left", ",", "self", ".", "right", ",", "self", ".", "common_files", ",", "shallow", "=", "False", ")", "self", ".", "same_files", ",", "self", ".", ...
[ 9, 4 ]
[ 15, 66 ]
python
en
['en', 'error', 'th']
False
Crawler.__init__
(self, output_dir: str, urls: Optional[List[str]] = None, crawler_depth: int = 1, filter_urls: Optional[List] = None, overwrite_existing_files=True)
Init object with basic params for crawling (can be overwritten later). :param output_dir: Path for the directory to store files :param urls: List of http(s) address(es) (can also be supplied later when calling crawl()) :param crawler_depth: How many sublinks to follow from the initial ...
Init object with basic params for crawling (can be overwritten later).
def __init__(self, output_dir: str, urls: Optional[List[str]] = None, crawler_depth: int = 1, filter_urls: Optional[List] = None, overwrite_existing_files=True): """ Init object with basic params for crawling (can be overwritten later). :param output_dir: Path for the directory...
[ "def", "__init__", "(", "self", ",", "output_dir", ":", "str", ",", "urls", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "crawler_depth", ":", "int", "=", "1", ",", "filter_urls", ":", "Optional", "[", "List", "]", "=", "No...
[ 27, 4 ]
[ 60, 64 ]
python
en
['en', 'error', 'th']
False
Crawler.crawl
(self, output_dir: Union[str, Path, None] = None, urls: Optional[List[str]] = None, crawler_depth: Optional[int] = None, filter_urls: Optional[List] = None, overwrite_existing_files: Optional[bool] = None)
Craw URL(s), extract the text from the HTML, create a Haystack Document object out of it and save it (one JSON file per URL, including text and basic meta data). You can optionally specify via `filter_urls` to only crawl URLs that match a certain pattern. All parameters are optional her...
Craw URL(s), extract the text from the HTML, create a Haystack Document object out of it and save it (one JSON file per URL, including text and basic meta data). You can optionally specify via `filter_urls` to only crawl URLs that match a certain pattern. All parameters are optional her...
def crawl(self, output_dir: Union[str, Path, None] = None, urls: Optional[List[str]] = None, crawler_depth: Optional[int] = None, filter_urls: Optional[List] = None, overwrite_existing_files: Optional[bool] = None) -> List[Path]: """ Craw URL(s), ...
[ "def", "crawl", "(", "self", ",", "output_dir", ":", "Union", "[", "str", ",", "Path", ",", "None", "]", "=", "None", ",", "urls", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "crawler_depth", ":", "Optional", "[", "int", ...
[ 62, 4 ]
[ 125, 28 ]
python
en
['en', 'error', 'th']
False
Crawler.run
(self, output_dir: Union[str, Path, None] = None, urls: Optional[List[str]] = None, crawler_depth: Optional[int] = None, filter_urls: Optional[List] = None, overwrite_existing_files: Optional[bool] = None, **kwargs)
Method to be executed when the Crawler is used as a Node within a Haystack pipeline. :param output_dir: Path for the directory to store files :param urls: List of http addresses or single http address :param crawler_depth: How many sublinks to follow from the initial list of URLs. Curr...
Method to be executed when the Crawler is used as a Node within a Haystack pipeline.
def run(self, output_dir: Union[str, Path, None] = None, urls: Optional[List[str]] = None, crawler_depth: Optional[int] = None, filter_urls: Optional[List] = None, overwrite_existing_files: Optional[bool] = None, **kwargs) -> Tuple[Dict, str]: ...
[ "def", "run", "(", "self", ",", "output_dir", ":", "Union", "[", "str", ",", "Path", ",", "None", "]", "=", "None", ",", "urls", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "crawler_depth", ":", "Optional", "[", "int", "...
[ 150, 4 ]
[ 176, 34 ]
python
en
['en', 'error', 'th']
False
xarray_sortby_coord
(dataset, coord)
Sort an xarray.Dataset by a coordinate. xarray.Dataset.sortby() sometimes fails, so this is an alternative. Credit to https://stackoverflow.com/a/42600594/5449970.
Sort an xarray.Dataset by a coordinate. xarray.Dataset.sortby() sometimes fails, so this is an alternative. Credit to https://stackoverflow.com/a/42600594/5449970.
def xarray_sortby_coord(dataset, coord): """ Sort an xarray.Dataset by a coordinate. xarray.Dataset.sortby() sometimes fails, so this is an alternative. Credit to https://stackoverflow.com/a/42600594/5449970. """ return dataset.loc[{coord:np.sort(dataset.coords[coord].values)}]
[ "def", "xarray_sortby_coord", "(", "dataset", ",", "coord", ")", ":", "return", "dataset", ".", "loc", "[", "{", "coord", ":", "np", ".", "sort", "(", "dataset", ".", "coords", "[", "coord", "]", ".", "values", ")", "}", "]" ]
[ 2, 0 ]
[ 7, 69 ]
python
en
['en', 'ja', 'th']
False
declaration_algs_cache_t.cmp_data
(self)
Data used for comparison between declarations.
Data used for comparison between declarations.
def cmp_data(self): """Data used for comparison between declarations.""" return self._cmp_data
[ "def", "cmp_data", "(", "self", ")", ":", "return", "self", ".", "_cmp_data" ]
[ 172, 4 ]
[ 174, 29 ]
python
en
['en', 'en', 'en']
True
declaration_algs_cache_t.cmp_data
(self, cmp_data)
Data used for comparison between declarations.
Data used for comparison between declarations.
def cmp_data(self, cmp_data): """Data used for comparison between declarations.""" if not self.enabled: cmp_data = None self._cmp_data = cmp_data
[ "def", "cmp_data", "(", "self", ",", "cmp_data", ")", ":", "if", "not", "self", ".", "enabled", ":", "cmp_data", "=", "None", "self", ".", "_cmp_data", "=", "cmp_data" ]
[ 177, 4 ]
[ 181, 33 ]
python
en
['en', 'en', 'en']
True
execute_shell_command
(command: str)
Wrap subprocess command in a try/except block to provide a convenient method for pip installing dependencies. :param command: bash command -- as if typed in a shell/Terminal window :return: status code -- 0 if successful; all other values (1 is the most common) indicate an error
Wrap subprocess command in a try/except block to provide a convenient method for pip installing dependencies.
def execute_shell_command(command: str) -> int: """ Wrap subprocess command in a try/except block to provide a convenient method for pip installing dependencies. :param command: bash command -- as if typed in a shell/Terminal window :return: status code -- 0 if successful; all other values (1 is the mo...
[ "def", "execute_shell_command", "(", "command", ":", "str", ")", "->", "int", ":", "cwd", ":", "str", "=", "os", ".", "getcwd", "(", ")", "path_env_var", ":", "str", "=", "os", ".", "pathsep", ".", "join", "(", "[", "os", ".", "environ", ".", "get"...
[ 22, 0 ]
[ 66, 22 ]
python
en
['en', 'error', 'th']
False
get_contrib_requirements
(filepath: str)
Parse the python file from filepath to identify a "library_metadata" dictionary in any defined classes, and return a requirements_info object that includes a list of pip-installable requirements for each class that defines them. Note, currently we are handling all dependencies at the module level. To support ...
Parse the python file from filepath to identify a "library_metadata" dictionary in any defined classes, and return a requirements_info object that includes a list of pip-installable requirements for each class that defines them.
def get_contrib_requirements(filepath: str) -> Dict: """ Parse the python file from filepath to identify a "library_metadata" dictionary in any defined classes, and return a requirements_info object that includes a list of pip-installable requirements for each class that defines them. Note, currently we ar...
[ "def", "get_contrib_requirements", "(", "filepath", ":", "str", ")", "->", "Dict", ":", "with", "open", "(", "filepath", ")", "as", "file", ":", "tree", "=", "ast", ".", "parse", "(", "file", ".", "read", "(", ")", ")", "requirements_info", "=", "{", ...
[ 69, 0 ]
[ 107, 28 ]
python
en
['en', 'error', 'th']
False
build_gallery
( include_core: bool = True, include_contrib_experimental: bool = True )
Build the gallery object by running diagnostics for each Expectation and returning the resulting reports. Args: include_core: if true, include Expectations defined in the core module include_contrib_experimental: if true, include Expectations defined in contrib_experimental: Returns: ...
Build the gallery object by running diagnostics for each Expectation and returning the resulting reports.
def build_gallery( include_core: bool = True, include_contrib_experimental: bool = True ) -> Dict: """ Build the gallery object by running diagnostics for each Expectation and returning the resulting reports. Args: include_core: if true, include Expectations defined in the core module i...
[ "def", "build_gallery", "(", "include_core", ":", "bool", "=", "True", ",", "include_contrib_experimental", ":", "bool", "=", "True", ")", "->", "Dict", ":", "gallery_info", "=", "dict", "(", ")", "built_expectations", "=", "set", "(", ")", "logger", ".", ...
[ 110, 0 ]
[ 221, 23 ]
python
en
['en', 'error', 'th']
False
objective
(baselexer)
Generate a subclass of baselexer that accepts the Objective-C syntax extensions.
Generate a subclass of baselexer that accepts the Objective-C syntax extensions.
def objective(baselexer): """ Generate a subclass of baselexer that accepts the Objective-C syntax extensions. """ # Have to be careful not to accidentally match JavaDoc/Doxygen syntax here, # since that's quite common in ordinary C/C++ files. It's OK to match # JavaDoc/Doxygen keywords th...
[ "def", "objective", "(", "baselexer", ")", ":", "# Have to be careful not to accidentally match JavaDoc/Doxygen syntax here,", "# since that's quite common in ordinary C/C++ files. It's OK to match", "# JavaDoc/Doxygen keywords that only apply to Objective-C, mind.", "#", "# The upshot of this ...
[ 23, 0 ]
[ 191, 37 ]
python
en
['en', 'error', 'th']
False
set_custom_hostname_resolver
(hostname_resolver)
Set a custom hostname resolver. By default, Trio's :func:`getaddrinfo` and :func:`getnameinfo` functions use the standard system resolver functions. This function allows you to customize that behavior. The main intended use case is for testing, but it might also be useful for using third-party resolver...
Set a custom hostname resolver.
def set_custom_hostname_resolver(hostname_resolver): """Set a custom hostname resolver. By default, Trio's :func:`getaddrinfo` and :func:`getnameinfo` functions use the standard system resolver functions. This function allows you to customize that behavior. The main intended use case is for testing, bu...
[ "def", "set_custom_hostname_resolver", "(", "hostname_resolver", ")", ":", "old", "=", "_resolver", ".", "get", "(", "None", ")", "_resolver", ".", "set", "(", "hostname_resolver", ")", "return", "old" ]
[ 65, 0 ]
[ 94, 14 ]
python
en
['es', 'pt', 'en']
False
set_custom_socket_factory
(socket_factory)
Set a custom socket object factory. This function allows you to replace Trio's normal socket class with a custom class. This is very useful for testing, and probably a bad idea in any other circumstance. See :class:`trio.abc.HostnameResolver` for more details. Setting a custom socket factory affec...
Set a custom socket object factory.
def set_custom_socket_factory(socket_factory): """Set a custom socket object factory. This function allows you to replace Trio's normal socket class with a custom class. This is very useful for testing, and probably a bad idea in any other circumstance. See :class:`trio.abc.HostnameResolver` for more ...
[ "def", "set_custom_socket_factory", "(", "socket_factory", ")", ":", "old", "=", "_socket_factory", ".", "get", "(", "None", ")", "_socket_factory", ".", "set", "(", "socket_factory", ")", "return", "old" ]
[ 97, 0 ]
[ 121, 14 ]
python
en
['en', 'hu', 'en']
True
getaddrinfo
(host, port, family=0, type=0, proto=0, flags=0)
Look up a numeric address given a name. Arguments and return values are identical to :func:`socket.getaddrinfo`, except that this version is async. Also, :func:`trio.socket.getaddrinfo` correctly uses IDNA 2008 to process non-ASCII domain names. (:func:`socket.getaddrinfo` uses IDNA 2003, which ca...
Look up a numeric address given a name.
async def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): """Look up a numeric address given a name. Arguments and return values are identical to :func:`socket.getaddrinfo`, except that this version is async. Also, :func:`trio.socket.getaddrinfo` correctly uses IDNA 2008 to process no...
[ "async", "def", "getaddrinfo", "(", "host", ",", "port", ",", "family", "=", "0", ",", "type", "=", "0", ",", "proto", "=", "0", ",", "flags", "=", "0", ")", ":", "# If host and port are numeric, then getaddrinfo doesn't block and we can", "# skip the whole thread...
[ 131, 0 ]
[ 191, 9 ]
python
en
['en', 'en', 'en']
True
getnameinfo
(sockaddr, flags)
Look up a name given a numeric address. Arguments and return values are identical to :func:`socket.getnameinfo`, except that this version is async. This function's behavior can be customized using :func:`set_custom_hostname_resolver`.
Look up a name given a numeric address.
async def getnameinfo(sockaddr, flags): """Look up a name given a numeric address. Arguments and return values are identical to :func:`socket.getnameinfo`, except that this version is async. This function's behavior can be customized using :func:`set_custom_hostname_resolver`. """ hr = _r...
[ "async", "def", "getnameinfo", "(", "sockaddr", ",", "flags", ")", ":", "hr", "=", "_resolver", ".", "get", "(", "None", ")", "if", "hr", "is", "not", "None", ":", "return", "await", "hr", ".", "getnameinfo", "(", "sockaddr", ",", "flags", ")", "else...
[ 194, 0 ]
[ 210, 9 ]
python
en
['en', 'en', 'en']
True
getprotobyname
(name)
Look up a protocol number by name. (Rarely used.) Like :func:`socket.getprotobyname`, but async.
Look up a protocol number by name. (Rarely used.)
async def getprotobyname(name): """Look up a protocol number by name. (Rarely used.) Like :func:`socket.getprotobyname`, but async. """ return await trio.to_thread.run_sync( _stdlib_socket.getprotobyname, name, cancellable=True )
[ "async", "def", "getprotobyname", "(", "name", ")", ":", "return", "await", "trio", ".", "to_thread", ".", "run_sync", "(", "_stdlib_socket", ".", "getprotobyname", ",", "name", ",", "cancellable", "=", "True", ")" ]
[ 213, 0 ]
[ 221, 5 ]
python
en
['en', 'en', 'en']
True
from_stdlib_socket
(sock)
Convert a standard library :func:`socket.socket` object into a Trio socket object.
Convert a standard library :func:`socket.socket` object into a Trio socket object.
def from_stdlib_socket(sock): """Convert a standard library :func:`socket.socket` object into a Trio socket object. """ return _SocketType(sock)
[ "def", "from_stdlib_socket", "(", "sock", ")", ":", "return", "_SocketType", "(", "sock", ")" ]
[ 232, 0 ]
[ 237, 28 ]
python
en
['en', 'en', 'en']
True
fromfd
(fd, family, type, proto=0)
Like :func:`socket.fromfd`, but returns a Trio socket object.
Like :func:`socket.fromfd`, but returns a Trio socket object.
def fromfd(fd, family, type, proto=0): """Like :func:`socket.fromfd`, but returns a Trio socket object.""" family, type, proto = _sniff_sockopts_for_fileno(family, type, proto, fd) return from_stdlib_socket(_stdlib_socket.fromfd(fd, family, type, proto))
[ "def", "fromfd", "(", "fd", ",", "family", ",", "type", ",", "proto", "=", "0", ")", ":", "family", ",", "type", ",", "proto", "=", "_sniff_sockopts_for_fileno", "(", "family", ",", "type", ",", "proto", ",", "fd", ")", "return", "from_stdlib_socket", ...
[ 241, 0 ]
[ 244, 77 ]
python
en
['en', 'fy', 'en']
True
socketpair
(*args, **kwargs)
Like :func:`socket.socketpair`, but returns a pair of Trio socket objects.
Like :func:`socket.socketpair`, but returns a pair of Trio socket objects.
def socketpair(*args, **kwargs): """Like :func:`socket.socketpair`, but returns a pair of Trio socket objects. """ left, right = _stdlib_socket.socketpair(*args, **kwargs) return (from_stdlib_socket(left), from_stdlib_socket(right))
[ "def", "socketpair", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "left", ",", "right", "=", "_stdlib_socket", ".", "socketpair", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "(", "from_stdlib_socket", "(", "left", ")", ",", "fro...
[ 257, 0 ]
[ 263, 64 ]
python
en
['en', 'af', 'en']
True
socket
( family=_stdlib_socket.AF_INET, type=_stdlib_socket.SOCK_STREAM, proto=0, fileno=None, )
Create a new Trio socket, like :func:`socket.socket`. This function's behavior can be customized using :func:`set_custom_socket_factory`.
Create a new Trio socket, like :func:`socket.socket`.
def socket( family=_stdlib_socket.AF_INET, type=_stdlib_socket.SOCK_STREAM, proto=0, fileno=None, ): """Create a new Trio socket, like :func:`socket.socket`. This function's behavior can be customized using :func:`set_custom_socket_factory`. """ if fileno is None: sf = _soc...
[ "def", "socket", "(", "family", "=", "_stdlib_socket", ".", "AF_INET", ",", "type", "=", "_stdlib_socket", ".", "SOCK_STREAM", ",", "proto", "=", "0", ",", "fileno", "=", "None", ",", ")", ":", "if", "fileno", "is", "None", ":", "sf", "=", "_socket_fac...
[ 267, 0 ]
[ 286, 44 ]
python
en
['it', 'et', 'en']
False
_sniff_sockopts_for_fileno
(family, type, proto, fileno)
Correct SOCKOPTS for given fileno, falling back to provided values.
Correct SOCKOPTS for given fileno, falling back to provided values.
def _sniff_sockopts_for_fileno(family, type, proto, fileno): """Correct SOCKOPTS for given fileno, falling back to provided values.""" # Wrap the raw fileno into a Python socket object # This object might have the wrong metadata, but it lets us easily call getsockopt # and then we'll throw it away and c...
[ "def", "_sniff_sockopts_for_fileno", "(", "family", ",", "type", ",", "proto", ",", "fileno", ")", ":", "# Wrap the raw fileno into a Python socket object", "# This object might have the wrong metadata, but it lets us easily call getsockopt", "# and then we'll throw it away and construct...
[ 289, 0 ]
[ 306, 30 ]
python
en
['en', 'en', 'en']
True
_SocketType.dup
(self)
Same as :meth:`socket.socket.dup`.
Same as :meth:`socket.socket.dup`.
def dup(self): """Same as :meth:`socket.socket.dup`.""" return _SocketType(self._sock.dup())
[ "def", "dup", "(", "self", ")", ":", "return", "_SocketType", "(", "self", ".", "_sock", ".", "dup", "(", ")", ")" ]
[ 436, 4 ]
[ 438, 44 ]
python
en
['en', 'af', 'en']
True
_SocketType.accept
(self)
Like :meth:`socket.socket.accept`, but async.
Like :meth:`socket.socket.accept`, but async.
async def accept(self): """Like :meth:`socket.socket.accept`, but async.""" sock, addr = await self._accept() return from_stdlib_socket(sock), addr
[ "async", "def", "accept", "(", "self", ")", ":", "sock", ",", "addr", "=", "await", "self", ".", "_accept", "(", ")", "return", "from_stdlib_socket", "(", "sock", ")", ",", "addr" ]
[ 604, 4 ]
[ 607, 45 ]
python
en
['en', 'sv', 'en']
True
_SocketType.sendto
(self, *args)
Similar to :meth:`socket.socket.sendto`, but async.
Similar to :meth:`socket.socket.sendto`, but async.
async def sendto(self, *args): """Similar to :meth:`socket.socket.sendto`, but async.""" # args is: data[, flags], address) # and kwargs are not accepted args = list(args) args[-1] = await self._resolve_remote_address_nocp(args[-1]) return await self._nonblocking_helper( ...
[ "async", "def", "sendto", "(", "self", ",", "*", "args", ")", ":", "# args is: data[, flags], address)", "# and kwargs are not accepted", "args", "=", "list", "(", "args", ")", "args", "[", "-", "1", "]", "=", "await", "self", ".", "_resolve_remote_address_nocp"...
[ 738, 4 ]
[ 746, 9 ]
python
en
['en', 'sv', 'en']
True
argument_t.clone
(self, **keywd)
constructs new argument_t instance return argument_t( name=keywd.get('name', self.name), decl_type=keywd.get('decl_type', self.decl_type), default_value=keywd.get('default_value', self.default_value), attributes=keywd.get('attributes', self.attributes )) ...
constructs new argument_t instance
def clone(self, **keywd): """constructs new argument_t instance return argument_t( name=keywd.get('name', self.name), decl_type=keywd.get('decl_type', self.decl_type), default_value=keywd.get('default_value', self.default_value), attributes=keywd.get('att...
[ "def", "clone", "(", "self", ",", "*", "*", "keywd", ")", ":", "return", "argument_t", "(", "name", "=", "keywd", ".", "get", "(", "'name'", ",", "self", ".", "name", ")", ",", "decl_type", "=", "keywd", ".", "get", "(", "'decl_type'", ",", "self",...
[ 47, 4 ]
[ 61, 64 ]
python
en
['en', 'en', 'en']
True
argument_t.name
(self)
Argument name. @type: str
Argument name.
def name(self): """Argument name. @type: str""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 97, 4 ]
[ 100, 25 ]
python
en
['en', 'da', 'en']
False
argument_t.ellipsis
(self)
bool, if True argument represents ellipsis ( "..." ) in function definition
bool, if True argument represents ellipsis ( "..." ) in function definition
def ellipsis(self): """bool, if True argument represents ellipsis ( "..." ) in function definition""" return isinstance(self.decl_type, cpptypes.ellipsis_t)
[ "def", "ellipsis", "(", "self", ")", ":", "return", "isinstance", "(", "self", ".", "decl_type", ",", "cpptypes", ".", "ellipsis_t", ")" ]
[ 107, 4 ]
[ 110, 62 ]
python
ca
['ca', 'ca', 'en']
True
argument_t.default_value
(self)
Argument's default value or None. @type: str
Argument's default value or None.
def default_value(self): """Argument's default value or None. @type: str""" return self._default_value
[ "def", "default_value", "(", "self", ")", ":", "return", "self", ".", "_default_value" ]
[ 113, 4 ]
[ 116, 34 ]
python
en
['en', 'fr', 'en']
True
argument_t.attributes
(self)
GCCXML attributes, set using __attribute__((gccxml("..."))) @type: str
GCCXML attributes, set using __attribute__((gccxml("...")))
def attributes(self): """GCCXML attributes, set using __attribute__((gccxml("..."))) @type: str""" return self._attributes
[ "def", "attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 131, 4 ]
[ 134, 31 ]
python
en
['en', 'la', 'en']
True
calldef_t._get__cmp__call_items
(self)
Implementation detail.
Implementation detail.
def _get__cmp__call_items(self): """ Implementation detail. """ raise NotImplementedError()
[ "def", "_get__cmp__call_items", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 169, 4 ]
[ 175, 35 ]
python
en
['en', 'error', 'th']
False
calldef_t._get__cmp__items
(self)
Implementation detail.
Implementation detail.
def _get__cmp__items(self): """ Implementation detail. """ items = [ self.arguments, self.return_type, self.has_extern, self.does_throw, self.exceptions.sort(), self.demangled_name, self.has_inline] ...
[ "def", "_get__cmp__items", "(", "self", ")", ":", "items", "=", "[", "self", ".", "arguments", ",", "self", ".", "return_type", ",", "self", ".", "has_extern", ",", "self", ".", "does_throw", ",", "self", ".", "exceptions", ".", "sort", "(", ")", ",", ...
[ 177, 4 ]
[ 193, 20 ]
python
en
['en', 'error', 'th']
False
calldef_t.arguments
(self)
The argument list. @type: list of :class:`argument_t`
The argument list.
def arguments(self): """The argument list. @type: list of :class:`argument_t`""" return self._arguments
[ "def", "arguments", "(", "self", ")", ":", "return", "self", ".", "_arguments" ]
[ 213, 4 ]
[ 216, 30 ]
python
en
['en', 'fr', 'en']
True
calldef_t.argument_types
(self)
list of all argument types
list of all argument types
def argument_types(self): """list of all argument types""" return [arg.decl_type for arg in self.arguments]
[ "def", "argument_types", "(", "self", ")", ":", "return", "[", "arg", ".", "decl_type", "for", "arg", "in", "self", ".", "arguments", "]" ]
[ 227, 4 ]
[ 229, 56 ]
python
en
['en', 'en', 'en']
True
calldef_t.required_args
(self)
list of all required arguments
list of all required arguments
def required_args(self): """list of all required arguments""" r_args = [] for arg in self.arguments: if not arg.default_value: r_args.append(arg) else: break return r_args
[ "def", "required_args", "(", "self", ")", ":", "r_args", "=", "[", "]", "for", "arg", "in", "self", ".", "arguments", ":", "if", "not", "arg", ".", "default_value", ":", "r_args", ".", "append", "(", "arg", ")", "else", ":", "break", "return", "r_arg...
[ 232, 4 ]
[ 240, 21 ]
python
en
['en', 'en', 'en']
True
calldef_t.optional_args
(self)
list of all optional arguments, the arguments that have default value
list of all optional arguments, the arguments that have default value
def optional_args(self): """list of all optional arguments, the arguments that have default value""" return self.arguments[len(self.required_args):]
[ "def", "optional_args", "(", "self", ")", ":", "return", "self", ".", "arguments", "[", "len", "(", "self", ".", "required_args", ")", ":", "]" ]
[ 243, 4 ]
[ 246, 55 ]
python
en
['en', 'fr', 'en']
True
calldef_t.does_throw
(self)
If False, than function does not throw any exception. In this case, function was declared with empty throw statement.
If False, than function does not throw any exception. In this case, function was declared with empty throw statement.
def does_throw(self): """If False, than function does not throw any exception. In this case, function was declared with empty throw statement.""" return self._does_throw
[ "def", "does_throw", "(", "self", ")", ":", "return", "self", ".", "_does_throw" ]
[ 249, 4 ]
[ 253, 31 ]
python
en
['en', 'en', 'en']
True
calldef_t.exceptions
(self)
The list of exceptions. @type: list of :class:`declaration_t`
The list of exceptions.
def exceptions(self): """The list of exceptions. @type: list of :class:`declaration_t`""" return self._exceptions
[ "def", "exceptions", "(", "self", ")", ":", "return", "self", ".", "_exceptions" ]
[ 260, 4 ]
[ 263, 31 ]
python
en
['en', 'en', 'en']
True
calldef_t.return_type
(self)
The type of the return value of the "callable" or None (constructors). @type: :class:`type_t`
The type of the return value of the "callable" or None (constructors).
def return_type(self): """The type of the return value of the "callable" or None (constructors). @type: :class:`type_t`""" return self._return_type
[ "def", "return_type", "(", "self", ")", ":", "return", "self", ".", "_return_type" ]
[ 270, 4 ]
[ 274, 32 ]
python
en
['en', 'en', 'en']
True
calldef_t.overloads
(self)
A list of overloaded "callables" (i.e. other callables with the same name within the same scope. @type: list of :class:`calldef_t`
A list of overloaded "callables" (i.e. other callables with the same name within the same scope.
def overloads(self): """A list of overloaded "callables" (i.e. other callables with the same name within the same scope. @type: list of :class:`calldef_t` """ if not self.parent: return [] # finding all functions with the same name return self.parent....
[ "def", "overloads", "(", "self", ")", ":", "if", "not", "self", ".", "parent", ":", "return", "[", "]", "# finding all functions with the same name", "return", "self", ".", "parent", ".", "calldefs", "(", "name", "=", "self", ".", "name", ",", "function", ...
[ 281, 4 ]
[ 294, 28 ]
python
en
['en', 'en', 'en']
True
calldef_t.has_extern
(self)
Was this callable declared as "extern"? @type: bool
Was this callable declared as "extern"?
def has_extern(self): """Was this callable declared as "extern"? @type: bool""" return self._has_extern
[ "def", "has_extern", "(", "self", ")", ":", "return", "self", ".", "_has_extern" ]
[ 297, 4 ]
[ 300, 31 ]
python
en
['en', 'en', 'en']
True
calldef_t.has_inline
(self)
Was this callable declared with "inline" specifier @type: bool
Was this callable declared with "inline" specifier
def has_inline(self): """Was this callable declared with "inline" specifier @type: bool""" return self._has_inline
[ "def", "has_inline", "(", "self", ")", ":", "return", "self", ".", "_has_inline" ]
[ 307, 4 ]
[ 310, 31 ]
python
en
['en', 'en', 'en']
True
calldef_t.__remove_parent_fname
(self, demangled)
implementation details
implementation details
def __remove_parent_fname(self, demangled): """implementation details""" demangled = demangled.strip() parent_fname = declaration_utils.full_name(self.parent) if parent_fname.startswith('::') and not demangled.startswith('::'): parent_fname = parent_fname[2:] demangle...
[ "def", "__remove_parent_fname", "(", "self", ",", "demangled", ")", ":", "demangled", "=", "demangled", ".", "strip", "(", ")", "parent_fname", "=", "declaration_utils", ".", "full_name", "(", "self", ".", "parent", ")", "if", "parent_fname", ".", "startswith"...
[ 316, 4 ]
[ 323, 24 ]
python
da
['eo', 'da', 'en']
False
calldef_t.demangled_name
(self)
returns function demangled name. It can help you to deal with function template instantiations
returns function demangled name. It can help you to deal with function template instantiations
def demangled_name(self): """returns function demangled name. It can help you to deal with function template instantiations""" if not self.demangled: self._demangled_name = '' if self._demangled_name: return self._demangled_name if self._demangled_...
[ "def", "demangled_name", "(", "self", ")", ":", "if", "not", "self", ".", "demangled", ":", "self", ".", "_demangled_name", "=", "''", "if", "self", ".", "_demangled_name", ":", "return", "self", ".", "_demangled_name", "if", "self", ".", "_demangled_name", ...
[ 326, 4 ]
[ 381, 24 ]
python
en
['en', 'en', 'en']
True
calldef_t.guess_calling_convention
(self)
This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention
This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention
def guess_calling_convention(self): """This function should be overriden in the derived classes and return more-or-less successfull guess about calling convention""" return calldef_types.CALLING_CONVENTION_TYPES.UNKNOWN
[ "def", "guess_calling_convention", "(", "self", ")", ":", "return", "calldef_types", ".", "CALLING_CONVENTION_TYPES", ".", "UNKNOWN" ]
[ 397, 4 ]
[ 400, 61 ]
python
en
['en', 'en', 'en']
True
calldef_t.calling_convention
(self)
function calling convention. See :class:CALLING_CONVENTION_TYPES class for possible values
function calling convention. See :class:CALLING_CONVENTION_TYPES class for possible values
def calling_convention(self): """function calling convention. See :class:CALLING_CONVENTION_TYPES class for possible values""" if self._calling_convention is None: self._calling_convention = \ calldef_types.CALLING_CONVENTION_TYPES.extract(self.attributes) ...
[ "def", "calling_convention", "(", "self", ")", ":", "if", "self", ".", "_calling_convention", "is", "None", ":", "self", ".", "_calling_convention", "=", "calldef_types", ".", "CALLING_CONVENTION_TYPES", ".", "extract", "(", "self", ".", "attributes", ")", "if",...
[ 403, 4 ]
[ 411, 39 ]
python
en
['en', 'en', 'en']
True
calldef_t.mangled
(self)
Unique declaration name generated by the compiler. :return: the mangled name :rtype: str
Unique declaration name generated by the compiler.
def mangled(self): """ Unique declaration name generated by the compiler. :return: the mangled name :rtype: str """ return self.get_mangled_name()
[ "def", "mangled", "(", "self", ")", ":", "return", "self", ".", "get_mangled_name", "(", ")" ]
[ 418, 4 ]
[ 427, 38 ]
python
en
['en', 'error', 'th']
False
open_nursery
()
Returns an async context manager which must be used to create a new `Nursery`. It does not block on entry; on exit it blocks until all child tasks have exited.
Returns an async context manager which must be used to create a new `Nursery`.
def open_nursery(): """Returns an async context manager which must be used to create a new `Nursery`. It does not block on entry; on exit it blocks until all child tasks have exited. """ return NurseryManager()
[ "def", "open_nursery", "(", ")", ":", "return", "NurseryManager", "(", ")" ]
[ 829, 0 ]
[ 837, 27 ]
python
en
['en', 'en', 'en']
True
setup_runner
(clock, instruments, restrict_keyboard_interrupt_to_checkpoints)
Create a Runner object and install it as the GLOBAL_RUN_CONTEXT.
Create a Runner object and install it as the GLOBAL_RUN_CONTEXT.
def setup_runner(clock, instruments, restrict_keyboard_interrupt_to_checkpoints): """Create a Runner object and install it as the GLOBAL_RUN_CONTEXT.""" # It wouldn't be *hard* to support nested calls to run(), but I can't # think of a single good reason for it, so let's be conservative for # now: i...
[ "def", "setup_runner", "(", "clock", ",", "instruments", ",", "restrict_keyboard_interrupt_to_checkpoints", ")", ":", "# It wouldn't be *hard* to support nested calls to run(), but I can't", "# think of a single good reason for it, so let's be conservative for", "# now:", "if", "hasattr"...
[ 1809, 0 ]
[ 1839, 17 ]
python
en
['en', 'en', 'en']
True