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
test_model_finder_dummy_regression
(model_finder_regression, test_input)
Testing if DummyModel (for regression) is created correctly.
Testing if DummyModel (for regression) is created correctly.
def test_model_finder_dummy_regression(model_finder_regression, test_input): """Testing if DummyModel (for regression) is created correctly.""" expected_model = DummyRegressor(strategy="median") median = 35.619966243279364 expected_model_scores = {"mean_squared_error": 487.0142795860736, "r2_score": -0....
[ "def", "test_model_finder_dummy_regression", "(", "model_finder_regression", ",", "test_input", ")", ":", "expected_model", "=", "DummyRegressor", "(", "strategy", "=", "\"median\"", ")", "median", "=", "35.619966243279364", "expected_model_scores", "=", "{", "\"mean_squa...
[ 24, 0 ]
[ 35, 55 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_dummy_model_results
(model_finder_regression)
Testing if dummy_model_results() function returns correct DataFrame (regression).
Testing if dummy_model_results() function returns correct DataFrame (regression).
def test_model_finder_regression_dummy_model_results(model_finder_regression): """Testing if dummy_model_results() function returns correct DataFrame (regression).""" _ = { "model": "DummyRegressor", "fit_time": np.nan, "params": "{'constant': None, 'quantile': None, 'strategy': 'median'...
[ "def", "test_model_finder_regression_dummy_model_results", "(", "model_finder_regression", ")", ":", "_", "=", "{", "\"model\"", ":", "\"DummyRegressor\"", ",", "\"fit_time\"", ":", "np", ".", "nan", ",", "\"params\"", ":", "\"{'constant': None, 'quantile': None, 'strategy'...
[ 38, 0 ]
[ 52, 59 ]
python
en
['fr', 'en', 'en']
True
test_model_finder_set_model_regression
(model_finder_regression, seed)
Testing if set_model() function correctly sets chosen Model and corresponding properties (regression). Additionally checks if the set Model wasn't fitted in the process.
Testing if set_model() function correctly sets chosen Model and corresponding properties (regression). Additionally checks if the set Model wasn't fitted in the process.
def test_model_finder_set_model_regression(model_finder_regression, seed): """Testing if set_model() function correctly sets chosen Model and corresponding properties (regression). Additionally checks if the set Model wasn't fitted in the process.""" model = DecisionTreeRegressor(max_depth=10, criterion="ma...
[ "def", "test_model_finder_set_model_regression", "(", "model_finder_regression", ",", "seed", ")", ":", "model", "=", "DecisionTreeRegressor", "(", "max_depth", "=", "10", ",", "criterion", "=", "\"mae\"", ",", "random_state", "=", "seed", ")", "mf", "=", "model_f...
[ 55, 0 ]
[ 69, 23 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_search
(model_finder_regression, mode, expected_model, seed)
Testing if search() function returns expected Model (for regression).
Testing if search() function returns expected Model (for regression).
def test_model_finder_regression_search(model_finder_regression, mode, expected_model, seed): """Testing if search() function returns expected Model (for regression).""" model_finder_regression._quicksearch_limit = 1 actual_model = model_finder_regression.search(models=None, scoring=mean_squared_error, mode...
[ "def", "test_model_finder_regression_search", "(", "model_finder_regression", ",", "mode", ",", "expected_model", ",", "seed", ")", ":", "model_finder_regression", ".", "_quicksearch_limit", "=", "1", "actual_model", "=", "model_finder_regression", ".", "search", "(", "...
[ 79, 0 ]
[ 84, 51 ]
python
en
['es', 'en', 'en']
True
test_model_finder_search_and_fit_regression
(model_finder_regression, mode, expected_model, expected_scores, seed)
Testing if search_and_fit() function correctly searches for and sets and fits chosen model (regression). Additionally checks if the model is correctly wrapped in TransformedTargetRegressor.
Testing if search_and_fit() function correctly searches for and sets and fits chosen model (regression). Additionally checks if the model is correctly wrapped in TransformedTargetRegressor.
def test_model_finder_search_and_fit_regression(model_finder_regression, mode, expected_model, expected_scores, seed): """Testing if search_and_fit() function correctly searches for and sets and fits chosen model (regression). Additionally checks if the model is correctly wrapped in TransformedTargetRegressor."...
[ "def", "test_model_finder_search_and_fit_regression", "(", "model_finder_regression", ",", "mode", ",", "expected_model", ",", "expected_scores", ",", "seed", ")", ":", "prediction_array", "=", "np", ".", "array", "(", "[", "1.34", ",", "0", ",", "0", ",", "0", ...
[ 104, 0 ]
[ 131, 92 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_search_defined_models
(model_finder_regression, models, expected_model)
Testing if models provided explicitly are being scored and chosen properly in regression (including models not present in default models collection).
Testing if models provided explicitly are being scored and chosen properly in regression (including models not present in default models collection).
def test_model_finder_regression_search_defined_models(model_finder_regression, models, expected_model): """Testing if models provided explicitly are being scored and chosen properly in regression (including models not present in default models collection).""" actual_model = model_finder_regression.search(m...
[ "def", "test_model_finder_regression_search_defined_models", "(", "model_finder_regression", ",", "models", ",", "expected_model", ")", ":", "actual_model", "=", "model_finder_regression", ".", "search", "(", "models", "=", "models", ",", "scoring", "=", "mean_squared_err...
[ 151, 0 ]
[ 155, 51 ]
python
en
['en', 'en', 'en']
True
test_model_finder_perform_gridsearch_regression
(model_finder_regression, chosen_regressors_grid, seed)
Testing if gridsearch works and returns correct Models and result dict (in regression).
Testing if gridsearch works and returns correct Models and result dict (in regression).
def test_model_finder_perform_gridsearch_regression(model_finder_regression, chosen_regressors_grid, seed): """Testing if gridsearch works and returns correct Models and result dict (in regression).""" expected_models = [ (DecisionTreeRegressor, {"max_depth": 10, "criterion": "mae", "random_state": seed...
[ "def", "test_model_finder_perform_gridsearch_regression", "(", "model_finder_regression", ",", "chosen_regressors_grid", ",", "seed", ")", ":", "expected_models", "=", "[", "(", "DecisionTreeRegressor", ",", "{", "\"max_depth\"", ":", "10", ",", "\"criterion\"", ":", "\...
[ 158, 0 ]
[ 186, 43 ]
python
en
['en', 'en', 'en']
True
test_model_finder_perform_quicksearch_regression
(model_finder_regression, chosen_regressors_grid, seed)
Testing if quicksearch works and returns correct Models and result dict (in regression).
Testing if quicksearch works and returns correct Models and result dict (in regression).
def test_model_finder_perform_quicksearch_regression(model_finder_regression, chosen_regressors_grid, seed): """Testing if quicksearch works and returns correct Models and result dict (in regression).""" expected_models = [ (DecisionTreeRegressor, 1801.9747017092634), (Ridge, 1530.5096036958037)...
[ "def", "test_model_finder_perform_quicksearch_regression", "(", "model_finder_regression", ",", "chosen_regressors_grid", ",", "seed", ")", ":", "expected_models", "=", "[", "(", "DecisionTreeRegressor", ",", "1801.9747017092634", ")", ",", "(", "Ridge", ",", "1530.509603...
[ 189, 0 ]
[ 208, 43 ]
python
en
['en', 'en', 'en']
True
test_model_finder_quicksearch_regression
( model_finder_regression, chosen_regressors_grid, limit, expected_models )
Testing if quicksearch correctly chooses only a limited number of found Models based on the limit (in regression).
Testing if quicksearch correctly chooses only a limited number of found Models based on the limit (in regression).
def test_model_finder_quicksearch_regression( model_finder_regression, chosen_regressors_grid, limit, expected_models ): """Testing if quicksearch correctly chooses only a limited number of found Models based on the limit (in regression).""" model_finder_regression._quicksearch_limit = limit act...
[ "def", "test_model_finder_quicksearch_regression", "(", "model_finder_regression", ",", "chosen_regressors_grid", ",", "limit", ",", "expected_models", ")", ":", "model_finder_regression", ".", "_quicksearch_limit", "=", "limit", "actual_models", "=", "model_finder_regression",...
[ 218, 0 ]
[ 226, 43 ]
python
en
['en', 'en', 'en']
True
test_model_finder_assess_models_regression
(model_finder_regression, seed)
Testing if assess_model function returns correct Models and result dict (in regression).
Testing if assess_model function returns correct Models and result dict (in regression).
def test_model_finder_assess_models_regression(model_finder_regression, seed): """Testing if assess_model function returns correct Models and result dict (in regression).""" models = [ DecisionTreeRegressor(**{"max_depth": 10, "criterion": "mae", "random_state": seed}), Ridge(**{"alpha": 0.0001,...
[ "def", "test_model_finder_assess_models_regression", "(", "model_finder_regression", ",", "seed", ")", ":", "models", "=", "[", "DecisionTreeRegressor", "(", "*", "*", "{", "\"max_depth\"", ":", "10", ",", "\"criterion\"", ":", "\"mae\"", ",", "\"random_state\"", ":...
[ 229, 0 ]
[ 249, 70 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_search_results_dataframe
(model_finder_regression_fitted, limit, seed)
Testing if search_results_dataframe is being correctly filtered out to a provided model_limit (in regression)
Testing if search_results_dataframe is being correctly filtered out to a provided model_limit (in regression)
def test_model_finder_regression_search_results_dataframe(model_finder_regression_fitted, limit, seed): """Testing if search_results_dataframe is being correctly filtered out to a provided model_limit (in regression)""" models = ["SVR", "Ridge", "DecisionTreeRegressor"] dummy = ["DummyRegressor"] ex...
[ "def", "test_model_finder_regression_search_results_dataframe", "(", "model_finder_regression_fitted", ",", "limit", ",", "seed", ")", ":", "models", "=", "[", "\"SVR\"", ",", "\"Ridge\"", ",", "\"DecisionTreeRegressor\"", "]", "dummy", "=", "[", "\"DummyRegressor\"", "...
[ 259, 0 ]
[ 272, 55 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_prediction_errors
(model_finder_regression_fitted, limit, seed)
Testing if calculated prediction errors are correct (for regression).
Testing if calculated prediction errors are correct (for regression).
def test_model_finder_regression_prediction_errors(model_finder_regression_fitted, limit, seed): """Testing if calculated prediction errors are correct (for regression).""" results = [ SVR(**{"C": 0.1, "tol": 1.0}), Ridge(**{"alpha": 0.0001, "random_state": seed}), DecisionTreeRegressor(...
[ "def", "test_model_finder_regression_prediction_errors", "(", "model_finder_regression_fitted", ",", "limit", ",", "seed", ")", ":", "results", "=", "[", "SVR", "(", "*", "*", "{", "\"C\"", ":", "0.1", ",", "\"tol\"", ":", "1.0", "}", ")", ",", "Ridge", "(",...
[ 283, 0 ]
[ 301, 50 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_prediction_errors_error
(model_finder_regression)
Testing if prediction_errors raises an error when there are no search results available (regression).
Testing if prediction_errors raises an error when there are no search results available (regression).
def test_model_finder_regression_prediction_errors_error(model_finder_regression): """Testing if prediction_errors raises an error when there are no search results available (regression).""" with pytest.raises(ModelsNotSearchedError) as excinfo: _ = model_finder_regression.prediction_errors(1) asser...
[ "def", "test_model_finder_regression_prediction_errors_error", "(", "model_finder_regression", ")", ":", "with", "pytest", ".", "raises", "(", "ModelsNotSearchedError", ")", "as", "excinfo", ":", "_", "=", "model_finder_regression", ".", "prediction_errors", "(", "1", "...
[ 304, 0 ]
[ 308, 68 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_residuals
(model_finder_regression_fitted, limit, seed)
Testing if calculated residuals are correct (for regression).
Testing if calculated residuals are correct (for regression).
def test_model_finder_regression_residuals(model_finder_regression_fitted, limit, seed): """Testing if calculated residuals are correct (for regression).""" results = [ SVR(**{"C": 0.1, "tol": 1.0}), Ridge(**{"alpha": 0.0001, "random_state": seed}), DecisionTreeRegressor(**{"max_depth": ...
[ "def", "test_model_finder_regression_residuals", "(", "model_finder_regression_fitted", ",", "limit", ",", "seed", ")", ":", "results", "=", "[", "SVR", "(", "*", "*", "{", "\"C\"", ":", "0.1", ",", "\"tol\"", ":", "1.0", "}", ")", ",", "Ridge", "(", "*", ...
[ 319, 0 ]
[ 337, 50 ]
python
en
['en', 'en', 'en']
True
test_model_finder_regression_residual_error
(model_finder_regression)
Testing if prediction_errors raises an error when there are no search results available (regression).
Testing if prediction_errors raises an error when there are no search results available (regression).
def test_model_finder_regression_residual_error(model_finder_regression): """Testing if prediction_errors raises an error when there are no search results available (regression).""" with pytest.raises(ModelsNotSearchedError) as excinfo: _ = model_finder_regression.residuals(1) assert "Search Results...
[ "def", "test_model_finder_regression_residual_error", "(", "model_finder_regression", ")", ":", "with", "pytest", ".", "raises", "(", "ModelsNotSearchedError", ")", "as", "excinfo", ":", "_", "=", "model_finder_regression", ".", "residuals", "(", "1", ")", "assert", ...
[ 340, 0 ]
[ 344, 68 ]
python
en
['en', 'en', 'en']
True
test_model_finder_predict_X_test_regression
(model_finder_regression_fitted, split_dataset_numerical, limit, seed)
Testing if predictions of X_test split from found models are correct (in regression).
Testing if predictions of X_test split from found models are correct (in regression).
def test_model_finder_predict_X_test_regression(model_finder_regression_fitted, split_dataset_numerical, limit, seed): """Testing if predictions of X_test split from found models are correct (in regression).""" models = [ SVR(**{"C": 0.1, "tol": 1.0}), Ridge(**{"alpha": 0.0001, "random_state": s...
[ "def", "test_model_finder_predict_X_test_regression", "(", "model_finder_regression_fitted", ",", "split_dataset_numerical", ",", "limit", ",", "seed", ")", ":", "models", "=", "[", "SVR", "(", "*", "*", "{", "\"C\"", ":", "0.1", ",", "\"tol\"", ":", "1.0", "}",...
[ 355, 0 ]
[ 376, 67 ]
python
en
['en', 'en', 'en']
True
test_model_finder_wrap_model_regression
(model_finder_regression, expected_model)
Testing if wrapping a chosen model with custom TransformedTargetRegressor works correctly (regression).
Testing if wrapping a chosen model with custom TransformedTargetRegressor works correctly (regression).
def test_model_finder_wrap_model_regression(model_finder_regression, expected_model): """Testing if wrapping a chosen model with custom TransformedTargetRegressor works correctly (regression).""" actual_model = model_finder_regression._wrap_model(expected_model) assert str(actual_model) == str(expected_mod...
[ "def", "test_model_finder_wrap_model_regression", "(", "model_finder_regression", ",", "expected_model", ")", ":", "actual_model", "=", "model_finder_regression", ".", "_wrap_model", "(", "expected_model", ")", "assert", "str", "(", "actual_model", ")", "==", "str", "("...
[ 387, 0 ]
[ 394, 55 ]
python
en
['en', 'en', 'en']
True
test_model_finder_wrap_results_dataframe_regression
(model_finder_regression, test_data)
Testing if adding additional column to the results dataframe works correctly (in regression).
Testing if adding additional column to the results dataframe works correctly (in regression).
def test_model_finder_wrap_results_dataframe_regression(model_finder_regression, test_data): """Testing if adding additional column to the results dataframe works correctly (in regression).""" df = pd.DataFrame(data=test_data) title = model_finder_regression._transformed_target_name params = str(model_f...
[ "def", "test_model_finder_wrap_results_dataframe_regression", "(", "model_finder_regression", ",", "test_data", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", "data", "=", "test_data", ")", "title", "=", "model_finder_regression", ".", "_transformed_target_name", "pa...
[ 404, 0 ]
[ 413, 40 ]
python
en
['en', 'en', 'en']
True
test_model_finder_wrap_params_regression
(model_finder_regression, test_params)
Testing if adding params from Target Transformer to params dict works correctly (in regression).
Testing if adding params from Target Transformer to params dict works correctly (in regression).
def test_model_finder_wrap_params_regression(model_finder_regression, test_params): """Testing if adding params from Target Transformer to params dict works correctly (in regression).""" expected_params = copy.deepcopy(test_params) title = model_finder_regression._transformed_target_name transformer = m...
[ "def", "test_model_finder_wrap_params_regression", "(", "model_finder_regression", ",", "test_params", ")", ":", "expected_params", "=", "copy", ".", "deepcopy", "(", "test_params", ")", "title", "=", "model_finder_regression", ".", "_transformed_target_name", "transformer"...
[ 423, 0 ]
[ 433, 43 ]
python
en
['en', 'en', 'en']
True
test_model_finder_calculate_model_score_multiclass_regular_scoring
( model_finder_regression, split_dataset_numerical, model )
Testing if calculating model score works correctly in multiclass with scoring != roc_auc_score.
Testing if calculating model score works correctly in multiclass with scoring != roc_auc_score.
def test_model_finder_calculate_model_score_multiclass_regular_scoring( model_finder_regression, split_dataset_numerical, model ): """Testing if calculating model score works correctly in multiclass with scoring != roc_auc_score.""" scoring = mean_squared_error X_train = split_dataset_numerical[0] ...
[ "def", "test_model_finder_calculate_model_score_multiclass_regular_scoring", "(", "model_finder_regression", ",", "split_dataset_numerical", ",", "model", ")", ":", "scoring", "=", "mean_squared_error", "X_train", "=", "split_dataset_numerical", "[", "0", "]", "X_test", "=", ...
[ 444, 0 ]
[ 459, 43 ]
python
en
['en', 'en', 'en']
True
split_first
(s, delims)
.. deprecated:: 1.25 Given a string and an iterable of delimiters, split on the first found delimiter. Return two split parts and the matched delimiter. If not found, then the first part is the full input string. Example:: >>> split_first('foo/bar?baz', '?/=') ('foo', 'bar?baz',...
.. deprecated:: 1.25
def split_first(s, delims): """ .. deprecated:: 1.25 Given a string and an iterable of delimiters, split on the first found delimiter. Return two split parts and the matched delimiter. If not found, then the first part is the full input string. Example:: >>> split_first('foo/bar?baz'...
[ "def", "split_first", "(", "s", ",", "delims", ")", ":", "min_idx", "=", "None", "min_delim", "=", "None", "for", "d", "in", "delims", ":", "idx", "=", "s", ".", "find", "(", "d", ")", "if", "idx", "<", "0", ":", "continue", "if", "min_idx", "is"...
[ 174, 0 ]
[ 206, 51 ]
python
en
['en', 'error', 'th']
False
_encode_invalid_chars
(component, allowed_chars, encoding="utf-8")
Percent-encodes a URI component without reapplying onto an already percent-encoded component.
Percent-encodes a URI component without reapplying onto an already percent-encoded component.
def _encode_invalid_chars(component, allowed_chars, encoding="utf-8"): """Percent-encodes a URI component without reapplying onto an already percent-encoded component. """ if component is None: return component component = six.ensure_text(component) # Normalize existing percent-encoded...
[ "def", "_encode_invalid_chars", "(", "component", ",", "allowed_chars", ",", "encoding", "=", "\"utf-8\"", ")", ":", "if", "component", "is", "None", ":", "return", "component", "component", "=", "six", ".", "ensure_text", "(", "component", ")", "# Normalize exi...
[ 209, 0 ]
[ 240, 45 ]
python
en
['en', 'en', 'en']
True
_encode_target
(target)
Percent-encodes a request target so that there are no invalid characters
Percent-encodes a request target so that there are no invalid characters
def _encode_target(target): """Percent-encodes a request target so that there are no invalid characters""" path, query = TARGET_RE.match(target).groups() target = _encode_invalid_chars(path, PATH_CHARS) query = _encode_invalid_chars(query, QUERY_CHARS) if query is not None: target += "?" + q...
[ "def", "_encode_target", "(", "target", ")", ":", "path", ",", "query", "=", "TARGET_RE", ".", "match", "(", "target", ")", ".", "groups", "(", ")", "target", "=", "_encode_invalid_chars", "(", "path", ",", "PATH_CHARS", ")", "query", "=", "_encode_invalid...
[ 319, 0 ]
[ 326, 17 ]
python
en
['en', 'en', 'en']
True
parse_url
(url)
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 compliant. The parser logic and helper functions are based heavily on work done in the ``rfc3986`` module. :param str url: URL to...
Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 compliant.
def parse_url(url): """ Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 compliant. The parser logic and helper functions are based heavily on work done in the ``rfc3986`` module. ...
[ "def", "parse_url", "(", "url", ")", ":", "if", "not", "url", ":", "# Empty", "return", "Url", "(", ")", "source_url", "=", "url", "if", "not", "SCHEME_RE", ".", "search", "(", "url", ")", ":", "url", "=", "\"//\"", "+", "url", "try", ":", "scheme"...
[ 329, 0 ]
[ 421, 5 ]
python
en
['en', 'error', 'th']
False
get_host
(url)
Deprecated. Use :func:`parse_url` instead.
Deprecated. Use :func:`parse_url` instead.
def get_host(url): """ Deprecated. Use :func:`parse_url` instead. """ p = parse_url(url) return p.scheme or "http", p.hostname, p.port
[ "def", "get_host", "(", "url", ")", ":", "p", "=", "parse_url", "(", "url", ")", "return", "p", ".", "scheme", "or", "\"http\"", ",", "p", ".", "hostname", ",", "p", ".", "port" ]
[ 424, 0 ]
[ 429, 49 ]
python
en
['en', 'error', 'th']
False
Url.hostname
(self)
For backwards-compatibility with urlparse. We're nice like that.
For backwards-compatibility with urlparse. We're nice like that.
def hostname(self): """For backwards-compatibility with urlparse. We're nice like that.""" return self.host
[ "def", "hostname", "(", "self", ")", ":", "return", "self", ".", "host" ]
[ 109, 4 ]
[ 111, 24 ]
python
en
['en', 'en', 'en']
True
Url.request_uri
(self)
Absolute path including the query string.
Absolute path including the query string.
def request_uri(self): """Absolute path including the query string.""" uri = self.path or "/" if self.query is not None: uri += "?" + self.query return uri
[ "def", "request_uri", "(", "self", ")", ":", "uri", "=", "self", ".", "path", "or", "\"/\"", "if", "self", ".", "query", "is", "not", "None", ":", "uri", "+=", "\"?\"", "+", "self", ".", "query", "return", "uri" ]
[ 114, 4 ]
[ 121, 18 ]
python
en
['en', 'en', 'en']
True
Url.netloc
(self)
Network location including host and port
Network location including host and port
def netloc(self): """Network location including host and port""" if self.port: return "%s:%d" % (self.host, self.port) return self.host
[ "def", "netloc", "(", "self", ")", ":", "if", "self", ".", "port", ":", "return", "\"%s:%d\"", "%", "(", "self", ".", "host", ",", "self", ".", "port", ")", "return", "self", ".", "host" ]
[ 124, 4 ]
[ 128, 24 ]
python
en
['en', 'en', 'en']
True
Url.url
(self)
Convert self into a url This function should more or less round-trip with :func:`.parse_url`. The returned url may not be exactly the same as the url inputted to :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls with a blank port will have : removed). ...
Convert self into a url
def url(self): """ Convert self into a url This function should more or less round-trip with :func:`.parse_url`. The returned url may not be exactly the same as the url inputted to :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls with a blank port w...
[ "def", "url", "(", "self", ")", ":", "scheme", ",", "auth", ",", "host", ",", "port", ",", "path", ",", "query", ",", "fragment", "=", "self", "url", "=", "u\"\"", "# We use \"is not None\" we want things to happen with empty strings (or 0 port)", "if", "scheme", ...
[ 131, 4 ]
[ 168, 18 ]
python
en
['en', 'error', 'th']
False
feature_descriptions
()
Descriptions for test data.
Descriptions for test data.
def feature_descriptions(): """Descriptions for test data.""" d = FeatureDescriptor._description m = FeatureDescriptor._mapping c = FeatureDescriptor._category descriptions = { "Sex": { d: "Sex of the Participant" }, "AgeGroup": { # d: "Age Group of t...
[ "def", "feature_descriptions", "(", ")", ":", "d", "=", "FeatureDescriptor", ".", "_description", "m", "=", "FeatureDescriptor", ".", "_mapping", "c", "=", "FeatureDescriptor", ".", "_category", "descriptions", "=", "{", "\"Sex\"", ":", "{", "d", ":", "\"Sex o...
[ 32, 0 ]
[ 81, 23 ]
python
en
['en', 'fr', 'en']
True
feature_descriptor
(feature_descriptions)
Fixture FeatureDescriptor.
Fixture FeatureDescriptor.
def feature_descriptor(feature_descriptions): """Fixture FeatureDescriptor.""" fd = FeatureDescriptor(feature_descriptions) return fd
[ "def", "feature_descriptor", "(", "feature_descriptions", ")", ":", "fd", "=", "FeatureDescriptor", "(", "feature_descriptions", ")", "return", "fd" ]
[ 85, 0 ]
[ 88, 13 ]
python
en
['en', 'nl', 'en']
False
feature_descriptor_forced_categories
(feature_descriptions)
Fixture FeatureDescriptor with forced categories.
Fixture FeatureDescriptor with forced categories.
def feature_descriptor_forced_categories(feature_descriptions): """Fixture FeatureDescriptor with forced categories.""" c = FeatureDescriptor._category cat_cols = ["Height", "Price"] num_cols = ["bool", "AgeGroup", "Target"] new_descriptions = copy.deepcopy(feature_descriptions) for cat in ca...
[ "def", "feature_descriptor_forced_categories", "(", "feature_descriptions", ")", ":", "c", "=", "FeatureDescriptor", ".", "_category", "cat_cols", "=", "[", "\"Height\"", ",", "\"Price\"", "]", "num_cols", "=", "[", "\"bool\"", ",", "\"AgeGroup\"", ",", "\"Target\""...
[ 92, 0 ]
[ 109, 13 ]
python
en
['en', 'en', 'en']
True
feature_descriptor_broken
(feature_descriptions)
Fixture FeatureDescriptor with str keys instead of int.
Fixture FeatureDescriptor with str keys instead of int.
def feature_descriptor_broken(feature_descriptions): """Fixture FeatureDescriptor with str keys instead of int.""" broken_features = ["Target", "AgeGroup"] for feat in broken_features: internal = feature_descriptions[feat] _ = {} for key, item in internal.items(): _[str(k...
[ "def", "feature_descriptor_broken", "(", "feature_descriptions", ")", ":", "broken_features", "=", "[", "\"Target\"", ",", "\"AgeGroup\"", "]", "for", "feat", "in", "broken_features", ":", "internal", "=", "feature_descriptions", "[", "feat", "]", "_", "=", "{", ...
[ 113, 0 ]
[ 124, 13 ]
python
en
['en', 'nl', 'en']
True
data_classification_balanced
()
Test data with 'balanced' ratio of 0s and 1s in 'Target' variable.
Test data with 'balanced' ratio of 0s and 1s in 'Target' variable.
def data_classification_balanced(): """Test data with 'balanced' ratio of 0s and 1s in 'Target' variable.""" random_seed = 56 columns = ["Sex", "AgeGroup", "Height", "Date", "Product", "Price", "bool", "Target"] length = 100 random.seed(random_seed) np.random.seed(seed=random_seed) # 50/5...
[ "def", "data_classification_balanced", "(", ")", ":", "random_seed", "=", "56", "columns", "=", "[", "\"Sex\"", ",", "\"AgeGroup\"", ",", "\"Height\"", ",", "\"Date\"", ",", "\"Product\"", ",", "\"Price\"", ",", "\"bool\"", ",", "\"Target\"", "]", "length", "=...
[ 128, 0 ]
[ 193, 15 ]
python
en
['en', 'en', 'en']
True
categorical_features
()
Categorical Features names in data_classification_balanced.
Categorical Features names in data_classification_balanced.
def categorical_features(): """Categorical Features names in data_classification_balanced.""" return ["AgeGroup", "bool", "Product", "Sex", "Target"]
[ "def", "categorical_features", "(", ")", ":", "return", "[", "\"AgeGroup\"", ",", "\"bool\"", ",", "\"Product\"", ",", "\"Sex\"", ",", "\"Target\"", "]" ]
[ 197, 0 ]
[ 199, 59 ]
python
en
['en', 'en', 'en']
True
numerical_features
()
Numerical Features names in data_classification_balanced.
Numerical Features names in data_classification_balanced.
def numerical_features(): """Numerical Features names in data_classification_balanced.""" return ["Height", "Price"]
[ "def", "numerical_features", "(", ")", ":", "return", "[", "\"Height\"", ",", "\"Price\"", "]" ]
[ 203, 0 ]
[ 205, 30 ]
python
en
['en', 'en', 'en']
True
fixture_features
(data_classification_balanced, feature_descriptor)
Fixture Features object for data_classification_balanced test data.
Fixture Features object for data_classification_balanced test data.
def fixture_features(data_classification_balanced, feature_descriptor): """Fixture Features object for data_classification_balanced test data.""" X, y = data_classification_balanced f = Features(X, y, feature_descriptor) return f
[ "def", "fixture_features", "(", "data_classification_balanced", ",", "feature_descriptor", ")", ":", "X", ",", "y", "=", "data_classification_balanced", "f", "=", "Features", "(", "X", ",", "y", ",", "feature_descriptor", ")", "return", "f" ]
[ 209, 0 ]
[ 213, 12 ]
python
en
['en', 'en', 'en']
True
expected_raw_mapping
()
Expected 'raw' mapping of values in data_classification_balanced test data.
Expected 'raw' mapping of values in data_classification_balanced test data.
def expected_raw_mapping(): """Expected 'raw' mapping of values in data_classification_balanced test data.""" expected_raw_mapping = { "Product": { "Apples": 1, "Bananas": 2, "Bread": 3, "Butter": 4, "Cheese": 5, "Cookies": 6, ...
[ "def", "expected_raw_mapping", "(", ")", ":", "expected_raw_mapping", "=", "{", "\"Product\"", ":", "{", "\"Apples\"", ":", "1", ",", "\"Bananas\"", ":", "2", ",", "\"Bread\"", ":", "3", ",", "\"Butter\"", ":", "4", ",", "\"Cheese\"", ":", "5", ",", "\"C...
[ 217, 0 ]
[ 256, 31 ]
python
en
['en', 'en', 'en']
True
expected_mapping
()
Expected final mapping (from FeaturesDescriptor) for data_classification_balanced test data.
Expected final mapping (from FeaturesDescriptor) for data_classification_balanced test data.
def expected_mapping(): """Expected final mapping (from FeaturesDescriptor) for data_classification_balanced test data.""" expected_mapping = { "Product": { 1: "Apples", 2: "Bananas", 3: "Bread", 4: "Butter", 5: "Cheese", 6: "Cookie...
[ "def", "expected_mapping", "(", ")", ":", "expected_mapping", "=", "{", "\"Product\"", ":", "{", "1", ":", "\"Apples\"", ",", "2", ":", "\"Bananas\"", ",", "3", ":", "\"Bread\"", ",", "4", ":", "\"Butter\"", ",", "5", ":", "\"Cheese\"", ",", "6", ":", ...
[ 260, 0 ]
[ 299, 27 ]
python
en
['en', 'en', 'en']
True
html_test_table
()
Test table for data_classification_balanced test_data.
Test table for data_classification_balanced test_data.
def html_test_table(): """Test table for data_classification_balanced test_data.""" _ = """ <table> <thead><tr><th></th><th></th></tr></thead> <tbody> <tr><th>Sex</th><td></td></tr> <tr><th>Target</th><td></td></tr> <tr><th>Price</th><td></td></tr> <tr><th...
[ "def", "html_test_table", "(", ")", ":", "_", "=", "\"\"\"\n <table>\n <thead><tr><th></th><th></th></tr></thead>\n <tbody>\n <tr><th>Sex</th><td></td></tr>\n <tr><th>Target</th><td></td></tr>\n <tr><th>Price</th><td></td></tr>\n <tr><th>AgeGroup</th><t...
[ 303, 0 ]
[ 319, 12 ]
python
en
['en', 'en', 'en']
True
analyzer_fixture
(fixture_features)
Fixture Analyzer for data_classification_balanced test data.
Fixture Analyzer for data_classification_balanced test data.
def analyzer_fixture(fixture_features): """Fixture Analyzer for data_classification_balanced test data.""" return Analyzer(fixture_features)
[ "def", "analyzer_fixture", "(", "fixture_features", ")", ":", "return", "Analyzer", "(", "fixture_features", ")" ]
[ 323, 0 ]
[ 325, 37 ]
python
en
['en', 'lb', 'en']
True
root_path_to_package
()
Path to modules (package) and modules (package) name.
Path to modules (package) and modules (package) name.
def root_path_to_package(): """Path to modules (package) and modules (package) name.""" package_name = "data_dashboard" root_path = os.path.split(os.getcwd())[0] return root_path, package_name
[ "def", "root_path_to_package", "(", ")", ":", "package_name", "=", "\"data_dashboard\"", "root_path", "=", "os", ".", "path", ".", "split", "(", "os", ".", "getcwd", "(", ")", ")", "[", "0", "]", "return", "root_path", ",", "package_name" ]
[ 329, 0 ]
[ 334, 34 ]
python
en
['en', 'en', 'en']
True
seed
()
Fixture random seed.
Fixture random seed.
def seed(): "Fixture random seed." return 1010
[ "def", "seed", "(", ")", ":", "return", "1010" ]
[ 338, 0 ]
[ 340, 15 ]
python
en
['sv', 'et', 'en']
False
data_regression
(data_classification_balanced)
Test data with Price feature as a target variable.
Test data with Price feature as a target variable.
def data_regression(data_classification_balanced): """Test data with Price feature as a target variable.""" df = pd.concat([data_classification_balanced[0], data_classification_balanced[1]], axis=1) target = "Price" feats = df.columns.to_list() feats.remove(target) X = df[feats] median = df[...
[ "def", "data_regression", "(", "data_classification_balanced", ")", ":", "df", "=", "pd", ".", "concat", "(", "[", "data_classification_balanced", "[", "0", "]", ",", "data_classification_balanced", "[", "1", "]", "]", ",", "axis", "=", "1", ")", "target", "...
[ 344, 0 ]
[ 353, 15 ]
python
en
['en', 'en', 'en']
True
data_multiclass
(data_classification_balanced)
Test data with multiclass 'Product Type' target variable.
Test data with multiclass 'Product Type' target variable.
def data_multiclass(data_classification_balanced): """Test data with multiclass 'Product Type' target variable.""" X = pd.concat([data_classification_balanced[0], data_classification_balanced[1]], axis=1) y = pd.Series(np.where( X["Product"].isin(["Apples", "Oranges", "Bananas"]), "Fruits", ...
[ "def", "data_multiclass", "(", "data_classification_balanced", ")", ":", "X", "=", "pd", ".", "concat", "(", "[", "data_classification_balanced", "[", "0", "]", ",", "data_classification_balanced", "[", "1", "]", "]", ",", "axis", "=", "1", ")", "y", "=", ...
[ 357, 0 ]
[ 367, 15 ]
python
en
['en', 'en', 'en']
True
fixture_features_multiclass
(data_multiclass, feature_descriptor)
Fixture Features for multiclass problem.
Fixture Features for multiclass problem.
def fixture_features_multiclass(data_multiclass, feature_descriptor): """Fixture Features for multiclass problem.""" X, y = data_multiclass f = Features(X, y, feature_descriptor) return f
[ "def", "fixture_features_multiclass", "(", "data_multiclass", ",", "feature_descriptor", ")", ":", "X", ",", "y", "=", "data_multiclass", "f", "=", "Features", "(", "X", ",", "y", ",", "feature_descriptor", ")", "return", "f" ]
[ 371, 0 ]
[ 375, 12 ]
python
en
['en', 'en', 'en']
True
preprocessor_X
(categorical_features, numerical_features, seed)
Base Fixture preprocessor X.
Base Fixture preprocessor X.
def preprocessor_X(categorical_features, numerical_features, seed): """Base Fixture preprocessor X.""" numeric_transformer = make_pipeline( SimpleImputer(strategy="median"), QuantileTransformer(output_distribution="normal", random_state=seed), StandardScaler() ) categorical_tran...
[ "def", "preprocessor_X", "(", "categorical_features", ",", "numerical_features", ",", "seed", ")", ":", "numeric_transformer", "=", "make_pipeline", "(", "SimpleImputer", "(", "strategy", "=", "\"median\"", ")", ",", "QuantileTransformer", "(", "output_distribution", ...
[ 379, 0 ]
[ 398, 26 ]
python
en
['en', 'ca', 'en']
True
transformer_classification
(categorical_features, numerical_features, seed, preprocessor_X)
Transformer for data_classification_balanced test data.
Transformer for data_classification_balanced test data.
def transformer_classification(categorical_features, numerical_features, seed, preprocessor_X): """Transformer for data_classification_balanced test data.""" categorical_features.remove("Target") tr = Transformer( categorical_features=categorical_features, numerical_features=numerical_featur...
[ "def", "transformer_classification", "(", "categorical_features", ",", "numerical_features", ",", "seed", ",", "preprocessor_X", ")", ":", "categorical_features", ".", "remove", "(", "\"Target\"", ")", "tr", "=", "Transformer", "(", "categorical_features", "=", "categ...
[ 402, 0 ]
[ 415, 13 ]
python
en
['en', 'ha', 'en']
True
transformer_regression
(categorical_features, numerical_features, seed, preprocessor_X)
Transformer for data_regression test data.
Transformer for data_regression test data.
def transformer_regression(categorical_features, numerical_features, seed, preprocessor_X): """Transformer for data_regression test data.""" numerical_features.remove("Price") tr = Transformer( categorical_features=categorical_features, numerical_features=numerical_features, target_t...
[ "def", "transformer_regression", "(", "categorical_features", ",", "numerical_features", ",", "seed", ",", "preprocessor_X", ")", ":", "numerical_features", ".", "remove", "(", "\"Price\"", ")", "tr", "=", "Transformer", "(", "categorical_features", "=", "categorical_...
[ 419, 0 ]
[ 432, 13 ]
python
da
['da', 'de', 'en']
False
transformer_multiclass
(categorical_features, numerical_features, seed, preprocessor_X)
Transformer for data_multiclass test data.
Transformer for data_multiclass test data.
def transformer_multiclass(categorical_features, numerical_features, seed, preprocessor_X): """Transformer for data_multiclass test data.""" tr = Transformer( categorical_features=categorical_features, numerical_features=numerical_features, target_type="Categorical", random_state...
[ "def", "transformer_multiclass", "(", "categorical_features", ",", "numerical_features", ",", "seed", ",", "preprocessor_X", ")", ":", "tr", "=", "Transformer", "(", "categorical_features", "=", "categorical_features", ",", "numerical_features", "=", "numerical_features",...
[ 436, 0 ]
[ 448, 13 ]
python
da
['da', 'no', 'en']
False
transformer_classification_fitted
(transformer_classification, data_classification_balanced)
Fitted Transformer for data_classification_balanced test data.
Fitted Transformer for data_classification_balanced test data.
def transformer_classification_fitted(transformer_classification, data_classification_balanced): """Fitted Transformer for data_classification_balanced test data.""" transformer_classification.fit(data_classification_balanced[0]) transformer_classification.fit_y(data_classification_balanced[1]) return t...
[ "def", "transformer_classification_fitted", "(", "transformer_classification", ",", "data_classification_balanced", ")", ":", "transformer_classification", ".", "fit", "(", "data_classification_balanced", "[", "0", "]", ")", "transformer_classification", ".", "fit_y", "(", ...
[ 452, 0 ]
[ 456, 37 ]
python
en
['en', 'en', 'en']
True
transformed_classification_data
(data_classification_balanced, transformer_classification)
Transformed data_classification_balanced test data.
Transformed data_classification_balanced test data.
def transformed_classification_data(data_classification_balanced, transformer_classification): """Transformed data_classification_balanced test data.""" X = data_classification_balanced[0] y = data_classification_balanced[1] X = X.drop(["Date"], axis=1) transformer_classification.fit(X) transfor...
[ "def", "transformed_classification_data", "(", "data_classification_balanced", ",", "transformer_classification", ")", ":", "X", "=", "data_classification_balanced", "[", "0", "]", "y", "=", "data_classification_balanced", "[", "1", "]", "X", "=", "X", ".", "drop", ...
[ 460, 0 ]
[ 467, 93 ]
python
en
['en', 'ha', 'en']
True
transformed_regression_data
(data_regression, transformer_regression)
Transformed data_regression test data.
Transformed data_regression test data.
def transformed_regression_data(data_regression, transformer_regression): """Transformed data_regression test data.""" X = data_regression[0] y = data_regression[1] X = X.drop(["Date"], axis=1) transformer_regression.fit(X) transformer_regression.fit_y(y) return transformer_regression.transf...
[ "def", "transformed_regression_data", "(", "data_regression", ",", "transformer_regression", ")", ":", "X", "=", "data_regression", "[", "0", "]", "y", "=", "data_regression", "[", "1", "]", "X", "=", "X", ".", "drop", "(", "[", "\"Date\"", "]", ",", "axis...
[ 471, 0 ]
[ 478, 85 ]
python
de
['en', 'de', 'it']
False
transformed_multiclass_data
(data_multiclass, transformer_multiclass)
Transformed data_multiclass test data.
Transformed data_multiclass test data.
def transformed_multiclass_data(data_multiclass, transformer_multiclass): """Transformed data_multiclass test data.""" X = data_multiclass[0] y = data_multiclass[1] X = X.drop(["Date"], axis=1) transformer_multiclass.fit(X) transformer_multiclass.fit_y(y) return transformer_multiclass.transf...
[ "def", "transformed_multiclass_data", "(", "data_multiclass", ",", "transformer_multiclass", ")", ":", "X", "=", "data_multiclass", "[", "0", "]", "y", "=", "data_multiclass", "[", "1", "]", "X", "=", "X", ".", "drop", "(", "[", "\"Date\"", "]", ",", "axis...
[ 482, 0 ]
[ 489, 85 ]
python
en
['sv', 'lb', 'en']
False
split_dataset_classification
(data_classification_balanced, transformer_classification, seed)
Train/test split of data_classification_balanced test data.
Train/test split of data_classification_balanced test data.
def split_dataset_classification(data_classification_balanced, transformer_classification, seed): """Train/test split of data_classification_balanced test data.""" X = data_classification_balanced[0] y = data_classification_balanced[1] X = X.drop(["Date"], axis=1) X_train, X_test, y_train, y_test = ...
[ "def", "split_dataset_classification", "(", "data_classification_balanced", ",", "transformer_classification", ",", "seed", ")", ":", "X", "=", "data_classification_balanced", "[", "0", "]", "y", "=", "data_classification_balanced", "[", "1", "]", "X", "=", "X", "."...
[ 493, 0 ]
[ 502, 99 ]
python
en
['en', 'mt', 'en']
True
split_dataset_numerical
(data_regression, transformer_regression, seed)
Train/test split of data_regression test data.
Train/test split of data_regression test data.
def split_dataset_numerical(data_regression, transformer_regression, seed): """Train/test split of data_regression test data.""" X = data_regression[0] y = data_regression[1] X = X.drop(["Date"], axis=1) X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, random_state=seed) ...
[ "def", "split_dataset_numerical", "(", "data_regression", ",", "transformer_regression", ",", "seed", ")", ":", "X", "=", "data_regression", "[", "0", "]", "y", "=", "data_regression", "[", "1", "]", "X", "=", "X", ".", "drop", "(", "[", "\"Date\"", "]", ...
[ 506, 0 ]
[ 515, 99 ]
python
en
['en', 'mt', 'en']
True
split_dataset_multiclass
(data_multiclass, transformer_multiclass, seed)
Train/test split of data_multiclass test data.
Train/test split of data_multiclass test data.
def split_dataset_multiclass(data_multiclass, transformer_multiclass, seed): """Train/test split of data_multiclass test data.""" X = data_multiclass[0] y = data_multiclass[1] X = X.drop(["Date"], axis=1) X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, random_state=seed) ...
[ "def", "split_dataset_multiclass", "(", "data_multiclass", ",", "transformer_multiclass", ",", "seed", ")", ":", "X", "=", "data_multiclass", "[", "0", "]", "y", "=", "data_multiclass", "[", "1", "]", "X", "=", "X", ".", "drop", "(", "[", "\"Date\"", "]", ...
[ 519, 0 ]
[ 528, 99 ]
python
en
['en', 'no', 'en']
True
chosen_classifiers_grid
()
Test 'Model': parameters pairs for classification.
Test 'Model': parameters pairs for classification.
def chosen_classifiers_grid(): """Test 'Model': parameters pairs for classification.""" _ = { LogisticRegression: { "tol": np.logspace(-1, 0, 2), "C": np.logspace(-1, 0, 2) }, DecisionTreeClassifier: { "max_depth": [10, None], "criterion": ...
[ "def", "chosen_classifiers_grid", "(", ")", ":", "_", "=", "{", "LogisticRegression", ":", "{", "\"tol\"", ":", "np", ".", "logspace", "(", "-", "1", ",", "0", ",", "2", ")", ",", "\"C\"", ":", "np", ".", "logspace", "(", "-", "1", ",", "0", ",",...
[ 532, 0 ]
[ 549, 12 ]
python
en
['en', 'en', 'en']
True
chosen_regressors_grid
()
Test 'Model': parameters pairs for regression.
Test 'Model': parameters pairs for regression.
def chosen_regressors_grid(): """Test 'Model': parameters pairs for regression.""" _ = { Ridge: { "alpha": np.logspace(-7, -4, 4), }, DecisionTreeRegressor: { "max_depth": [10, None], "criterion": ["mae", "mse"] }, SVR: { "t...
[ "def", "chosen_regressors_grid", "(", ")", ":", "_", "=", "{", "Ridge", ":", "{", "\"alpha\"", ":", "np", ".", "logspace", "(", "-", "7", ",", "-", "4", ",", "4", ")", ",", "}", ",", "DecisionTreeRegressor", ":", "{", "\"max_depth\"", ":", "[", "10...
[ 553, 0 ]
[ 569, 12 ]
python
en
['en', 'en', 'en']
True
multiclass_scorings
()
Wrapped scoring functions for multiclass problem.
Wrapped scoring functions for multiclass problem.
def multiclass_scorings(): """Wrapped scoring functions for multiclass problem.""" scorings = [ (f1_score, {"average": "weighted"}, "f1_score_weighted"), (precision_score, {"average": "weighted"}, "precision_score_weighted") ] new_scorings = [] for scoring, params, fname in scorings...
[ "def", "multiclass_scorings", "(", ")", ":", "scorings", "=", "[", "(", "f1_score", ",", "{", "\"average\"", ":", "\"weighted\"", "}", ",", "\"f1_score_weighted\"", ")", ",", "(", "precision_score", ",", "{", "\"average\"", ":", "\"weighted\"", "}", ",", "\"...
[ 573, 0 ]
[ 594, 23 ]
python
en
['en', 'en', 'en']
True
model_finder_classification
( transformed_classification_data, split_dataset_classification, chosen_classifiers_grid, seed )
Fixture ModelFinder for classification problem.
Fixture ModelFinder for classification problem.
def model_finder_classification( transformed_classification_data, split_dataset_classification, chosen_classifiers_grid, seed ): """Fixture ModelFinder for classification problem.""" X = transformed_classification_data[0] y = transformed_classification_data[1] X_train, X_test, y_train, y_test = ...
[ "def", "model_finder_classification", "(", "transformed_classification_data", ",", "split_dataset_classification", ",", "chosen_classifiers_grid", ",", "seed", ")", ":", "X", "=", "transformed_classification_data", "[", "0", "]", "y", "=", "transformed_classification_data", ...
[ 598, 0 ]
[ 617, 13 ]
python
da
['da', 'fr', 'en']
False
model_finder_regression
(transformed_regression_data, split_dataset_numerical, chosen_regressors_grid, seed)
Fixture ModelFinder for regression problem.
Fixture ModelFinder for regression problem.
def model_finder_regression(transformed_regression_data, split_dataset_numerical, chosen_regressors_grid, seed): """Fixture ModelFinder for regression problem.""" X = transformed_regression_data[0] y = transformed_regression_data[1] X_train, X_test, y_train, y_test = split_dataset_numerical mf = Mod...
[ "def", "model_finder_regression", "(", "transformed_regression_data", ",", "split_dataset_numerical", ",", "chosen_regressors_grid", ",", "seed", ")", ":", "X", "=", "transformed_regression_data", "[", "0", "]", "y", "=", "transformed_regression_data", "[", "1", "]", ...
[ 621, 0 ]
[ 638, 13 ]
python
da
['da', 'da', 'en']
True
model_finder_multiclass
( transformed_multiclass_data, split_dataset_multiclass, chosen_classifiers_grid, multiclass_scorings, seed )
Fixture ModelFinder for multiclass problem.
Fixture ModelFinder for multiclass problem.
def model_finder_multiclass( transformed_multiclass_data, split_dataset_multiclass, chosen_classifiers_grid, multiclass_scorings, seed ): """Fixture ModelFinder for multiclass problem.""" X = transformed_multiclass_data[0] y = transformed_multiclass_data[1] X_train, X_test, y_train, y_test = spl...
[ "def", "model_finder_multiclass", "(", "transformed_multiclass_data", ",", "split_dataset_multiclass", ",", "chosen_classifiers_grid", ",", "multiclass_scorings", ",", "seed", ")", ":", "X", "=", "transformed_multiclass_data", "[", "0", "]", "y", "=", "transformed_multicl...
[ 642, 0 ]
[ 662, 13 ]
python
da
['da', 'lb', 'en']
False
model_finder_classification_fitted
(model_finder_classification)
Fixture fitted ModelFinder for classification problem.
Fixture fitted ModelFinder for classification problem.
def model_finder_classification_fitted(model_finder_classification): """Fixture fitted ModelFinder for classification problem.""" model_finder_classification.search_and_fit(mode="quick") return model_finder_classification
[ "def", "model_finder_classification_fitted", "(", "model_finder_classification", ")", ":", "model_finder_classification", ".", "search_and_fit", "(", "mode", "=", "\"quick\"", ")", "return", "model_finder_classification" ]
[ 666, 0 ]
[ 669, 38 ]
python
en
['nb', 'en', 'en']
True
model_finder_regression_fitted
(model_finder_regression)
Fixture fitted ModelFinder for regression problem.
Fixture fitted ModelFinder for regression problem.
def model_finder_regression_fitted(model_finder_regression): """Fixture fitted ModelFinder for regression problem.""" model_finder_regression.search_and_fit(mode="quick") return model_finder_regression
[ "def", "model_finder_regression_fitted", "(", "model_finder_regression", ")", ":", "model_finder_regression", ".", "search_and_fit", "(", "mode", "=", "\"quick\"", ")", "return", "model_finder_regression" ]
[ 673, 0 ]
[ 676, 34 ]
python
en
['nb', 'en', 'en']
True
model_finder_multiclass_fitted
(model_finder_multiclass)
Fixture fitted ModelFinder for multiclass problem.
Fixture fitted ModelFinder for multiclass problem.
def model_finder_multiclass_fitted(model_finder_multiclass): """Fixture fitted ModelFinder for multiclass problem.""" model_finder_multiclass.search_and_fit(mode="quick") return model_finder_multiclass
[ "def", "model_finder_multiclass_fitted", "(", "model_finder_multiclass", ")", ":", "model_finder_multiclass", ".", "search_and_fit", "(", "mode", "=", "\"quick\"", ")", "return", "model_finder_multiclass" ]
[ 680, 0 ]
[ 683, 34 ]
python
en
['nb', 'en', 'en']
True
output
( analyzer_fixture, transformer_classification, fixture_features, model_finder_classification_fitted, tmpdir, root_path_to_package, data_classification_balanced, split_dataset_classification, seed )
Fixture Output object.
Fixture Output object.
def output( analyzer_fixture, transformer_classification, fixture_features, model_finder_classification_fitted, tmpdir, root_path_to_package, data_classification_balanced, split_dataset_classification, seed ): """Fixture Output object.""" X, y = data_classification_balanced X_train, X_test, ...
[ "def", "output", "(", "analyzer_fixture", ",", "transformer_classification", ",", "fixture_features", ",", "model_finder_classification_fitted", ",", "tmpdir", ",", "root_path_to_package", ",", "data_classification_balanced", ",", "split_dataset_classification", ",", "seed", ...
[ 687, 0 ]
[ 713, 12 ]
python
en
['en', 'en', 'en']
True
output_multiclass
( analyzer_fixture, transformer_multiclass, fixture_features_multiclass, model_finder_multiclass_fitted, tmpdir, root_path_to_package, data_multiclass, split_dataset_multiclass, seed )
Fixture Output object for multiclass problem.
Fixture Output object for multiclass problem.
def output_multiclass( analyzer_fixture, transformer_multiclass, fixture_features_multiclass, model_finder_multiclass_fitted, tmpdir, root_path_to_package, data_multiclass, split_dataset_multiclass, seed ): """Fixture Output object for multiclass problem.""" X, y = data_multiclass X_train, X...
[ "def", "output_multiclass", "(", "analyzer_fixture", ",", "transformer_multiclass", ",", "fixture_features_multiclass", ",", "model_finder_multiclass_fitted", ",", "tmpdir", ",", "root_path_to_package", ",", "data_multiclass", ",", "split_dataset_multiclass", ",", "seed", ")"...
[ 717, 0 ]
[ 745, 12 ]
python
en
['en', 'en', 'en']
True
dashboard
(data_classification_balanced, tmpdir, seed)
Fixture Dashboard object.
Fixture Dashboard object.
def dashboard(data_classification_balanced, tmpdir, seed): """Fixture Dashboard object.""" X, y = data_classification_balanced d = Dashboard(X, y, tmpdir, random_state=seed) return d
[ "def", "dashboard", "(", "data_classification_balanced", ",", "tmpdir", ",", "seed", ")", ":", "X", ",", "y", "=", "data_classification_balanced", "d", "=", "Dashboard", "(", "X", ",", "y", ",", "tmpdir", ",", "random_state", "=", "seed", ")", "return", "d...
[ 749, 0 ]
[ 753, 12 ]
python
en
['en', 'en', 'en']
True
template
()
Fixture test template.
Fixture test template.
def template(): """Fixture test template.""" return Template("Test template")
[ "def", "template", "(", ")", ":", "return", "Template", "(", "\"Test template\"", ")" ]
[ 757, 0 ]
[ 759, 36 ]
python
en
['en', 'lb', 'en']
True
detect
(byte_str)
Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray``
Detect the encoding of the given byte string.
def detect(byte_str): """ Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` """ if not isinstance(byte_str, bytearray): if not isinstance(byte_str, bytes): raise TypeError('Expecte...
[ "def", "detect", "(", "byte_str", ")", ":", "if", "not", "isinstance", "(", "byte_str", ",", "bytearray", ")", ":", "if", "not", "isinstance", "(", "byte_str", ",", "bytes", ")", ":", "raise", "TypeError", "(", "'Expected object of type bytes or bytearray, got: ...
[ 23, 0 ]
[ 38, 27 ]
python
en
['en', 'error', 'th']
False
register.check_metadata
(self)
Deprecated API.
Deprecated API.
def check_metadata(self): """Deprecated API.""" warn("distutils.command.register.check_metadata is deprecated, \ use the check command instead", PendingDeprecationWarning) check = self.distribution.get_command_obj('check') check.ensure_finalized() check.strict = sel...
[ "def", "check_metadata", "(", "self", ")", ":", "warn", "(", "\"distutils.command.register.check_metadata is deprecated, \\\n use the check command instead\"", ",", "PendingDeprecationWarning", ")", "check", "=", "self", ".", "distribution", ".", "get_command_obj", ...
[ 57, 4 ]
[ 65, 19 ]
python
en
['en', 'pt', 'en']
False
register._set_config
(self)
Reads the configuration file and set attributes.
Reads the configuration file and set attributes.
def _set_config(self): ''' Reads the configuration file and set attributes. ''' config = self._read_pypirc() if config != {}: self.username = config['username'] self.password = config['password'] self.repository = config['repository'] self....
[ "def", "_set_config", "(", "self", ")", ":", "config", "=", "self", ".", "_read_pypirc", "(", ")", "if", "config", "!=", "{", "}", ":", "self", ".", "username", "=", "config", "[", "'username'", "]", "self", ".", "password", "=", "config", "[", "'pas...
[ 67, 4 ]
[ 82, 35 ]
python
en
['en', 'en', 'en']
True
register.classifiers
(self)
Fetch the list of classifiers from the server.
Fetch the list of classifiers from the server.
def classifiers(self): ''' Fetch the list of classifiers from the server. ''' url = self.repository+'?:action=list_classifiers' response = urllib.request.urlopen(url) log.info(self._read_pypi_response(response))
[ "def", "classifiers", "(", "self", ")", ":", "url", "=", "self", ".", "repository", "+", "'?:action=list_classifiers'", "response", "=", "urllib", ".", "request", ".", "urlopen", "(", "url", ")", "log", ".", "info", "(", "self", ".", "_read_pypi_response", ...
[ 84, 4 ]
[ 89, 52 ]
python
en
['en', 'en', 'en']
True
register.verify_metadata
(self)
Send the metadata to the package index server to be checked.
Send the metadata to the package index server to be checked.
def verify_metadata(self): ''' Send the metadata to the package index server to be checked. ''' # send the info to the server and report the result (code, result) = self.post_to_server(self.build_post_data('verify')) log.info('Server response (%s): %s', code, result)
[ "def", "verify_metadata", "(", "self", ")", ":", "# send the info to the server and report the result", "(", "code", ",", "result", ")", "=", "self", ".", "post_to_server", "(", "self", ".", "build_post_data", "(", "'verify'", ")", ")", "log", ".", "info", "(", ...
[ 91, 4 ]
[ 96, 58 ]
python
en
['en', 'en', 'en']
True
register.send_metadata
(self)
Send the metadata to the package index server. Well, do the following: 1. figure who the user is, and then 2. send the data as a Basic auth'ed POST. First we try to read the username/password from $HOME/.pypirc, which is a ConfigParser-formatted file with a...
Send the metadata to the package index server.
def send_metadata(self): ''' Send the metadata to the package index server. Well, do the following: 1. figure who the user is, and then 2. send the data as a Basic auth'ed POST. First we try to read the username/password from $HOME/.pypirc, which is ...
[ "def", "send_metadata", "(", "self", ")", ":", "# see if we can short-cut and get the username/password from the", "# config", "if", "self", ".", "has_config", ":", "choice", "=", "'1'", "username", "=", "self", ".", "username", "password", "=", "self", ".", "passwo...
[ 98, 4 ]
[ 218, 62 ]
python
en
['en', 'en', 'en']
True
register.post_to_server
(self, data, auth=None)
Post a query to the server, and return a string response.
Post a query to the server, and return a string response.
def post_to_server(self, data, auth=None): ''' Post a query to the server, and return a string response. ''' if 'name' in data: self.announce('Registering %s to %s' % (data['name'], self.repository), ...
[ "def", "post_to_server", "(", "self", ",", "data", ",", "auth", "=", "None", ")", ":", "if", "'name'", "in", "data", ":", "self", ".", "announce", "(", "'Registering %s to %s'", "%", "(", "data", "[", "'name'", "]", ",", "self", ".", "repository", ")",...
[ 248, 4 ]
[ 303, 21 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChanges
(self)
Verify sustain controls extend notes until the end of the control.
Verify sustain controls extend notes until the end of the control.
def testApplySustainControlChanges(self): """Verify sustain controls extend notes until the end of the control.""" sequence = copy.copy(self.note_sequence) testing_lib.add_control_changes_to_sequence( sequence, 0, [(0.0, 64, 127), (0.75, 64, 0), (2.0, 64, 127), (3.0, 64, 0), (3.75, ...
[ "def", "testApplySustainControlChanges", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "0.0", ",", "64", "...
[ 1322, 2 ]
[ 1342, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesWithRepeatedNotes
(self)
Verify that sustain control handles repeated notes correctly. For example, a single pitch played before sustain: x-- x-- x-- After sustain: x---x---x-- Notes should be extended until either the end of the sustain control or the beginning of another note of the same pitch.
Verify that sustain control handles repeated notes correctly.
def testApplySustainControlChangesWithRepeatedNotes(self): """Verify that sustain control handles repeated notes correctly. For example, a single pitch played before sustain: x-- x-- x-- After sustain: x---x---x-- Notes should be extended until either the end of the sustain control or the ...
[ "def", "testApplySustainControlChangesWithRepeatedNotes", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "1.0", ...
[ 1344, 2 ]
[ 1370, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesWithRepeatedNotesBeforeSustain
(self)
Repeated notes before sustain can overlap and should not be modified. Once a repeat happens within the sustain, any active notes should end before the next one starts. This is kind of an edge case because a note overlapping a note of the same pitch may not make sense, but apply_sustain_control_changes...
Repeated notes before sustain can overlap and should not be modified.
def testApplySustainControlChangesWithRepeatedNotesBeforeSustain(self): """Repeated notes before sustain can overlap and should not be modified. Once a repeat happens within the sustain, any active notes should end before the next one starts. This is kind of an edge case because a note overlapping a n...
[ "def", "testApplySustainControlChangesWithRepeatedNotesBeforeSustain", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(...
[ 1372, 2 ]
[ 1395, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesSimultaneousOnOff
(self)
Test sustain on and off events happening at the same time. The off event should be processed last, so this should be a no-op.
Test sustain on and off events happening at the same time.
def testApplySustainControlChangesSimultaneousOnOff(self): """Test sustain on and off events happening at the same time. The off event should be processed last, so this should be a no-op. """ sequence = copy.copy(self.note_sequence) testing_lib.add_control_changes_to_sequence( sequence, 0, ...
[ "def", "testApplySustainControlChangesSimultaneousOnOff", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "1.0", ...
[ 1397, 2 ]
[ 1410, 50 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesExtendNotesToEnd
(self)
Test sustain control extending the duration of the final note.
Test sustain control extending the duration of the final note.
def testApplySustainControlChangesExtendNotesToEnd(self): """Test sustain control extending the duration of the final note.""" sequence = copy.copy(self.note_sequence) testing_lib.add_control_changes_to_sequence( sequence, 0, [(1.0, 64, 127), (4.0, 64, 0)]) expected_sequence = copy.copy(sequence...
[ "def", "testApplySustainControlChangesExtendNotesToEnd", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "1.0", ...
[ 1412, 2 ]
[ 1427, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesExtraneousSustain
(self)
Test applying extraneous sustain control at the end of the sequence.
Test applying extraneous sustain control at the end of the sequence.
def testApplySustainControlChangesExtraneousSustain(self): """Test applying extraneous sustain control at the end of the sequence.""" sequence = copy.copy(self.note_sequence) testing_lib.add_control_changes_to_sequence( sequence, 0, [(4.0, 64, 127), (5.0, 64, 0)]) expected_sequence = copy.copy(s...
[ "def", "testApplySustainControlChangesExtraneousSustain", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "4.0", ...
[ 1429, 2 ]
[ 1446, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesWithIdenticalNotes
(self)
In the case of identical notes, one should be dropped. This is an edge case because in most cases, the same pitch should not sound twice at the same time on one instrument.
In the case of identical notes, one should be dropped.
def testApplySustainControlChangesWithIdenticalNotes(self): """In the case of identical notes, one should be dropped. This is an edge case because in most cases, the same pitch should not sound twice at the same time on one instrument. """ sequence = copy.copy(self.note_sequence) testing_lib.ad...
[ "def", "testApplySustainControlChangesWithIdenticalNotes", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "1.0", ...
[ 1448, 2 ]
[ 1467, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesWithDrumNotes
(self)
Drum notes should not be modified when applying sustain changes.
Drum notes should not be modified when applying sustain changes.
def testApplySustainControlChangesWithDrumNotes(self): """Drum notes should not be modified when applying sustain changes.""" sequence = copy.copy(self.note_sequence) testing_lib.add_control_changes_to_sequence( sequence, 0, [(1.0, 64, 127), (4.0, 64, 0)]) expected_sequence = copy.copy(s...
[ "def", "testApplySustainControlChangesWithDrumNotes", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", "1.0", ","...
[ 1469, 2 ]
[ 1490, 59 ]
python
en
['en', 'en', 'en']
True
SequencesLibTest.testApplySustainControlChangesProcessSustainBeforeNotes
(self)
Verify sustain controls extend notes until the end of the control.
Verify sustain controls extend notes until the end of the control.
def testApplySustainControlChangesProcessSustainBeforeNotes(self): """Verify sustain controls extend notes until the end of the control.""" sequence = copy.copy(self.note_sequence) testing_lib.add_control_changes_to_sequence( sequence, 0, [(0.0, 64, 127), (0.75, 64, 0), (2.0, 64, 127), (3.0,...
[ "def", "testApplySustainControlChangesProcessSustainBeforeNotes", "(", "self", ")", ":", "sequence", "=", "copy", ".", "copy", "(", "self", ".", "note_sequence", ")", "testing_lib", ".", "add_control_changes_to_sequence", "(", "sequence", ",", "0", ",", "[", "(", ...
[ 1492, 2 ]
[ 1507, 59 ]
python
en
['en', 'en', 'en']
True
get_cmap
(n, name="hsv")
Returns a function that maps each index in 0, 1, ..., n-1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name.
Returns a function that maps each index in 0, 1, ..., n-1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name.
def get_cmap(n, name="hsv"): """Returns a function that maps each index in 0, 1, ..., n-1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name.""" return plt.cm.get_cmap(name, n)
[ "def", "get_cmap", "(", "n", ",", "name", "=", "\"hsv\"", ")", ":", "return", "plt", ".", "cm", ".", "get_cmap", "(", "name", ",", "n", ")" ]
[ 17, 0 ]
[ 20, 35 ]
python
en
['en', 'en', 'en']
True
WebElementWrapper._reload_element
(self)
Method for starting reload process on current instance.
Method for starting reload process on current instance.
def _reload_element(self): """Method for starting reload process on current instance.""" web_el = self.src_element.reload_request(self.locator, self.index) if not web_el: return False self._parent = web_el.parent self._id = web_el.id return True
[ "def", "_reload_element", "(", "self", ")", ":", "web_el", "=", "self", ".", "src_element", ".", "reload_request", "(", "self", ".", "locator", ",", "self", ".", "index", ")", "if", "not", "web_el", ":", "return", "False", "self", ".", "_parent", "=", ...
[ 86, 4 ]
[ 93, 19 ]
python
en
['en', 'en', 'en']
True
WebElementWrapper._execute
(self, command, params=None)
Overriding in order to catch StaleElementReferenceException.
Overriding in order to catch StaleElementReferenceException.
def _execute(self, command, params=None): """Overriding in order to catch StaleElementReferenceException.""" # (schipiga): not need to use while True, trying to catch StaleElement # exception, because driver.implicitly_wait delegates this to browser. # Just we need to catch StaleElement ...
[ "def", "_execute", "(", "self", ",", "command", ",", "params", "=", "None", ")", ":", "# (schipiga): not need to use while True, trying to catch StaleElement", "# exception, because driver.implicitly_wait delegates this to browser.", "# Just we need to catch StaleElement exception, reloa...
[ 95, 4 ]
[ 110, 25 ]
python
en
['en', 'en', 'en']
True
parse_requirements
( filename, # type: str session, # type: PipSession finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] constraint=False, # type: bool )
Parse a requirements file and yield ParsedRequirement instances. :param filename: Path or url of requirements file. :param session: PipSession instance. :param finder: Instance of pip.index.PackageFinder. :param comes_from: Origin description of requirements. :param options: cli op...
Parse a requirements file and yield ParsedRequirement instances.
def parse_requirements( filename, # type: str session, # type: PipSession finder=None, # type: Optional[PackageFinder] comes_from=None, # type: Optional[str] options=None, # type: Optional[optparse.Values] constraint=False, # type: bool ): # type: (...) -> Iterator[ParsedRequirement] ...
[ "def", "parse_requirements", "(", "filename", ",", "# type: str", "session", ",", "# type: PipSession", "finder", "=", "None", ",", "# type: Optional[PackageFinder]", "comes_from", "=", "None", ",", "# type: Optional[str]", "options", "=", "None", ",", "# type: Optional...
[ 127, 0 ]
[ 157, 28 ]
python
en
['en', 'en', 'en']
True
preprocess
(content)
Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file
Split, filter, and join lines, and return a line iterator
def preprocess(content): # type: (Text) -> ReqFileLines """Split, filter, and join lines, and return a line iterator :param content: the content of the requirements file """ lines_enum = enumerate(content.splitlines(), start=1) # type: ReqFileLines lines_enum = join_lines(lines_enum) lines...
[ "def", "preprocess", "(", "content", ")", ":", "# type: (Text) -> ReqFileLines", "lines_enum", "=", "enumerate", "(", "content", ".", "splitlines", "(", ")", ",", "start", "=", "1", ")", "# type: ReqFileLines", "lines_enum", "=", "join_lines", "(", "lines_enum", ...
[ 160, 0 ]
[ 170, 21 ]
python
en
['en', 'en', 'en']
True
handle_line
( line, # type: ParsedLine options=None, # type: Optional[optparse.Values] finder=None, # type: Optional[PackageFinder] session=None, # type: Optional[PipSession] )
Handle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder. :param line: The parsed line to be processed. :param options: CLI options. :param finder: The finder - updated by non-requirement lines. :param session: The sessi...
Handle a single parsed requirements line; This can result in creating/yielding requirements, or updating the finder.
def handle_line( line, # type: ParsedLine options=None, # type: Optional[optparse.Values] finder=None, # type: Optional[PackageFinder] session=None, # type: Optional[PipSession] ): # type: (...) -> Optional[ParsedRequirement] """Handle a single parsed requirements line; This can result in ...
[ "def", "handle_line", "(", "line", ",", "# type: ParsedLine", "options", "=", "None", ",", "# type: Optional[optparse.Values]", "finder", "=", "None", ",", "# type: Optional[PackageFinder]", "session", "=", "None", ",", "# type: Optional[PipSession]", ")", ":", "# type:...
[ 276, 0 ]
[ 318, 19 ]
python
en
['en', 'en', 'en']
True
break_args_options
(line)
Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.
Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex.
def break_args_options(line): # type: (Text) -> Tuple[str, Text] """Break up the line into an args and options string. We only want to shlex (and then optparse) the options, not the args. args can contain markers which are corrupted by shlex. """ tokens = line.split(' ') args = [] opti...
[ "def", "break_args_options", "(", "line", ")", ":", "# type: (Text) -> Tuple[str, Text]", "tokens", "=", "line", ".", "split", "(", "' '", ")", "args", "=", "[", "]", "options", "=", "tokens", "[", ":", "]", "for", "token", "in", "tokens", ":", "if", "to...
[ 426, 0 ]
[ 441, 44 ]
python
en
['en', 'en', 'en']
True
build_parser
()
Return a parser for parsing requirement lines
Return a parser for parsing requirement lines
def build_parser(): # type: () -> optparse.OptionParser """ Return a parser for parsing requirement lines """ parser = optparse.OptionParser(add_help_option=False) option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ for option_factory in option_factories: option = option_fa...
[ "def", "build_parser", "(", ")", ":", "# type: () -> optparse.OptionParser", "parser", "=", "optparse", ".", "OptionParser", "(", "add_help_option", "=", "False", ")", "option_factories", "=", "SUPPORTED_OPTIONS", "+", "SUPPORTED_OPTIONS_REQ", "for", "option_factory", "...
[ 450, 0 ]
[ 471, 17 ]
python
en
['en', 'error', 'th']
False
join_lines
(lines_enum)
Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line.
Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line.
def join_lines(lines_enum): # type: (ReqFileLines) -> ReqFileLines """Joins a line ending in '\' with the previous line (except when following comments). The joined line takes on the index of the first line. """ primary_line_number = None new_line = [] # type: List[Text] for line_number, l...
[ "def", "join_lines", "(", "lines_enum", ")", ":", "# type: (ReqFileLines) -> ReqFileLines", "primary_line_number", "=", "None", "new_line", "=", "[", "]", "# type: List[Text]", "for", "line_number", ",", "line", "in", "lines_enum", ":", "if", "not", "line", ".", "...
[ 474, 0 ]
[ 501, 52 ]
python
en
['en', 'en', 'en']
True
ignore_comments
(lines_enum)
Strips comments and filter empty lines.
Strips comments and filter empty lines.
def ignore_comments(lines_enum): # type: (ReqFileLines) -> ReqFileLines """ Strips comments and filter empty lines. """ for line_number, line in lines_enum: line = COMMENT_RE.sub('', line) line = line.strip() if line: yield line_number, line
[ "def", "ignore_comments", "(", "lines_enum", ")", ":", "# type: (ReqFileLines) -> ReqFileLines", "for", "line_number", ",", "line", "in", "lines_enum", ":", "line", "=", "COMMENT_RE", ".", "sub", "(", "''", ",", "line", ")", "line", "=", "line", ".", "strip", ...
[ 506, 0 ]
[ 515, 35 ]
python
en
['en', 'error', 'th']
False
expand_env_variables
(lines_enum)
Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that contain a `$` aren't accidentally (partially) expanded. 2. Ensure consistency across pl...
Replace all environment variables that can be retrieved via `os.getenv`.
def expand_env_variables(lines_enum): # type: (ReqFileLines) -> ReqFileLines """Replace all environment variables that can be retrieved via `os.getenv`. The only allowed format for environment variables defined in the requirement file is `${MY_VARIABLE_1}` to ensure two things: 1. Strings that con...
[ "def", "expand_env_variables", "(", "lines_enum", ")", ":", "# type: (ReqFileLines) -> ReqFileLines", "for", "line_number", ",", "line", "in", "lines_enum", ":", "for", "env_var", ",", "var_name", "in", "ENV_VAR_RE", ".", "findall", "(", "line", ")", ":", "value",...
[ 518, 0 ]
[ 543, 31 ]
python
en
['en', 'en', 'en']
True
get_file_content
(url, session, comes_from=None)
Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. :param url: File path or url. :param session: PipSession instance. :param comes_from: Origin descrip...
Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files.
def get_file_content(url, session, comes_from=None): # type: (str, PipSession, Optional[str]) -> Tuple[str, Text] """Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode. Respects # -*- coding: declarations on the retrieved files. ...
[ "def", "get_file_content", "(", "url", ",", "session", ",", "comes_from", "=", "None", ")", ":", "# type: (str, PipSession, Optional[str]) -> Tuple[str, Text]", "scheme", "=", "get_url_scheme", "(", "url", ")", "if", "scheme", "in", "[", "'http'", ",", "'https'", ...
[ 546, 0 ]
[ 588, 23 ]
python
en
['en', 'en', 'en']
True
RequirementsFileParser.parse
(self, filename, constraint)
Parse a given file, yielding parsed lines.
Parse a given file, yielding parsed lines.
def parse(self, filename, constraint): # type: (str, bool) -> Iterator[ParsedLine] """Parse a given file, yielding parsed lines. """ for line in self._parse_and_recurse(filename, constraint): yield line
[ "def", "parse", "(", "self", ",", "filename", ",", "constraint", ")", ":", "# type: (str, bool) -> Iterator[ParsedLine]", "for", "line", "in", "self", ".", "_parse_and_recurse", "(", "filename", ",", "constraint", ")", ":", "yield", "line" ]
[ 333, 4 ]
[ 338, 22 ]
python
en
['en', 'en', 'en']
True
copyfileobj
(fsrc, fdst, length=16*1024)
copy data from file-like object fsrc to file-like object fdst
copy data from file-like object fsrc to file-like object fdst
def copyfileobj(fsrc, fdst, length=16*1024): """copy data from file-like object fsrc to file-like object fdst""" while 1: buf = fsrc.read(length) if not buf: break fdst.write(buf)
[ "def", "copyfileobj", "(", "fsrc", ",", "fdst", ",", "length", "=", "16", "*", "1024", ")", ":", "while", "1", ":", "buf", "=", "fsrc", ".", "read", "(", "length", ")", "if", "not", "buf", ":", "break", "fdst", ".", "write", "(", "buf", ")" ]
[ 69, 0 ]
[ 75, 23 ]
python
en
['en', 'en', 'en']
True