id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
17,100 | skggm/skggm | examples/estimator_suite_spark.py | sk_ledoit_wolf | def sk_ledoit_wolf(X):
"""Estimate inverse covariance via scikit-learn ledoit_wolf function.
"""
print("Ledoit-Wolf (sklearn)")
lw_cov_, _ = ledoit_wolf(X)
lw_prec_ = np.linalg.inv(lw_cov_)
return lw_cov_, lw_prec_ | python | def sk_ledoit_wolf(X):
"""Estimate inverse covariance via scikit-learn ledoit_wolf function.
"""
print("Ledoit-Wolf (sklearn)")
lw_cov_, _ = ledoit_wolf(X)
lw_prec_ = np.linalg.inv(lw_cov_)
return lw_cov_, lw_prec_ | [
"def",
"sk_ledoit_wolf",
"(",
"X",
")",
":",
"print",
"(",
"\"Ledoit-Wolf (sklearn)\"",
")",
"lw_cov_",
",",
"_",
"=",
"ledoit_wolf",
"(",
"X",
")",
"lw_prec_",
"=",
"np",
".",
"linalg",
".",
"inv",
"(",
"lw_cov_",
")",
"return",
"lw_cov_",
",",
"lw_prec... | Estimate inverse covariance via scikit-learn ledoit_wolf function. | [
"Estimate",
"inverse",
"covariance",
"via",
"scikit",
"-",
"learn",
"ledoit_wolf",
"function",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/examples/estimator_suite_spark.py#L240-L246 |
17,101 | skggm/skggm | inverse_covariance/profiling/metrics.py | _nonzero_intersection | def _nonzero_intersection(m, m_hat):
"""Count the number of nonzeros in and between m and m_hat.
Returns
----------
m_nnz : number of nonzeros in m (w/o diagonal)
m_hat_nnz : number of nonzeros in m_hat (w/o diagonal)
intersection_nnz : number of nonzeros in intersection of m/m_hat
... | python | def _nonzero_intersection(m, m_hat):
"""Count the number of nonzeros in and between m and m_hat.
Returns
----------
m_nnz : number of nonzeros in m (w/o diagonal)
m_hat_nnz : number of nonzeros in m_hat (w/o diagonal)
intersection_nnz : number of nonzeros in intersection of m/m_hat
... | [
"def",
"_nonzero_intersection",
"(",
"m",
",",
"m_hat",
")",
":",
"n_features",
",",
"_",
"=",
"m",
".",
"shape",
"m_no_diag",
"=",
"m",
".",
"copy",
"(",
")",
"m_no_diag",
"[",
"np",
".",
"diag_indices",
"(",
"n_features",
")",
"]",
"=",
"0",
"m_hat... | Count the number of nonzeros in and between m and m_hat.
Returns
----------
m_nnz : number of nonzeros in m (w/o diagonal)
m_hat_nnz : number of nonzeros in m_hat (w/o diagonal)
intersection_nnz : number of nonzeros in intersection of m/m_hat
(w/o diagonal) | [
"Count",
"the",
"number",
"of",
"nonzeros",
"in",
"and",
"between",
"m",
"and",
"m_hat",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/profiling/metrics.py#L4-L30 |
17,102 | skggm/skggm | inverse_covariance/profiling/metrics.py | support_false_positive_count | def support_false_positive_count(m, m_hat):
"""Count the number of false positive support elements in
m_hat in one triangle, not including the diagonal.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_hat_nnz - intersection_nnz) / 2.0) | python | def support_false_positive_count(m, m_hat):
"""Count the number of false positive support elements in
m_hat in one triangle, not including the diagonal.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_hat_nnz - intersection_nnz) / 2.0) | [
"def",
"support_false_positive_count",
"(",
"m",
",",
"m_hat",
")",
":",
"m_nnz",
",",
"m_hat_nnz",
",",
"intersection_nnz",
"=",
"_nonzero_intersection",
"(",
"m",
",",
"m_hat",
")",
"return",
"int",
"(",
"(",
"m_hat_nnz",
"-",
"intersection_nnz",
")",
"/",
... | Count the number of false positive support elements in
m_hat in one triangle, not including the diagonal. | [
"Count",
"the",
"number",
"of",
"false",
"positive",
"support",
"elements",
"in",
"m_hat",
"in",
"one",
"triangle",
"not",
"including",
"the",
"diagonal",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/profiling/metrics.py#L33-L38 |
17,103 | skggm/skggm | inverse_covariance/profiling/metrics.py | support_false_negative_count | def support_false_negative_count(m, m_hat):
"""Count the number of false negative support elements in
m_hat in one triangle, not including the diagonal.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_nnz - intersection_nnz) / 2.0) | python | def support_false_negative_count(m, m_hat):
"""Count the number of false negative support elements in
m_hat in one triangle, not including the diagonal.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_nnz - intersection_nnz) / 2.0) | [
"def",
"support_false_negative_count",
"(",
"m",
",",
"m_hat",
")",
":",
"m_nnz",
",",
"m_hat_nnz",
",",
"intersection_nnz",
"=",
"_nonzero_intersection",
"(",
"m",
",",
"m_hat",
")",
"return",
"int",
"(",
"(",
"m_nnz",
"-",
"intersection_nnz",
")",
"/",
"2.... | Count the number of false negative support elements in
m_hat in one triangle, not including the diagonal. | [
"Count",
"the",
"number",
"of",
"false",
"negative",
"support",
"elements",
"in",
"m_hat",
"in",
"one",
"triangle",
"not",
"including",
"the",
"diagonal",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/profiling/metrics.py#L41-L46 |
17,104 | skggm/skggm | inverse_covariance/profiling/metrics.py | support_difference_count | def support_difference_count(m, m_hat):
"""Count the number of different elements in the support in one triangle,
not including the diagonal.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_nnz + m_hat_nnz - (2 * intersection_nnz)) / 2.0) | python | def support_difference_count(m, m_hat):
"""Count the number of different elements in the support in one triangle,
not including the diagonal.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_nnz + m_hat_nnz - (2 * intersection_nnz)) / 2.0) | [
"def",
"support_difference_count",
"(",
"m",
",",
"m_hat",
")",
":",
"m_nnz",
",",
"m_hat_nnz",
",",
"intersection_nnz",
"=",
"_nonzero_intersection",
"(",
"m",
",",
"m_hat",
")",
"return",
"int",
"(",
"(",
"m_nnz",
"+",
"m_hat_nnz",
"-",
"(",
"2",
"*",
... | Count the number of different elements in the support in one triangle,
not including the diagonal. | [
"Count",
"the",
"number",
"of",
"different",
"elements",
"in",
"the",
"support",
"in",
"one",
"triangle",
"not",
"including",
"the",
"diagonal",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/profiling/metrics.py#L49-L54 |
17,105 | skggm/skggm | inverse_covariance/profiling/metrics.py | has_exact_support | def has_exact_support(m, m_hat):
"""Returns 1 if support_difference_count is zero, 0 else.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_nnz + m_hat_nnz - (2 * intersection_nnz)) == 0) | python | def has_exact_support(m, m_hat):
"""Returns 1 if support_difference_count is zero, 0 else.
"""
m_nnz, m_hat_nnz, intersection_nnz = _nonzero_intersection(m, m_hat)
return int((m_nnz + m_hat_nnz - (2 * intersection_nnz)) == 0) | [
"def",
"has_exact_support",
"(",
"m",
",",
"m_hat",
")",
":",
"m_nnz",
",",
"m_hat_nnz",
",",
"intersection_nnz",
"=",
"_nonzero_intersection",
"(",
"m",
",",
"m_hat",
")",
"return",
"int",
"(",
"(",
"m_nnz",
"+",
"m_hat_nnz",
"-",
"(",
"2",
"*",
"inters... | Returns 1 if support_difference_count is zero, 0 else. | [
"Returns",
"1",
"if",
"support_difference_count",
"is",
"zero",
"0",
"else",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/profiling/metrics.py#L57-L61 |
17,106 | skggm/skggm | inverse_covariance/profiling/metrics.py | has_approx_support | def has_approx_support(m, m_hat, prob=0.01):
"""Returns 1 if model selection error is less than or equal to prob rate,
0 else.
NOTE: why does np.nonzero/np.flatnonzero create so much problems?
"""
m_nz = np.flatnonzero(np.triu(m, 1))
m_hat_nz = np.flatnonzero(np.triu(m_hat, 1))
upper_diago... | python | def has_approx_support(m, m_hat, prob=0.01):
"""Returns 1 if model selection error is less than or equal to prob rate,
0 else.
NOTE: why does np.nonzero/np.flatnonzero create so much problems?
"""
m_nz = np.flatnonzero(np.triu(m, 1))
m_hat_nz = np.flatnonzero(np.triu(m_hat, 1))
upper_diago... | [
"def",
"has_approx_support",
"(",
"m",
",",
"m_hat",
",",
"prob",
"=",
"0.01",
")",
":",
"m_nz",
"=",
"np",
".",
"flatnonzero",
"(",
"np",
".",
"triu",
"(",
"m",
",",
"1",
")",
")",
"m_hat_nz",
"=",
"np",
".",
"flatnonzero",
"(",
"np",
".",
"triu... | Returns 1 if model selection error is less than or equal to prob rate,
0 else.
NOTE: why does np.nonzero/np.flatnonzero create so much problems? | [
"Returns",
"1",
"if",
"model",
"selection",
"error",
"is",
"less",
"than",
"or",
"equal",
"to",
"prob",
"rate",
"0",
"else",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/profiling/metrics.py#L64-L88 |
17,107 | skggm/skggm | inverse_covariance/inverse_covariance.py | _validate_path | def _validate_path(path):
"""Sorts path values from largest to smallest.
Will warn if path parameter was not already sorted.
"""
if path is None:
return None
new_path = np.array(sorted(set(path), reverse=True))
if new_path[0] != path[0]:
print("Warning: Path must be sorted larg... | python | def _validate_path(path):
"""Sorts path values from largest to smallest.
Will warn if path parameter was not already sorted.
"""
if path is None:
return None
new_path = np.array(sorted(set(path), reverse=True))
if new_path[0] != path[0]:
print("Warning: Path must be sorted larg... | [
"def",
"_validate_path",
"(",
"path",
")",
":",
"if",
"path",
"is",
"None",
":",
"return",
"None",
"new_path",
"=",
"np",
".",
"array",
"(",
"sorted",
"(",
"set",
"(",
"path",
")",
",",
"reverse",
"=",
"True",
")",
")",
"if",
"new_path",
"[",
"0",
... | Sorts path values from largest to smallest.
Will warn if path parameter was not already sorted. | [
"Sorts",
"path",
"values",
"from",
"largest",
"to",
"smallest",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/inverse_covariance.py#L77-L89 |
17,108 | skggm/skggm | inverse_covariance/inverse_covariance.py | InverseCovarianceEstimator.ebic | def ebic(self, gamma=0):
"""Compute EBIC scores for each model. If model is not "path" then
returns a scalar score value.
May require self.path_
See:
Extended Bayesian Information Criteria for Gaussian Graphical Models
R. Foygel and M. Drton
NIPS 2010
P... | python | def ebic(self, gamma=0):
"""Compute EBIC scores for each model. If model is not "path" then
returns a scalar score value.
May require self.path_
See:
Extended Bayesian Information Criteria for Gaussian Graphical Models
R. Foygel and M. Drton
NIPS 2010
P... | [
"def",
"ebic",
"(",
"self",
",",
"gamma",
"=",
"0",
")",
":",
"if",
"not",
"self",
".",
"is_fitted_",
":",
"return",
"if",
"not",
"isinstance",
"(",
"self",
".",
"precision_",
",",
"list",
")",
":",
"return",
"metrics",
".",
"ebic",
"(",
"self",
".... | Compute EBIC scores for each model. If model is not "path" then
returns a scalar score value.
May require self.path_
See:
Extended Bayesian Information Criteria for Gaussian Graphical Models
R. Foygel and M. Drton
NIPS 2010
Parameters
----------
... | [
"Compute",
"EBIC",
"scores",
"for",
"each",
"model",
".",
"If",
"model",
"is",
"not",
"path",
"then",
"returns",
"a",
"scalar",
"score",
"value",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/inverse_covariance.py#L268-L313 |
17,109 | skggm/skggm | inverse_covariance/inverse_covariance.py | InverseCovarianceEstimator.ebic_select | def ebic_select(self, gamma=0):
"""Uses Extended Bayesian Information Criteria for model selection.
Can only be used in path mode (doesn't really make sense otherwise).
See:
Extended Bayesian Information Criteria for Gaussian Graphical Models
R. Foygel and M. Drton
NIPS... | python | def ebic_select(self, gamma=0):
"""Uses Extended Bayesian Information Criteria for model selection.
Can only be used in path mode (doesn't really make sense otherwise).
See:
Extended Bayesian Information Criteria for Gaussian Graphical Models
R. Foygel and M. Drton
NIPS... | [
"def",
"ebic_select",
"(",
"self",
",",
"gamma",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"precision_",
",",
"list",
")",
":",
"raise",
"ValueError",
"(",
"\"EBIC requires multiple models to select from.\"",
")",
"return",
"if",
"not",
... | Uses Extended Bayesian Information Criteria for model selection.
Can only be used in path mode (doesn't really make sense otherwise).
See:
Extended Bayesian Information Criteria for Gaussian Graphical Models
R. Foygel and M. Drton
NIPS 2010
Parameters
---------... | [
"Uses",
"Extended",
"Bayesian",
"Information",
"Criteria",
"for",
"model",
"selection",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/inverse_covariance.py#L315-L345 |
17,110 | skggm/skggm | examples/estimator_suite.py | quic_graph_lasso | def quic_graph_lasso(X, num_folds, metric):
"""Run QuicGraphicalLasso with mode='default' and use standard scikit
GridSearchCV to find the best lambda.
Primarily demonstrates compatibility with existing scikit tooling.
"""
print("QuicGraphicalLasso + GridSearchCV with:")
print(" metric: {}".f... | python | def quic_graph_lasso(X, num_folds, metric):
"""Run QuicGraphicalLasso with mode='default' and use standard scikit
GridSearchCV to find the best lambda.
Primarily demonstrates compatibility with existing scikit tooling.
"""
print("QuicGraphicalLasso + GridSearchCV with:")
print(" metric: {}".f... | [
"def",
"quic_graph_lasso",
"(",
"X",
",",
"num_folds",
",",
"metric",
")",
":",
"print",
"(",
"\"QuicGraphicalLasso + GridSearchCV with:\"",
")",
"print",
"(",
"\" metric: {}\"",
".",
"format",
"(",
"metric",
")",
")",
"search_grid",
"=",
"{",
"\"lam\"",
":",
... | Run QuicGraphicalLasso with mode='default' and use standard scikit
GridSearchCV to find the best lambda.
Primarily demonstrates compatibility with existing scikit tooling. | [
"Run",
"QuicGraphicalLasso",
"with",
"mode",
"=",
"default",
"and",
"use",
"standard",
"scikit",
"GridSearchCV",
"to",
"find",
"the",
"best",
"lambda",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/examples/estimator_suite.py#L97-L117 |
17,111 | skggm/skggm | examples/estimator_suite.py | quic_graph_lasso_cv | def quic_graph_lasso_cv(X, metric):
"""Run QuicGraphicalLassoCV on data with metric of choice.
Compare results with GridSearchCV + quic_graph_lasso. The number of
lambdas tested should be much lower with similar final lam_ selected.
"""
print("QuicGraphicalLassoCV with:")
print(" metric: {}"... | python | def quic_graph_lasso_cv(X, metric):
"""Run QuicGraphicalLassoCV on data with metric of choice.
Compare results with GridSearchCV + quic_graph_lasso. The number of
lambdas tested should be much lower with similar final lam_ selected.
"""
print("QuicGraphicalLassoCV with:")
print(" metric: {}"... | [
"def",
"quic_graph_lasso_cv",
"(",
"X",
",",
"metric",
")",
":",
"print",
"(",
"\"QuicGraphicalLassoCV with:\"",
")",
"print",
"(",
"\" metric: {}\"",
".",
"format",
"(",
"metric",
")",
")",
"model",
"=",
"QuicGraphicalLassoCV",
"(",
"cv",
"=",
"2",
",",
"... | Run QuicGraphicalLassoCV on data with metric of choice.
Compare results with GridSearchCV + quic_graph_lasso. The number of
lambdas tested should be much lower with similar final lam_ selected. | [
"Run",
"QuicGraphicalLassoCV",
"on",
"data",
"with",
"metric",
"of",
"choice",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/examples/estimator_suite.py#L120-L139 |
17,112 | skggm/skggm | examples/estimator_suite.py | graph_lasso | def graph_lasso(X, num_folds):
"""Estimate inverse covariance via scikit-learn GraphLassoCV class.
"""
print("GraphLasso (sklearn)")
model = GraphLassoCV(cv=num_folds)
model.fit(X)
print(" lam_: {}".format(model.alpha_))
return model.covariance_, model.precision_, model.alpha_ | python | def graph_lasso(X, num_folds):
"""Estimate inverse covariance via scikit-learn GraphLassoCV class.
"""
print("GraphLasso (sklearn)")
model = GraphLassoCV(cv=num_folds)
model.fit(X)
print(" lam_: {}".format(model.alpha_))
return model.covariance_, model.precision_, model.alpha_ | [
"def",
"graph_lasso",
"(",
"X",
",",
"num_folds",
")",
":",
"print",
"(",
"\"GraphLasso (sklearn)\"",
")",
"model",
"=",
"GraphLassoCV",
"(",
"cv",
"=",
"num_folds",
")",
"model",
".",
"fit",
"(",
"X",
")",
"print",
"(",
"\" lam_: {}\"",
".",
"format",
... | Estimate inverse covariance via scikit-learn GraphLassoCV class. | [
"Estimate",
"inverse",
"covariance",
"via",
"scikit",
"-",
"learn",
"GraphLassoCV",
"class",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/examples/estimator_suite.py#L295-L302 |
17,113 | skggm/skggm | inverse_covariance/quic_graph_lasso.py | _quic_path | def _quic_path(
X,
path,
X_test=None,
lam=0.5,
tol=1e-6,
max_iter=1000,
Theta0=None,
Sigma0=None,
method="quic",
verbose=0,
score_metric="log_likelihood",
init_method="corrcoef",
):
"""Wrapper to compute path for example X.
"""
S, lam_scale_ = _init_coefs(X, m... | python | def _quic_path(
X,
path,
X_test=None,
lam=0.5,
tol=1e-6,
max_iter=1000,
Theta0=None,
Sigma0=None,
method="quic",
verbose=0,
score_metric="log_likelihood",
init_method="corrcoef",
):
"""Wrapper to compute path for example X.
"""
S, lam_scale_ = _init_coefs(X, m... | [
"def",
"_quic_path",
"(",
"X",
",",
"path",
",",
"X_test",
"=",
"None",
",",
"lam",
"=",
"0.5",
",",
"tol",
"=",
"1e-6",
",",
"max_iter",
"=",
"1000",
",",
"Theta0",
"=",
"None",
",",
"Sigma0",
"=",
"None",
",",
"method",
"=",
"\"quic\"",
",",
"v... | Wrapper to compute path for example X. | [
"Wrapper",
"to",
"compute",
"path",
"for",
"example",
"X",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/quic_graph_lasso.py#L383-L435 |
17,114 | skggm/skggm | inverse_covariance/quic_graph_lasso.py | QuicGraphicalLasso.lam_at_index | def lam_at_index(self, lidx):
"""Compute the scaled lambda used at index lidx.
"""
if self.path_ is None:
return self.lam * self.lam_scale_
return self.lam * self.lam_scale_ * self.path_[lidx] | python | def lam_at_index(self, lidx):
"""Compute the scaled lambda used at index lidx.
"""
if self.path_ is None:
return self.lam * self.lam_scale_
return self.lam * self.lam_scale_ * self.path_[lidx] | [
"def",
"lam_at_index",
"(",
"self",
",",
"lidx",
")",
":",
"if",
"self",
".",
"path_",
"is",
"None",
":",
"return",
"self",
".",
"lam",
"*",
"self",
".",
"lam_scale_",
"return",
"self",
".",
"lam",
"*",
"self",
".",
"lam_scale_",
"*",
"self",
".",
... | Compute the scaled lambda used at index lidx. | [
"Compute",
"the",
"scaled",
"lambda",
"used",
"at",
"index",
"lidx",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/quic_graph_lasso.py#L361-L367 |
17,115 | skggm/skggm | inverse_covariance/rank_correlation.py | _compute_ranks | def _compute_ranks(X, winsorize=False, truncation=None, verbose=True):
"""
Transform each column into ranked data. Tied ranks are averaged.
Ranks can optionally be winsorized as described in Liu 2009 otherwise
this returns Tsukahara's scaled rank based Z-estimator.
Parameters
----------
X :... | python | def _compute_ranks(X, winsorize=False, truncation=None, verbose=True):
"""
Transform each column into ranked data. Tied ranks are averaged.
Ranks can optionally be winsorized as described in Liu 2009 otherwise
this returns Tsukahara's scaled rank based Z-estimator.
Parameters
----------
X :... | [
"def",
"_compute_ranks",
"(",
"X",
",",
"winsorize",
"=",
"False",
",",
"truncation",
"=",
"None",
",",
"verbose",
"=",
"True",
")",
":",
"n_samples",
",",
"n_features",
"=",
"X",
".",
"shape",
"Xrank",
"=",
"np",
".",
"zeros",
"(",
"shape",
"=",
"X"... | Transform each column into ranked data. Tied ranks are averaged.
Ranks can optionally be winsorized as described in Liu 2009 otherwise
this returns Tsukahara's scaled rank based Z-estimator.
Parameters
----------
X : array-like, shape = (n_samples, n_features)
The data matrix where each col... | [
"Transform",
"each",
"column",
"into",
"ranked",
"data",
".",
"Tied",
"ranks",
"are",
"averaged",
".",
"Ranks",
"can",
"optionally",
"be",
"winsorized",
"as",
"described",
"in",
"Liu",
"2009",
"otherwise",
"this",
"returns",
"Tsukahara",
"s",
"scaled",
"rank",... | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/rank_correlation.py#L9-L66 |
17,116 | skggm/skggm | inverse_covariance/rank_correlation.py | spearman_correlation | def spearman_correlation(X, rowvar=False):
"""
Computes the spearman correlation estimate.
This is effectively a bias corrected pearson correlation
between rank transformed columns of X.
Parameters
----------
X: array-like, shape = [n_samples, n_features]
Data matrix using which we ... | python | def spearman_correlation(X, rowvar=False):
"""
Computes the spearman correlation estimate.
This is effectively a bias corrected pearson correlation
between rank transformed columns of X.
Parameters
----------
X: array-like, shape = [n_samples, n_features]
Data matrix using which we ... | [
"def",
"spearman_correlation",
"(",
"X",
",",
"rowvar",
"=",
"False",
")",
":",
"Xrank",
"=",
"_compute_ranks",
"(",
"X",
")",
"rank_correlation",
"=",
"np",
".",
"corrcoef",
"(",
"Xrank",
",",
"rowvar",
"=",
"rowvar",
")",
"return",
"2",
"*",
"np",
".... | Computes the spearman correlation estimate.
This is effectively a bias corrected pearson correlation
between rank transformed columns of X.
Parameters
----------
X: array-like, shape = [n_samples, n_features]
Data matrix using which we compute the empirical
correlation
Returns
... | [
"Computes",
"the",
"spearman",
"correlation",
"estimate",
".",
"This",
"is",
"effectively",
"a",
"bias",
"corrected",
"pearson",
"correlation",
"between",
"rank",
"transformed",
"columns",
"of",
"X",
"."
] | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/rank_correlation.py#L69-L101 |
17,117 | skggm/skggm | inverse_covariance/rank_correlation.py | kendalltau_correlation | def kendalltau_correlation(X, rowvar=False, weighted=False):
"""
Computes kendall's tau correlation estimate.
The option to use scipy.stats.weightedtau is not recommended
as the implementation does not appear to handle ties correctly.
Parameters
----------
X: array-like, shape = [n_samples,... | python | def kendalltau_correlation(X, rowvar=False, weighted=False):
"""
Computes kendall's tau correlation estimate.
The option to use scipy.stats.weightedtau is not recommended
as the implementation does not appear to handle ties correctly.
Parameters
----------
X: array-like, shape = [n_samples,... | [
"def",
"kendalltau_correlation",
"(",
"X",
",",
"rowvar",
"=",
"False",
",",
"weighted",
"=",
"False",
")",
":",
"if",
"rowvar",
":",
"X",
"=",
"X",
".",
"T",
"_",
",",
"n_features",
"=",
"X",
".",
"shape",
"rank_correlation",
"=",
"np",
".",
"eye",
... | Computes kendall's tau correlation estimate.
The option to use scipy.stats.weightedtau is not recommended
as the implementation does not appear to handle ties correctly.
Parameters
----------
X: array-like, shape = [n_samples, n_features]
Data matrix using which we compute the empirical
... | [
"Computes",
"kendall",
"s",
"tau",
"correlation",
"estimate",
".",
"The",
"option",
"to",
"use",
"scipy",
".",
"stats",
".",
"weightedtau",
"is",
"not",
"recommended",
"as",
"the",
"implementation",
"does",
"not",
"appear",
"to",
"handle",
"ties",
"correctly",... | a0ed406586c4364ea3297a658f415e13b5cbdaf8 | https://github.com/skggm/skggm/blob/a0ed406586c4364ea3297a658f415e13b5cbdaf8/inverse_covariance/rank_correlation.py#L104-L148 |
17,118 | fabiobatalha/crossrefapi | crossref/restful.py | Endpoint.version | def version(self):
"""
This attribute retrieve the API version.
>>> Works().version
'1.0.0'
"""
request_params = dict(self.request_params)
request_url = str(self.request_url)
result = self.do_http_request(
'get',
reque... | python | def version(self):
"""
This attribute retrieve the API version.
>>> Works().version
'1.0.0'
"""
request_params = dict(self.request_params)
request_url = str(self.request_url)
result = self.do_http_request(
'get',
reque... | [
"def",
"version",
"(",
"self",
")",
":",
"request_params",
"=",
"dict",
"(",
"self",
".",
"request_params",
")",
"request_url",
"=",
"str",
"(",
"self",
".",
"request_url",
")",
"result",
"=",
"self",
".",
"do_http_request",
"(",
"'get'",
",",
"request_url... | This attribute retrieve the API version.
>>> Works().version
'1.0.0' | [
"This",
"attribute",
"retrieve",
"the",
"API",
"version",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L157-L174 |
17,119 | fabiobatalha/crossrefapi | crossref/restful.py | Endpoint.count | def count(self):
"""
This method retrieve the total of records resulting from a given query.
This attribute can be used compounded with query, filter,
sort, order and facet methods.
Examples:
>>> from crossref.restful import Works
>>> Works().query('zika... | python | def count(self):
"""
This method retrieve the total of records resulting from a given query.
This attribute can be used compounded with query, filter,
sort, order and facet methods.
Examples:
>>> from crossref.restful import Works
>>> Works().query('zika... | [
"def",
"count",
"(",
"self",
")",
":",
"request_params",
"=",
"dict",
"(",
"self",
".",
"request_params",
")",
"request_url",
"=",
"str",
"(",
"self",
".",
"request_url",
")",
"request_params",
"[",
"'rows'",
"]",
"=",
"0",
"result",
"=",
"self",
".",
... | This method retrieve the total of records resulting from a given query.
This attribute can be used compounded with query, filter,
sort, order and facet methods.
Examples:
>>> from crossref.restful import Works
>>> Works().query('zika').count()
3597
... | [
"This",
"method",
"retrieve",
"the",
"total",
"of",
"records",
"resulting",
"from",
"a",
"given",
"query",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L186-L215 |
17,120 | fabiobatalha/crossrefapi | crossref/restful.py | Endpoint.url | def url(self):
"""
This attribute retrieve the url that will be used as a HTTP request to
the Crossref API.
This attribute can be used compounded with query, filter,
sort, order and facet methods.
Examples:
>>> from crossref.restful import Works
... | python | def url(self):
"""
This attribute retrieve the url that will be used as a HTTP request to
the Crossref API.
This attribute can be used compounded with query, filter,
sort, order and facet methods.
Examples:
>>> from crossref.restful import Works
... | [
"def",
"url",
"(",
"self",
")",
":",
"request_params",
"=",
"self",
".",
"_escaped_pagging",
"(",
")",
"sorted_request_params",
"=",
"sorted",
"(",
"[",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"request_params",
".",
"items",
"(",
")",
"]... | This attribute retrieve the url that will be used as a HTTP request to
the Crossref API.
This attribute can be used compounded with query, filter,
sort, order and facet methods.
Examples:
>>> from crossref.restful import Works
>>> Works().query('zika').url
... | [
"This",
"attribute",
"retrieve",
"the",
"url",
"that",
"will",
"be",
"used",
"as",
"a",
"HTTP",
"request",
"to",
"the",
"Crossref",
"API",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L218-L243 |
17,121 | fabiobatalha/crossrefapi | crossref/restful.py | Works.doi | def doi(self, doi, only_message=True):
"""
This method retrieve the DOI metadata related to a given DOI
number.
args: Crossref DOI id (String)
return: JSON
Example:
>>> from crossref.restful import Works
>>> works = Works()
>>> works... | python | def doi(self, doi, only_message=True):
"""
This method retrieve the DOI metadata related to a given DOI
number.
args: Crossref DOI id (String)
return: JSON
Example:
>>> from crossref.restful import Works
>>> works = Works()
>>> works... | [
"def",
"doi",
"(",
"self",
",",
"doi",
",",
"only_message",
"=",
"True",
")",
":",
"request_url",
"=",
"build_url_endpoint",
"(",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"ENDPOINT",
",",
"doi",
"]",
")",
")",
"request_params",
"=",
"{",
"}",
"resu... | This method retrieve the DOI metadata related to a given DOI
number.
args: Crossref DOI id (String)
return: JSON
Example:
>>> from crossref.restful import Works
>>> works = Works()
>>> works.doi('10.1590/S0004-28032013005000001')
{'is-re... | [
"This",
"method",
"retrieve",
"the",
"DOI",
"metadata",
"related",
"to",
"a",
"given",
"DOI",
"number",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L901-L959 |
17,122 | fabiobatalha/crossrefapi | crossref/restful.py | Works.doi_exists | def doi_exists(self, doi):
"""
This method retrieve a boolean according to the existence of a crossref
DOI number. It returns False if the API results a 404 status code.
args: Crossref DOI id (String)
return: Boolean
Example 1:
>>> from crossref.restful imp... | python | def doi_exists(self, doi):
"""
This method retrieve a boolean according to the existence of a crossref
DOI number. It returns False if the API results a 404 status code.
args: Crossref DOI id (String)
return: Boolean
Example 1:
>>> from crossref.restful imp... | [
"def",
"doi_exists",
"(",
"self",
",",
"doi",
")",
":",
"request_url",
"=",
"build_url_endpoint",
"(",
"'/'",
".",
"join",
"(",
"[",
"self",
".",
"ENDPOINT",
",",
"doi",
"]",
")",
")",
"request_params",
"=",
"{",
"}",
"result",
"=",
"self",
".",
"do_... | This method retrieve a boolean according to the existence of a crossref
DOI number. It returns False if the API results a 404 status code.
args: Crossref DOI id (String)
return: Boolean
Example 1:
>>> from crossref.restful import Works
>>> works = Works()
... | [
"This",
"method",
"retrieve",
"a",
"boolean",
"according",
"to",
"the",
"existence",
"of",
"a",
"crossref",
"DOI",
"number",
".",
"It",
"returns",
"False",
"if",
"the",
"API",
"results",
"a",
"404",
"status",
"code",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L995-L1032 |
17,123 | fabiobatalha/crossrefapi | crossref/restful.py | Funders.works | def works(self, funder_id):
"""
This method retrieve a iterable of Works of the given funder.
args: Crossref allowed document Types (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(funder_id))
return Works(context=context) | python | def works(self, funder_id):
"""
This method retrieve a iterable of Works of the given funder.
args: Crossref allowed document Types (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(funder_id))
return Works(context=context) | [
"def",
"works",
"(",
"self",
",",
"funder_id",
")",
":",
"context",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"ENDPOINT",
",",
"str",
"(",
"funder_id",
")",
")",
"return",
"Works",
"(",
"context",
"=",
"context",
")"
] | This method retrieve a iterable of Works of the given funder.
args: Crossref allowed document Types (String)
return: Works() | [
"This",
"method",
"retrieve",
"a",
"iterable",
"of",
"Works",
"of",
"the",
"given",
"funder",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1199-L1208 |
17,124 | fabiobatalha/crossrefapi | crossref/restful.py | Members.works | def works(self, member_id):
"""
This method retrieve a iterable of Works of the given member.
args: Member ID (Integer)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(member_id))
return Works(context=context) | python | def works(self, member_id):
"""
This method retrieve a iterable of Works of the given member.
args: Member ID (Integer)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(member_id))
return Works(context=context) | [
"def",
"works",
"(",
"self",
",",
"member_id",
")",
":",
"context",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"ENDPOINT",
",",
"str",
"(",
"member_id",
")",
")",
"return",
"Works",
"(",
"context",
"=",
"context",
")"
] | This method retrieve a iterable of Works of the given member.
args: Member ID (Integer)
return: Works() | [
"This",
"method",
"retrieve",
"a",
"iterable",
"of",
"Works",
"of",
"the",
"given",
"member",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1418-L1427 |
17,125 | fabiobatalha/crossrefapi | crossref/restful.py | Types.all | def all(self):
"""
This method retrieve an iterator with all the available types.
return: iterator of crossref document types
Example:
>>> from crossref.restful import Types
>>> types = Types()
>>> [i for i in types.all()]
[{'label': 'Boo... | python | def all(self):
"""
This method retrieve an iterator with all the available types.
return: iterator of crossref document types
Example:
>>> from crossref.restful import Types
>>> types = Types()
>>> [i for i in types.all()]
[{'label': 'Boo... | [
"def",
"all",
"(",
"self",
")",
":",
"request_url",
"=",
"build_url_endpoint",
"(",
"self",
".",
"ENDPOINT",
",",
"self",
".",
"context",
")",
"request_params",
"=",
"dict",
"(",
"self",
".",
"request_params",
")",
"result",
"=",
"self",
".",
"do_http_requ... | This method retrieve an iterator with all the available types.
return: iterator of crossref document types
Example:
>>> from crossref.restful import Types
>>> types = Types()
>>> [i for i in types.all()]
[{'label': 'Book Section', 'id': 'book-section'},
... | [
"This",
"method",
"retrieve",
"an",
"iterator",
"with",
"all",
"the",
"available",
"types",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1466-L1501 |
17,126 | fabiobatalha/crossrefapi | crossref/restful.py | Types.works | def works(self, type_id):
"""
This method retrieve a iterable of Works of the given type.
args: Crossref allowed document Types (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(type_id))
return Works(context=context) | python | def works(self, type_id):
"""
This method retrieve a iterable of Works of the given type.
args: Crossref allowed document Types (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(type_id))
return Works(context=context) | [
"def",
"works",
"(",
"self",
",",
"type_id",
")",
":",
"context",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"ENDPOINT",
",",
"str",
"(",
"type_id",
")",
")",
"return",
"Works",
"(",
"context",
"=",
"context",
")"
] | This method retrieve a iterable of Works of the given type.
args: Crossref allowed document Types (String)
return: Works() | [
"This",
"method",
"retrieve",
"a",
"iterable",
"of",
"Works",
"of",
"the",
"given",
"type",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1542-L1551 |
17,127 | fabiobatalha/crossrefapi | crossref/restful.py | Prefixes.works | def works(self, prefix_id):
"""
This method retrieve a iterable of Works of the given prefix.
args: Crossref Prefix (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(prefix_id))
return Works(context=context) | python | def works(self, prefix_id):
"""
This method retrieve a iterable of Works of the given prefix.
args: Crossref Prefix (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(prefix_id))
return Works(context=context) | [
"def",
"works",
"(",
"self",
",",
"prefix_id",
")",
":",
"context",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"ENDPOINT",
",",
"str",
"(",
"prefix_id",
")",
")",
"return",
"Works",
"(",
"context",
"=",
"context",
")"
] | This method retrieve a iterable of Works of the given prefix.
args: Crossref Prefix (String)
return: Works() | [
"This",
"method",
"retrieve",
"a",
"iterable",
"of",
"Works",
"of",
"the",
"given",
"prefix",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1594-L1603 |
17,128 | fabiobatalha/crossrefapi | crossref/restful.py | Journals.works | def works(self, issn):
"""
This method retrieve a iterable of Works of the given journal.
args: Journal ISSN (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(issn))
return Works(context=context) | python | def works(self, issn):
"""
This method retrieve a iterable of Works of the given journal.
args: Journal ISSN (String)
return: Works()
"""
context = '%s/%s' % (self.ENDPOINT, str(issn))
return Works(context=context) | [
"def",
"works",
"(",
"self",
",",
"issn",
")",
":",
"context",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"ENDPOINT",
",",
"str",
"(",
"issn",
")",
")",
"return",
"Works",
"(",
"context",
"=",
"context",
")"
] | This method retrieve a iterable of Works of the given journal.
args: Journal ISSN (String)
return: Works() | [
"This",
"method",
"retrieve",
"a",
"iterable",
"of",
"Works",
"of",
"the",
"given",
"journal",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1718-L1728 |
17,129 | fabiobatalha/crossrefapi | crossref/restful.py | Depositor.register_doi | def register_doi(self, submission_id, request_xml):
"""
This method registry a new DOI number in Crossref or update some DOI
metadata.
submission_id: Will be used as the submission file name. The file name
could be used in future requests to retrieve the submission status.
... | python | def register_doi(self, submission_id, request_xml):
"""
This method registry a new DOI number in Crossref or update some DOI
metadata.
submission_id: Will be used as the submission file name. The file name
could be used in future requests to retrieve the submission status.
... | [
"def",
"register_doi",
"(",
"self",
",",
"submission_id",
",",
"request_xml",
")",
":",
"endpoint",
"=",
"self",
".",
"get_endpoint",
"(",
"'deposit'",
")",
"files",
"=",
"{",
"'mdFile'",
":",
"(",
"'%s.xml'",
"%",
"submission_id",
",",
"request_xml",
")",
... | This method registry a new DOI number in Crossref or update some DOI
metadata.
submission_id: Will be used as the submission file name. The file name
could be used in future requests to retrieve the submission status.
request_xml: The XML with the document metadata. It must be under
... | [
"This",
"method",
"registry",
"a",
"new",
"DOI",
"number",
"in",
"Crossref",
"or",
"update",
"some",
"DOI",
"metadata",
"."
] | 53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7 | https://github.com/fabiobatalha/crossrefapi/blob/53f84ee0d8a8fc6ad9b2493f51c5151e66d2faf7/crossref/restful.py#L1746-L1779 |
17,130 | buildinspace/peru | peru/plugin.py | _find_plugin_dir | def _find_plugin_dir(module_type):
'''Find the directory containing the plugin definition for the given type.
Do this by searching all the paths where plugins can live for a dir that
matches the type name.'''
for install_dir in _get_plugin_install_dirs():
candidate = os.path.join(install_dir, m... | python | def _find_plugin_dir(module_type):
'''Find the directory containing the plugin definition for the given type.
Do this by searching all the paths where plugins can live for a dir that
matches the type name.'''
for install_dir in _get_plugin_install_dirs():
candidate = os.path.join(install_dir, m... | [
"def",
"_find_plugin_dir",
"(",
"module_type",
")",
":",
"for",
"install_dir",
"in",
"_get_plugin_install_dirs",
"(",
")",
":",
"candidate",
"=",
"os",
".",
"path",
".",
"join",
"(",
"install_dir",
",",
"module_type",
")",
"if",
"os",
".",
"path",
".",
"is... | Find the directory containing the plugin definition for the given type.
Do this by searching all the paths where plugins can live for a dir that
matches the type name. | [
"Find",
"the",
"directory",
"containing",
"the",
"plugin",
"definition",
"for",
"the",
"given",
"type",
".",
"Do",
"this",
"by",
"searching",
"all",
"the",
"paths",
"where",
"plugins",
"can",
"live",
"for",
"a",
"dir",
"that",
"matches",
"the",
"type",
"na... | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/plugin.py#L264-L276 |
17,131 | buildinspace/peru | peru/main.py | merged_args_dicts | def merged_args_dicts(global_args, subcommand_args):
'''We deal with docopt args from the toplevel peru parse and the subcommand
parse. We don't want False values for a flag in the subcommand to override
True values if that flag was given at the top level. This function
specifically handles that case.''... | python | def merged_args_dicts(global_args, subcommand_args):
'''We deal with docopt args from the toplevel peru parse and the subcommand
parse. We don't want False values for a flag in the subcommand to override
True values if that flag was given at the top level. This function
specifically handles that case.''... | [
"def",
"merged_args_dicts",
"(",
"global_args",
",",
"subcommand_args",
")",
":",
"merged",
"=",
"global_args",
".",
"copy",
"(",
")",
"for",
"key",
",",
"val",
"in",
"subcommand_args",
".",
"items",
"(",
")",
":",
"if",
"key",
"not",
"in",
"merged",
":"... | We deal with docopt args from the toplevel peru parse and the subcommand
parse. We don't want False values for a flag in the subcommand to override
True values if that flag was given at the top level. This function
specifically handles that case. | [
"We",
"deal",
"with",
"docopt",
"args",
"from",
"the",
"toplevel",
"peru",
"parse",
"and",
"the",
"subcommand",
"parse",
".",
"We",
"don",
"t",
"want",
"False",
"values",
"for",
"a",
"flag",
"in",
"the",
"subcommand",
"to",
"override",
"True",
"values",
... | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/main.py#L299-L312 |
17,132 | buildinspace/peru | peru/main.py | force_utf8_in_ascii_mode_hack | def force_utf8_in_ascii_mode_hack():
'''In systems without a UTF8 locale configured, Python will default to
ASCII mode for stdout and stderr. This causes our fancy display to fail
with encoding errors. In particular, you run into this if you try to run
peru inside of Docker. This is a hack to force emit... | python | def force_utf8_in_ascii_mode_hack():
'''In systems without a UTF8 locale configured, Python will default to
ASCII mode for stdout and stderr. This causes our fancy display to fail
with encoding errors. In particular, you run into this if you try to run
peru inside of Docker. This is a hack to force emit... | [
"def",
"force_utf8_in_ascii_mode_hack",
"(",
")",
":",
"if",
"sys",
".",
"stdout",
".",
"encoding",
"==",
"'ANSI_X3.4-1968'",
":",
"sys",
".",
"stdout",
"=",
"open",
"(",
"sys",
".",
"stdout",
".",
"fileno",
"(",
")",
",",
"mode",
"=",
"'w'",
",",
"enc... | In systems without a UTF8 locale configured, Python will default to
ASCII mode for stdout and stderr. This causes our fancy display to fail
with encoding errors. In particular, you run into this if you try to run
peru inside of Docker. This is a hack to force emitting UTF8 in that case.
Hopefully it doe... | [
"In",
"systems",
"without",
"a",
"UTF8",
"locale",
"configured",
"Python",
"will",
"default",
"to",
"ASCII",
"mode",
"for",
"stdout",
"and",
"stderr",
".",
"This",
"causes",
"our",
"fancy",
"display",
"to",
"fail",
"with",
"encoding",
"errors",
".",
"In",
... | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/main.py#L334-L344 |
17,133 | buildinspace/peru | peru/scope.py | Scope.parse_target | async def parse_target(self, runtime, target_str):
'''A target is a pipeline of a module into zero or more rules, and each
module and rule can itself be scoped with zero or more module names.'''
pipeline_parts = target_str.split(RULE_SEPARATOR)
module = await self.resolve_module(runtime,... | python | async def parse_target(self, runtime, target_str):
'''A target is a pipeline of a module into zero or more rules, and each
module and rule can itself be scoped with zero or more module names.'''
pipeline_parts = target_str.split(RULE_SEPARATOR)
module = await self.resolve_module(runtime,... | [
"async",
"def",
"parse_target",
"(",
"self",
",",
"runtime",
",",
"target_str",
")",
":",
"pipeline_parts",
"=",
"target_str",
".",
"split",
"(",
"RULE_SEPARATOR",
")",
"module",
"=",
"await",
"self",
".",
"resolve_module",
"(",
"runtime",
",",
"pipeline_parts... | A target is a pipeline of a module into zero or more rules, and each
module and rule can itself be scoped with zero or more module names. | [
"A",
"target",
"is",
"a",
"pipeline",
"of",
"a",
"module",
"into",
"zero",
"or",
"more",
"rules",
"and",
"each",
"module",
"and",
"rule",
"can",
"itself",
"be",
"scoped",
"with",
"zero",
"or",
"more",
"module",
"names",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/scope.py#L17-L27 |
17,134 | buildinspace/peru | peru/edit_yaml.py | _maybe_quote | def _maybe_quote(val):
'''All of our values should be strings. Usually those can be passed in as
bare words, but if they're parseable as an int or float we need to quote
them.'''
assert isinstance(val, str), 'We should never set non-string values.'
needs_quoting = False
try:
int(val)
... | python | def _maybe_quote(val):
'''All of our values should be strings. Usually those can be passed in as
bare words, but if they're parseable as an int or float we need to quote
them.'''
assert isinstance(val, str), 'We should never set non-string values.'
needs_quoting = False
try:
int(val)
... | [
"def",
"_maybe_quote",
"(",
"val",
")",
":",
"assert",
"isinstance",
"(",
"val",
",",
"str",
")",
",",
"'We should never set non-string values.'",
"needs_quoting",
"=",
"False",
"try",
":",
"int",
"(",
"val",
")",
"needs_quoting",
"=",
"True",
"except",
"Excep... | All of our values should be strings. Usually those can be passed in as
bare words, but if they're parseable as an int or float we need to quote
them. | [
"All",
"of",
"our",
"values",
"should",
"be",
"strings",
".",
"Usually",
"those",
"can",
"be",
"passed",
"in",
"as",
"bare",
"words",
"but",
"if",
"they",
"re",
"parseable",
"as",
"an",
"int",
"or",
"float",
"we",
"need",
"to",
"quote",
"them",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/edit_yaml.py#L26-L45 |
17,135 | buildinspace/peru | peru/async_helpers.py | gather_coalescing_exceptions | async def gather_coalescing_exceptions(coros, display, *, verbose):
'''The tricky thing about running multiple coroutines in parallel is what
we're supposed to do when one of them raises an exception. The approach
we're using here is to catch exceptions and keep waiting for other tasks to
finish. At the... | python | async def gather_coalescing_exceptions(coros, display, *, verbose):
'''The tricky thing about running multiple coroutines in parallel is what
we're supposed to do when one of them raises an exception. The approach
we're using here is to catch exceptions and keep waiting for other tasks to
finish. At the... | [
"async",
"def",
"gather_coalescing_exceptions",
"(",
"coros",
",",
"display",
",",
"*",
",",
"verbose",
")",
":",
"exceptions",
"=",
"[",
"]",
"reprs",
"=",
"[",
"]",
"async",
"def",
"catching_wrapper",
"(",
"coro",
")",
":",
"try",
":",
"return",
"(",
... | The tricky thing about running multiple coroutines in parallel is what
we're supposed to do when one of them raises an exception. The approach
we're using here is to catch exceptions and keep waiting for other tasks to
finish. At the end, we reraise a GatheredExceptions error, if any
exceptions were cau... | [
"The",
"tricky",
"thing",
"about",
"running",
"multiple",
"coroutines",
"in",
"parallel",
"is",
"what",
"we",
"re",
"supposed",
"to",
"do",
"when",
"one",
"of",
"them",
"raises",
"an",
"exception",
".",
"The",
"approach",
"we",
"re",
"using",
"here",
"is",... | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/async_helpers.py#L53-L94 |
17,136 | buildinspace/peru | peru/async_helpers.py | create_subprocess_with_handle | async def create_subprocess_with_handle(command,
display_handle,
*,
shell=False,
cwd,
**kwargs):
'''Writes subproces... | python | async def create_subprocess_with_handle(command,
display_handle,
*,
shell=False,
cwd,
**kwargs):
'''Writes subproces... | [
"async",
"def",
"create_subprocess_with_handle",
"(",
"command",
",",
"display_handle",
",",
"*",
",",
"shell",
"=",
"False",
",",
"cwd",
",",
"*",
"*",
"kwargs",
")",
":",
"# We're going to get chunks of bytes from the subprocess, and it's possible",
"# that one of those... | Writes subprocess output to a display handle as it comes in, and also
returns a copy of it as a string. Throws if the subprocess returns an
error. Note that cwd is a required keyword-only argument, on theory that
peru should never start child processes "wherever I happen to be running
right now." | [
"Writes",
"subprocess",
"output",
"to",
"a",
"display",
"handle",
"as",
"it",
"comes",
"in",
"and",
"also",
"returns",
"a",
"copy",
"of",
"it",
"as",
"a",
"string",
".",
"Throws",
"if",
"the",
"subprocess",
"returns",
"an",
"error",
".",
"Note",
"that",
... | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/async_helpers.py#L97-L164 |
17,137 | buildinspace/peru | peru/async_helpers.py | raises_gathered | def raises_gathered(error_type):
'''For use in tests. Many tests expect a single error to be thrown, and
want it to be of a specific type. This is a helper method for when that
type is inside a gathered exception.'''
container = RaisesGatheredContainer()
try:
yield container
except Gathe... | python | def raises_gathered(error_type):
'''For use in tests. Many tests expect a single error to be thrown, and
want it to be of a specific type. This is a helper method for when that
type is inside a gathered exception.'''
container = RaisesGatheredContainer()
try:
yield container
except Gathe... | [
"def",
"raises_gathered",
"(",
"error_type",
")",
":",
"container",
"=",
"RaisesGatheredContainer",
"(",
")",
"try",
":",
"yield",
"container",
"except",
"GatheredExceptions",
"as",
"e",
":",
"# Make sure there is exactly one exception.",
"if",
"len",
"(",
"e",
".",... | For use in tests. Many tests expect a single error to be thrown, and
want it to be of a specific type. This is a helper method for when that
type is inside a gathered exception. | [
"For",
"use",
"in",
"tests",
".",
"Many",
"tests",
"expect",
"a",
"single",
"error",
"to",
"be",
"thrown",
"and",
"want",
"it",
"to",
"be",
"of",
"a",
"specific",
"type",
".",
"This",
"is",
"a",
"helper",
"method",
"for",
"when",
"that",
"type",
"is"... | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/async_helpers.py#L201-L217 |
17,138 | buildinspace/peru | peru/resources/plugins/curl/curl_plugin.py | get_request_filename | def get_request_filename(request):
'''Figure out the filename for an HTTP download.'''
# Check to see if a filename is specified in the HTTP headers.
if 'Content-Disposition' in request.info():
disposition = request.info()['Content-Disposition']
pieces = re.split(r'\s*;\s*', disposition)
... | python | def get_request_filename(request):
'''Figure out the filename for an HTTP download.'''
# Check to see if a filename is specified in the HTTP headers.
if 'Content-Disposition' in request.info():
disposition = request.info()['Content-Disposition']
pieces = re.split(r'\s*;\s*', disposition)
... | [
"def",
"get_request_filename",
"(",
"request",
")",
":",
"# Check to see if a filename is specified in the HTTP headers.",
"if",
"'Content-Disposition'",
"in",
"request",
".",
"info",
"(",
")",
":",
"disposition",
"=",
"request",
".",
"info",
"(",
")",
"[",
"'Content-... | Figure out the filename for an HTTP download. | [
"Figure",
"out",
"the",
"filename",
"for",
"an",
"HTTP",
"download",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/resources/plugins/curl/curl_plugin.py#L16-L34 |
17,139 | buildinspace/peru | peru/parser.py | _extract_optional_list_field | def _extract_optional_list_field(blob, name):
'''Handle optional fields that can be either a string or a list of
strings.'''
value = _optional_list(typesafe_pop(blob, name, []))
if value is None:
raise ParserError(
'"{}" field must be a string or a list.'.format(name))
return val... | python | def _extract_optional_list_field(blob, name):
'''Handle optional fields that can be either a string or a list of
strings.'''
value = _optional_list(typesafe_pop(blob, name, []))
if value is None:
raise ParserError(
'"{}" field must be a string or a list.'.format(name))
return val... | [
"def",
"_extract_optional_list_field",
"(",
"blob",
",",
"name",
")",
":",
"value",
"=",
"_optional_list",
"(",
"typesafe_pop",
"(",
"blob",
",",
"name",
",",
"[",
"]",
")",
")",
"if",
"value",
"is",
"None",
":",
"raise",
"ParserError",
"(",
"'\"{}\" field... | Handle optional fields that can be either a string or a list of
strings. | [
"Handle",
"optional",
"fields",
"that",
"can",
"be",
"either",
"a",
"string",
"or",
"a",
"list",
"of",
"strings",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/parser.py#L135-L142 |
17,140 | buildinspace/peru | peru/async_exit_stack.py | AsyncExitStack.pop_all | def pop_all(self):
"""Preserve the context stack by transferring it to a new instance."""
new_stack = type(self)()
new_stack._exit_callbacks = self._exit_callbacks
self._exit_callbacks = deque()
return new_stack | python | def pop_all(self):
"""Preserve the context stack by transferring it to a new instance."""
new_stack = type(self)()
new_stack._exit_callbacks = self._exit_callbacks
self._exit_callbacks = deque()
return new_stack | [
"def",
"pop_all",
"(",
"self",
")",
":",
"new_stack",
"=",
"type",
"(",
"self",
")",
"(",
")",
"new_stack",
".",
"_exit_callbacks",
"=",
"self",
".",
"_exit_callbacks",
"self",
".",
"_exit_callbacks",
"=",
"deque",
"(",
")",
"return",
"new_stack"
] | Preserve the context stack by transferring it to a new instance. | [
"Preserve",
"the",
"context",
"stack",
"by",
"transferring",
"it",
"to",
"a",
"new",
"instance",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/async_exit_stack.py#L55-L60 |
17,141 | buildinspace/peru | peru/async_exit_stack.py | AsyncExitStack.callback | def callback(self, callback, *args, **kwds):
"""Registers an arbitrary callback and arguments.
Cannot suppress exceptions.
"""
_exit_wrapper = self._create_cb_wrapper(callback, *args, **kwds)
# We changed the signature, so using @wraps is not appropriate, but
# setting _... | python | def callback(self, callback, *args, **kwds):
"""Registers an arbitrary callback and arguments.
Cannot suppress exceptions.
"""
_exit_wrapper = self._create_cb_wrapper(callback, *args, **kwds)
# We changed the signature, so using @wraps is not appropriate, but
# setting _... | [
"def",
"callback",
"(",
"self",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"_exit_wrapper",
"=",
"self",
".",
"_create_cb_wrapper",
"(",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
"# We changed the signature, so usin... | Registers an arbitrary callback and arguments.
Cannot suppress exceptions. | [
"Registers",
"an",
"arbitrary",
"callback",
"and",
"arguments",
".",
"Cannot",
"suppress",
"exceptions",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/async_exit_stack.py#L94-L104 |
17,142 | buildinspace/peru | peru/async_exit_stack.py | AsyncExitStack.push_async_callback | def push_async_callback(self, callback, *args, **kwds):
"""Registers an arbitrary coroutine function and arguments.
Cannot suppress exceptions.
"""
_exit_wrapper = self._create_async_cb_wrapper(callback, *args, **kwds)
# We changed the signature, so using @wraps is not appropria... | python | def push_async_callback(self, callback, *args, **kwds):
"""Registers an arbitrary coroutine function and arguments.
Cannot suppress exceptions.
"""
_exit_wrapper = self._create_async_cb_wrapper(callback, *args, **kwds)
# We changed the signature, so using @wraps is not appropria... | [
"def",
"push_async_callback",
"(",
"self",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"_exit_wrapper",
"=",
"self",
".",
"_create_async_cb_wrapper",
"(",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
"# We changed the s... | Registers an arbitrary coroutine function and arguments.
Cannot suppress exceptions. | [
"Registers",
"an",
"arbitrary",
"coroutine",
"function",
"and",
"arguments",
".",
"Cannot",
"suppress",
"exceptions",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/async_exit_stack.py#L144-L154 |
17,143 | buildinspace/peru | peru/runtime.py | Runtime | async def Runtime(args, env):
'This is the async constructor for the _Runtime class.'
r = _Runtime(args, env)
await r._init_cache()
return r | python | async def Runtime(args, env):
'This is the async constructor for the _Runtime class.'
r = _Runtime(args, env)
await r._init_cache()
return r | [
"async",
"def",
"Runtime",
"(",
"args",
",",
"env",
")",
":",
"r",
"=",
"_Runtime",
"(",
"args",
",",
"env",
")",
"await",
"r",
".",
"_init_cache",
"(",
")",
"return",
"r"
] | This is the async constructor for the _Runtime class. | [
"This",
"is",
"the",
"async",
"constructor",
"for",
"the",
"_Runtime",
"class",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/runtime.py#L16-L20 |
17,144 | buildinspace/peru | peru/runtime.py | find_project_file | def find_project_file(start_dir, basename):
'''Walk up the directory tree until we find a file of the given name.'''
prefix = os.path.abspath(start_dir)
while True:
candidate = os.path.join(prefix, basename)
if os.path.isfile(candidate):
return candidate
if os.path.exists... | python | def find_project_file(start_dir, basename):
'''Walk up the directory tree until we find a file of the given name.'''
prefix = os.path.abspath(start_dir)
while True:
candidate = os.path.join(prefix, basename)
if os.path.isfile(candidate):
return candidate
if os.path.exists... | [
"def",
"find_project_file",
"(",
"start_dir",
",",
"basename",
")",
":",
"prefix",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"start_dir",
")",
"while",
"True",
":",
"candidate",
"=",
"os",
".",
"path",
".",
"join",
"(",
"prefix",
",",
"basename",
")... | Walk up the directory tree until we find a file of the given name. | [
"Walk",
"up",
"the",
"directory",
"tree",
"until",
"we",
"find",
"a",
"file",
"of",
"the",
"given",
"name",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/runtime.py#L150-L164 |
17,145 | buildinspace/peru | peru/cache.py | delete_if_error | def delete_if_error(path):
'''If any exception is raised inside the context, delete the file at the
given path, and allow the exception to continue.'''
try:
yield
except Exception:
if os.path.exists(path):
os.remove(path)
raise | python | def delete_if_error(path):
'''If any exception is raised inside the context, delete the file at the
given path, and allow the exception to continue.'''
try:
yield
except Exception:
if os.path.exists(path):
os.remove(path)
raise | [
"def",
"delete_if_error",
"(",
"path",
")",
":",
"try",
":",
"yield",
"except",
"Exception",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"os",
".",
"remove",
"(",
"path",
")",
"raise"
] | If any exception is raised inside the context, delete the file at the
given path, and allow the exception to continue. | [
"If",
"any",
"exception",
"is",
"raised",
"inside",
"the",
"context",
"delete",
"the",
"file",
"at",
"the",
"given",
"path",
"and",
"allow",
"the",
"exception",
"to",
"continue",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/cache.py#L516-L524 |
17,146 | buildinspace/peru | peru/cache.py | _format_file_lines | def _format_file_lines(files):
'''Given a list of filenames that we're about to print, limit it to a
reasonable number of lines.'''
LINES_TO_SHOW = 10
if len(files) <= LINES_TO_SHOW:
lines = '\n'.join(files)
else:
lines = ('\n'.join(files[:LINES_TO_SHOW - 1]) + '\n...{} total'.format... | python | def _format_file_lines(files):
'''Given a list of filenames that we're about to print, limit it to a
reasonable number of lines.'''
LINES_TO_SHOW = 10
if len(files) <= LINES_TO_SHOW:
lines = '\n'.join(files)
else:
lines = ('\n'.join(files[:LINES_TO_SHOW - 1]) + '\n...{} total'.format... | [
"def",
"_format_file_lines",
"(",
"files",
")",
":",
"LINES_TO_SHOW",
"=",
"10",
"if",
"len",
"(",
"files",
")",
"<=",
"LINES_TO_SHOW",
":",
"lines",
"=",
"'\\n'",
".",
"join",
"(",
"files",
")",
"else",
":",
"lines",
"=",
"(",
"'\\n'",
".",
"join",
... | Given a list of filenames that we're about to print, limit it to a
reasonable number of lines. | [
"Given",
"a",
"list",
"of",
"filenames",
"that",
"we",
"re",
"about",
"to",
"print",
"limit",
"it",
"to",
"a",
"reasonable",
"number",
"of",
"lines",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/cache.py#L527-L536 |
17,147 | buildinspace/peru | peru/cache.py | GitSession.git_env | def git_env(self):
'Set the index file and prevent git from reading global configs.'
env = dict(os.environ)
for var in ["HOME", "XDG_CONFIG_HOME"]:
env.pop(var, None)
env["GIT_CONFIG_NOSYSTEM"] = "true"
# Weirdly, GIT_INDEX_FILE is interpreted relative to the work tre... | python | def git_env(self):
'Set the index file and prevent git from reading global configs.'
env = dict(os.environ)
for var in ["HOME", "XDG_CONFIG_HOME"]:
env.pop(var, None)
env["GIT_CONFIG_NOSYSTEM"] = "true"
# Weirdly, GIT_INDEX_FILE is interpreted relative to the work tre... | [
"def",
"git_env",
"(",
"self",
")",
":",
"env",
"=",
"dict",
"(",
"os",
".",
"environ",
")",
"for",
"var",
"in",
"[",
"\"HOME\"",
",",
"\"XDG_CONFIG_HOME\"",
"]",
":",
"env",
".",
"pop",
"(",
"var",
",",
"None",
")",
"env",
"[",
"\"GIT_CONFIG_NOSYSTE... | Set the index file and prevent git from reading global configs. | [
"Set",
"the",
"index",
"file",
"and",
"prevent",
"git",
"from",
"reading",
"global",
"configs",
"."
] | 76e4012c6c34e85fb53a4c6d85f4ac3633d93f77 | https://github.com/buildinspace/peru/blob/76e4012c6c34e85fb53a4c6d85f4ac3633d93f77/peru/cache.py#L79-L88 |
17,148 | unitedstates/python-us | us/states.py | load_states | def load_states():
""" Load state data from pickle file distributed with this package.
Creates lists of states, territories, and combined states and
territories. Also adds state abbreviation attribute access
to the package: us.states.MD
"""
from pkg_resources import resource_stream... | python | def load_states():
""" Load state data from pickle file distributed with this package.
Creates lists of states, territories, and combined states and
territories. Also adds state abbreviation attribute access
to the package: us.states.MD
"""
from pkg_resources import resource_stream... | [
"def",
"load_states",
"(",
")",
":",
"from",
"pkg_resources",
"import",
"resource_stream",
"# load state data from pickle file",
"with",
"resource_stream",
"(",
"__name__",
",",
"'states.pkl'",
")",
"as",
"pklfile",
":",
"for",
"s",
"in",
"pickle",
".",
"load",
"(... | Load state data from pickle file distributed with this package.
Creates lists of states, territories, and combined states and
territories. Also adds state abbreviation attribute access
to the package: us.states.MD | [
"Load",
"state",
"data",
"from",
"pickle",
"file",
"distributed",
"with",
"this",
"package",
"."
] | 15165f47a0508bef3737d07d033eaf4b782fb039 | https://github.com/unitedstates/python-us/blob/15165f47a0508bef3737d07d033eaf4b782fb039/us/states.py#L59-L92 |
17,149 | unitedstates/python-us | us/states.py | lookup | def lookup(val, field=None, use_cache=True):
""" Semi-fuzzy state lookup. This method will make a best effort
attempt at finding the state based on the lookup value provided.
* two digits will search for FIPS code
* two letters will search for state abbreviation
* anything els... | python | def lookup(val, field=None, use_cache=True):
""" Semi-fuzzy state lookup. This method will make a best effort
attempt at finding the state based on the lookup value provided.
* two digits will search for FIPS code
* two letters will search for state abbreviation
* anything els... | [
"def",
"lookup",
"(",
"val",
",",
"field",
"=",
"None",
",",
"use_cache",
"=",
"True",
")",
":",
"import",
"jellyfish",
"if",
"field",
"is",
"None",
":",
"if",
"FIPS_RE",
".",
"match",
"(",
"val",
")",
":",
"field",
"=",
"'fips'",
"elif",
"ABBR_RE",
... | Semi-fuzzy state lookup. This method will make a best effort
attempt at finding the state based on the lookup value provided.
* two digits will search for FIPS code
* two letters will search for state abbreviation
* anything else will try to match the metaphone of state names
... | [
"Semi",
"-",
"fuzzy",
"state",
"lookup",
".",
"This",
"method",
"will",
"make",
"a",
"best",
"effort",
"attempt",
"at",
"finding",
"the",
"state",
"based",
"on",
"the",
"lookup",
"value",
"provided",
"."
] | 15165f47a0508bef3737d07d033eaf4b782fb039 | https://github.com/unitedstates/python-us/blob/15165f47a0508bef3737d07d033eaf4b782fb039/us/states.py#L95-L134 |
17,150 | venthur/gscholar | gscholar/gscholar.py | query | def query(searchstr, outformat=FORMAT_BIBTEX, allresults=False):
"""Query google scholar.
This method queries google scholar and returns a list of citations.
Parameters
----------
searchstr : str
the query
outformat : int, optional
the output format of the citations. Default is... | python | def query(searchstr, outformat=FORMAT_BIBTEX, allresults=False):
"""Query google scholar.
This method queries google scholar and returns a list of citations.
Parameters
----------
searchstr : str
the query
outformat : int, optional
the output format of the citations. Default is... | [
"def",
"query",
"(",
"searchstr",
",",
"outformat",
"=",
"FORMAT_BIBTEX",
",",
"allresults",
"=",
"False",
")",
":",
"logger",
".",
"debug",
"(",
"\"Query: {sstring}\"",
".",
"format",
"(",
"sstring",
"=",
"searchstr",
")",
")",
"searchstr",
"=",
"'/scholar?... | Query google scholar.
This method queries google scholar and returns a list of citations.
Parameters
----------
searchstr : str
the query
outformat : int, optional
the output format of the citations. Default is bibtex.
allresults : bool, optional
return all results or o... | [
"Query",
"google",
"scholar",
"."
] | f2f830c4009a4e9a393a81675d5ad88b9b2d87b9 | https://github.com/venthur/gscholar/blob/f2f830c4009a4e9a393a81675d5ad88b9b2d87b9/gscholar/gscholar.py#L43-L86 |
17,151 | venthur/gscholar | gscholar/gscholar.py | get_links | def get_links(html, outformat):
"""Return a list of reference links from the html.
Parameters
----------
html : str
outformat : int
the output format of the citations
Returns
-------
List[str]
the links to the references
"""
if outformat == FORMAT_BIBTEX:
... | python | def get_links(html, outformat):
"""Return a list of reference links from the html.
Parameters
----------
html : str
outformat : int
the output format of the citations
Returns
-------
List[str]
the links to the references
"""
if outformat == FORMAT_BIBTEX:
... | [
"def",
"get_links",
"(",
"html",
",",
"outformat",
")",
":",
"if",
"outformat",
"==",
"FORMAT_BIBTEX",
":",
"refre",
"=",
"re",
".",
"compile",
"(",
"r'<a href=\"https://scholar.googleusercontent.com(/scholar\\.bib\\?[^\"]*)'",
")",
"elif",
"outformat",
"==",
"FORMAT_... | Return a list of reference links from the html.
Parameters
----------
html : str
outformat : int
the output format of the citations
Returns
-------
List[str]
the links to the references | [
"Return",
"a",
"list",
"of",
"reference",
"links",
"from",
"the",
"html",
"."
] | f2f830c4009a4e9a393a81675d5ad88b9b2d87b9 | https://github.com/venthur/gscholar/blob/f2f830c4009a4e9a393a81675d5ad88b9b2d87b9/gscholar/gscholar.py#L89-L116 |
17,152 | venthur/gscholar | gscholar/gscholar.py | convert_pdf_to_txt | def convert_pdf_to_txt(pdf, startpage=None):
"""Convert a pdf file to text and return the text.
This method requires pdftotext to be installed.
Parameters
----------
pdf : str
path to pdf file
startpage : int, optional
the first page we try to convert
Returns
-------
... | python | def convert_pdf_to_txt(pdf, startpage=None):
"""Convert a pdf file to text and return the text.
This method requires pdftotext to be installed.
Parameters
----------
pdf : str
path to pdf file
startpage : int, optional
the first page we try to convert
Returns
-------
... | [
"def",
"convert_pdf_to_txt",
"(",
"pdf",
",",
"startpage",
"=",
"None",
")",
":",
"if",
"startpage",
"is",
"not",
"None",
":",
"startpageargs",
"=",
"[",
"'-f'",
",",
"str",
"(",
"startpage",
")",
"]",
"else",
":",
"startpageargs",
"=",
"[",
"]",
"stdo... | Convert a pdf file to text and return the text.
This method requires pdftotext to be installed.
Parameters
----------
pdf : str
path to pdf file
startpage : int, optional
the first page we try to convert
Returns
-------
str
the converted text | [
"Convert",
"a",
"pdf",
"file",
"to",
"text",
"and",
"return",
"the",
"text",
"."
] | f2f830c4009a4e9a393a81675d5ad88b9b2d87b9 | https://github.com/venthur/gscholar/blob/f2f830c4009a4e9a393a81675d5ad88b9b2d87b9/gscholar/gscholar.py#L119-L146 |
17,153 | venthur/gscholar | gscholar/gscholar.py | pdflookup | def pdflookup(pdf, allresults, outformat, startpage=None):
"""Look a pdf up on google scholar and return bibtex items.
Paramters
---------
pdf : str
path to the pdf file
allresults : bool
return all results or only the first (i.e. best one)
outformat : int
the output for... | python | def pdflookup(pdf, allresults, outformat, startpage=None):
"""Look a pdf up on google scholar and return bibtex items.
Paramters
---------
pdf : str
path to the pdf file
allresults : bool
return all results or only the first (i.e. best one)
outformat : int
the output for... | [
"def",
"pdflookup",
"(",
"pdf",
",",
"allresults",
",",
"outformat",
",",
"startpage",
"=",
"None",
")",
":",
"txt",
"=",
"convert_pdf_to_txt",
"(",
"pdf",
",",
"startpage",
")",
"# remove all non alphanumeric characters",
"txt",
"=",
"re",
".",
"sub",
"(",
... | Look a pdf up on google scholar and return bibtex items.
Paramters
---------
pdf : str
path to the pdf file
allresults : bool
return all results or only the first (i.e. best one)
outformat : int
the output format of the citations
startpage : int
first page to sta... | [
"Look",
"a",
"pdf",
"up",
"on",
"google",
"scholar",
"and",
"return",
"bibtex",
"items",
"."
] | f2f830c4009a4e9a393a81675d5ad88b9b2d87b9 | https://github.com/venthur/gscholar/blob/f2f830c4009a4e9a393a81675d5ad88b9b2d87b9/gscholar/gscholar.py#L149-L175 |
17,154 | venthur/gscholar | gscholar/gscholar.py | _get_bib_element | def _get_bib_element(bibitem, element):
"""Return element from bibitem or None.
Paramteters
-----------
bibitem :
element :
Returns
-------
"""
lst = [i.strip() for i in bibitem.split("\n")]
for i in lst:
if i.startswith(element):
value = i.split("=", 1)[-1... | python | def _get_bib_element(bibitem, element):
"""Return element from bibitem or None.
Paramteters
-----------
bibitem :
element :
Returns
-------
"""
lst = [i.strip() for i in bibitem.split("\n")]
for i in lst:
if i.startswith(element):
value = i.split("=", 1)[-1... | [
"def",
"_get_bib_element",
"(",
"bibitem",
",",
"element",
")",
":",
"lst",
"=",
"[",
"i",
".",
"strip",
"(",
")",
"for",
"i",
"in",
"bibitem",
".",
"split",
"(",
"\"\\n\"",
")",
"]",
"for",
"i",
"in",
"lst",
":",
"if",
"i",
".",
"startswith",
"(... | Return element from bibitem or None.
Paramteters
-----------
bibitem :
element :
Returns
------- | [
"Return",
"element",
"from",
"bibitem",
"or",
"None",
"."
] | f2f830c4009a4e9a393a81675d5ad88b9b2d87b9 | https://github.com/venthur/gscholar/blob/f2f830c4009a4e9a393a81675d5ad88b9b2d87b9/gscholar/gscholar.py#L178-L200 |
17,155 | venthur/gscholar | gscholar/gscholar.py | rename_file | def rename_file(pdf, bibitem):
"""Attempt to rename pdf according to bibitem.
"""
year = _get_bib_element(bibitem, "year")
author = _get_bib_element(bibitem, "author")
if author:
author = author.split(",")[0]
title = _get_bib_element(bibitem, "title")
l = [i for i in (year, author, ... | python | def rename_file(pdf, bibitem):
"""Attempt to rename pdf according to bibitem.
"""
year = _get_bib_element(bibitem, "year")
author = _get_bib_element(bibitem, "author")
if author:
author = author.split(",")[0]
title = _get_bib_element(bibitem, "title")
l = [i for i in (year, author, ... | [
"def",
"rename_file",
"(",
"pdf",
",",
"bibitem",
")",
":",
"year",
"=",
"_get_bib_element",
"(",
"bibitem",
",",
"\"year\"",
")",
"author",
"=",
"_get_bib_element",
"(",
"bibitem",
",",
"\"author\"",
")",
"if",
"author",
":",
"author",
"=",
"author",
".",... | Attempt to rename pdf according to bibitem. | [
"Attempt",
"to",
"rename",
"pdf",
"according",
"to",
"bibitem",
"."
] | f2f830c4009a4e9a393a81675d5ad88b9b2d87b9 | https://github.com/venthur/gscholar/blob/f2f830c4009a4e9a393a81675d5ad88b9b2d87b9/gscholar/gscholar.py#L203-L216 |
17,156 | greedo/python-xbrl | xbrl/xbrl.py | soup_maker | def soup_maker(fh):
""" Takes a file handler returns BeautifulSoup"""
try:
from bs4 import BeautifulSoup
soup = BeautifulSoup(fh, "lxml")
for tag in soup.find_all():
tag.name = tag.name.lower()
except ImportError:
from BeautifulSoup import BeautifulStoneSoup
... | python | def soup_maker(fh):
""" Takes a file handler returns BeautifulSoup"""
try:
from bs4 import BeautifulSoup
soup = BeautifulSoup(fh, "lxml")
for tag in soup.find_all():
tag.name = tag.name.lower()
except ImportError:
from BeautifulSoup import BeautifulStoneSoup
... | [
"def",
"soup_maker",
"(",
"fh",
")",
":",
"try",
":",
"from",
"bs4",
"import",
"BeautifulSoup",
"soup",
"=",
"BeautifulSoup",
"(",
"fh",
",",
"\"lxml\"",
")",
"for",
"tag",
"in",
"soup",
".",
"find_all",
"(",
")",
":",
"tag",
".",
"name",
"=",
"tag",... | Takes a file handler returns BeautifulSoup | [
"Takes",
"a",
"file",
"handler",
"returns",
"BeautifulSoup"
] | e6baa4de61333f7fcead758a1072c21943563b49 | https://github.com/greedo/python-xbrl/blob/e6baa4de61333f7fcead758a1072c21943563b49/xbrl/xbrl.py#L22-L32 |
17,157 | greedo/python-xbrl | xbrl/xbrl.py | XBRLParser.parse | def parse(self, file_handle):
"""
parse is the main entry point for an XBRLParser. It takes a file
handle.
"""
xbrl_obj = XBRL()
# if no file handle was given create our own
if not hasattr(file_handle, 'read'):
file_handler = open(file_handle)
... | python | def parse(self, file_handle):
"""
parse is the main entry point for an XBRLParser. It takes a file
handle.
"""
xbrl_obj = XBRL()
# if no file handle was given create our own
if not hasattr(file_handle, 'read'):
file_handler = open(file_handle)
... | [
"def",
"parse",
"(",
"self",
",",
"file_handle",
")",
":",
"xbrl_obj",
"=",
"XBRL",
"(",
")",
"# if no file handle was given create our own",
"if",
"not",
"hasattr",
"(",
"file_handle",
",",
"'read'",
")",
":",
"file_handler",
"=",
"open",
"(",
"file_handle",
... | parse is the main entry point for an XBRLParser. It takes a file
handle. | [
"parse",
"is",
"the",
"main",
"entry",
"point",
"for",
"an",
"XBRLParser",
".",
"It",
"takes",
"a",
"file",
"handle",
"."
] | e6baa4de61333f7fcead758a1072c21943563b49 | https://github.com/greedo/python-xbrl/blob/e6baa4de61333f7fcead758a1072c21943563b49/xbrl/xbrl.py#L54-L86 |
17,158 | greedo/python-xbrl | xbrl/xbrl.py | XBRLParser.parseDEI | def parseDEI(self,
xbrl,
ignore_errors=0):
"""
Parse DEI from our XBRL soup and return a DEI object.
"""
dei_obj = DEI()
if ignore_errors == 2:
logging.basicConfig(filename='/tmp/xbrl.log',
level=logging.ERROR,
... | python | def parseDEI(self,
xbrl,
ignore_errors=0):
"""
Parse DEI from our XBRL soup and return a DEI object.
"""
dei_obj = DEI()
if ignore_errors == 2:
logging.basicConfig(filename='/tmp/xbrl.log',
level=logging.ERROR,
... | [
"def",
"parseDEI",
"(",
"self",
",",
"xbrl",
",",
"ignore_errors",
"=",
"0",
")",
":",
"dei_obj",
"=",
"DEI",
"(",
")",
"if",
"ignore_errors",
"==",
"2",
":",
"logging",
".",
"basicConfig",
"(",
"filename",
"=",
"'/tmp/xbrl.log'",
",",
"level",
"=",
"l... | Parse DEI from our XBRL soup and return a DEI object. | [
"Parse",
"DEI",
"from",
"our",
"XBRL",
"soup",
"and",
"return",
"a",
"DEI",
"object",
"."
] | e6baa4de61333f7fcead758a1072c21943563b49 | https://github.com/greedo/python-xbrl/blob/e6baa4de61333f7fcead758a1072c21943563b49/xbrl/xbrl.py#L585-L633 |
17,159 | greedo/python-xbrl | xbrl/xbrl.py | XBRLParser.parseCustom | def parseCustom(self,
xbrl,
ignore_errors=0):
"""
Parse company custom entities from XBRL and return an Custom object.
"""
custom_obj = Custom()
custom_data = xbrl.find_all(re.compile('^((?!(us-gaap|dei|xbrll|xbrldi)).)*:\s*',
... | python | def parseCustom(self,
xbrl,
ignore_errors=0):
"""
Parse company custom entities from XBRL and return an Custom object.
"""
custom_obj = Custom()
custom_data = xbrl.find_all(re.compile('^((?!(us-gaap|dei|xbrll|xbrldi)).)*:\s*',
... | [
"def",
"parseCustom",
"(",
"self",
",",
"xbrl",
",",
"ignore_errors",
"=",
"0",
")",
":",
"custom_obj",
"=",
"Custom",
"(",
")",
"custom_data",
"=",
"xbrl",
".",
"find_all",
"(",
"re",
".",
"compile",
"(",
"'^((?!(us-gaap|dei|xbrll|xbrldi)).)*:\\s*'",
",",
"... | Parse company custom entities from XBRL and return an Custom object. | [
"Parse",
"company",
"custom",
"entities",
"from",
"XBRL",
"and",
"return",
"an",
"Custom",
"object",
"."
] | e6baa4de61333f7fcead758a1072c21943563b49 | https://github.com/greedo/python-xbrl/blob/e6baa4de61333f7fcead758a1072c21943563b49/xbrl/xbrl.py#L636-L652 |
17,160 | greedo/python-xbrl | xbrl/xbrl.py | XBRLParser.trim_decimals | def trim_decimals(s, precision=-3):
"""
Convert from scientific notation using precision
"""
encoded = s.encode('ascii', 'ignore')
str_val = ""
if six.PY3:
str_val = str(encoded, encoding='ascii', errors='ignore')[:precision]
else:
# If pre... | python | def trim_decimals(s, precision=-3):
"""
Convert from scientific notation using precision
"""
encoded = s.encode('ascii', 'ignore')
str_val = ""
if six.PY3:
str_val = str(encoded, encoding='ascii', errors='ignore')[:precision]
else:
# If pre... | [
"def",
"trim_decimals",
"(",
"s",
",",
"precision",
"=",
"-",
"3",
")",
":",
"encoded",
"=",
"s",
".",
"encode",
"(",
"'ascii'",
",",
"'ignore'",
")",
"str_val",
"=",
"\"\"",
"if",
"six",
".",
"PY3",
":",
"str_val",
"=",
"str",
"(",
"encoded",
",",... | Convert from scientific notation using precision | [
"Convert",
"from",
"scientific",
"notation",
"using",
"precision"
] | e6baa4de61333f7fcead758a1072c21943563b49 | https://github.com/greedo/python-xbrl/blob/e6baa4de61333f7fcead758a1072c21943563b49/xbrl/xbrl.py#L655-L672 |
17,161 | greedo/python-xbrl | xbrl/xbrl.py | XBRLParser.data_processing | def data_processing(self,
elements,
xbrl,
ignore_errors,
logger,
context_ids=[],
**kwargs):
"""
Process a XBRL tag object and extract the correct value as
... | python | def data_processing(self,
elements,
xbrl,
ignore_errors,
logger,
context_ids=[],
**kwargs):
"""
Process a XBRL tag object and extract the correct value as
... | [
"def",
"data_processing",
"(",
"self",
",",
"elements",
",",
"xbrl",
",",
"ignore_errors",
",",
"logger",
",",
"context_ids",
"=",
"[",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"options",
"=",
"kwargs",
".",
"get",
"(",
"'options'",
",",
"{",
"'type'",
... | Process a XBRL tag object and extract the correct value as
stated by the context. | [
"Process",
"a",
"XBRL",
"tag",
"object",
"and",
"extract",
"the",
"correct",
"value",
"as",
"stated",
"by",
"the",
"context",
"."
] | e6baa4de61333f7fcead758a1072c21943563b49 | https://github.com/greedo/python-xbrl/blob/e6baa4de61333f7fcead758a1072c21943563b49/xbrl/xbrl.py#L686-L739 |
17,162 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/managers.py | PreferencesManager.by_name | def by_name(self):
"""Return a dictionary with preferences identifiers and values, but without the section name in the identifier"""
return {key.split(preferences_settings.SECTION_KEY_SEPARATOR)[-1]: value for key, value in self.all().items()} | python | def by_name(self):
"""Return a dictionary with preferences identifiers and values, but without the section name in the identifier"""
return {key.split(preferences_settings.SECTION_KEY_SEPARATOR)[-1]: value for key, value in self.all().items()} | [
"def",
"by_name",
"(",
"self",
")",
":",
"return",
"{",
"key",
".",
"split",
"(",
"preferences_settings",
".",
"SECTION_KEY_SEPARATOR",
")",
"[",
"-",
"1",
"]",
":",
"value",
"for",
"key",
",",
"value",
"in",
"self",
".",
"all",
"(",
")",
".",
"items... | Return a dictionary with preferences identifiers and values, but without the section name in the identifier | [
"Return",
"a",
"dictionary",
"with",
"preferences",
"identifiers",
"and",
"values",
"but",
"without",
"the",
"section",
"name",
"in",
"the",
"identifier"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/managers.py#L47-L49 |
17,163 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/managers.py | PreferencesManager.get_cache_key | def get_cache_key(self, section, name):
"""Return the cache key corresponding to a given preference"""
if not self.instance:
return 'dynamic_preferences_{0}_{1}_{2}'.format(self.model.__name__, section, name)
return 'dynamic_preferences_{0}_{1}_{2}_{3}'.format(self.model.__name__, se... | python | def get_cache_key(self, section, name):
"""Return the cache key corresponding to a given preference"""
if not self.instance:
return 'dynamic_preferences_{0}_{1}_{2}'.format(self.model.__name__, section, name)
return 'dynamic_preferences_{0}_{1}_{2}_{3}'.format(self.model.__name__, se... | [
"def",
"get_cache_key",
"(",
"self",
",",
"section",
",",
"name",
")",
":",
"if",
"not",
"self",
".",
"instance",
":",
"return",
"'dynamic_preferences_{0}_{1}_{2}'",
".",
"format",
"(",
"self",
".",
"model",
".",
"__name__",
",",
"section",
",",
"name",
")... | Return the cache key corresponding to a given preference | [
"Return",
"the",
"cache",
"key",
"corresponding",
"to",
"a",
"given",
"preference"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/managers.py#L54-L58 |
17,164 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/managers.py | PreferencesManager.from_cache | def from_cache(self, section, name):
"""Return a preference raw_value from cache"""
cached_value = self.cache.get(
self.get_cache_key(section, name), CachedValueNotFound)
if cached_value is CachedValueNotFound:
raise CachedValueNotFound
if cached_value == prefer... | python | def from_cache(self, section, name):
"""Return a preference raw_value from cache"""
cached_value = self.cache.get(
self.get_cache_key(section, name), CachedValueNotFound)
if cached_value is CachedValueNotFound:
raise CachedValueNotFound
if cached_value == prefer... | [
"def",
"from_cache",
"(",
"self",
",",
"section",
",",
"name",
")",
":",
"cached_value",
"=",
"self",
".",
"cache",
".",
"get",
"(",
"self",
".",
"get_cache_key",
"(",
"section",
",",
"name",
")",
",",
"CachedValueNotFound",
")",
"if",
"cached_value",
"i... | Return a preference raw_value from cache | [
"Return",
"a",
"preference",
"raw_value",
"from",
"cache"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/managers.py#L60-L71 |
17,165 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/managers.py | PreferencesManager.many_from_cache | def many_from_cache(self, preferences):
"""
Return cached value for given preferences
missing preferences will be skipped
"""
keys = {
p: self.get_cache_key(p.section.name, p.name)
for p in preferences
}
cached = self.cache.get_many(list(ke... | python | def many_from_cache(self, preferences):
"""
Return cached value for given preferences
missing preferences will be skipped
"""
keys = {
p: self.get_cache_key(p.section.name, p.name)
for p in preferences
}
cached = self.cache.get_many(list(ke... | [
"def",
"many_from_cache",
"(",
"self",
",",
"preferences",
")",
":",
"keys",
"=",
"{",
"p",
":",
"self",
".",
"get_cache_key",
"(",
"p",
".",
"section",
".",
"name",
",",
"p",
".",
"name",
")",
"for",
"p",
"in",
"preferences",
"}",
"cached",
"=",
"... | Return cached value for given preferences
missing preferences will be skipped | [
"Return",
"cached",
"value",
"for",
"given",
"preferences",
"missing",
"preferences",
"will",
"be",
"skipped"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/managers.py#L73-L95 |
17,166 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/managers.py | PreferencesManager.all | def all(self):
"""Return a dictionary containing all preferences by section
Loaded from cache or from db in case of cold cache
"""
if not preferences_settings.ENABLE_CACHE:
return self.load_from_db()
preferences = self.registry.preferences()
# first we hit t... | python | def all(self):
"""Return a dictionary containing all preferences by section
Loaded from cache or from db in case of cold cache
"""
if not preferences_settings.ENABLE_CACHE:
return self.load_from_db()
preferences = self.registry.preferences()
# first we hit t... | [
"def",
"all",
"(",
"self",
")",
":",
"if",
"not",
"preferences_settings",
".",
"ENABLE_CACHE",
":",
"return",
"self",
".",
"load_from_db",
"(",
")",
"preferences",
"=",
"self",
".",
"registry",
".",
"preferences",
"(",
")",
"# first we hit the cache once for all... | Return a dictionary containing all preferences by section
Loaded from cache or from db in case of cold cache | [
"Return",
"a",
"dictionary",
"containing",
"all",
"preferences",
"by",
"section",
"Loaded",
"from",
"cache",
"or",
"from",
"db",
"in",
"case",
"of",
"cold",
"cache"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/managers.py#L182-L200 |
17,167 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/managers.py | PreferencesManager.load_from_db | def load_from_db(self, cache=False):
"""Return a dictionary of preferences by section directly from DB"""
a = {}
db_prefs = {p.preference.identifier(): p for p in self.queryset}
for preference in self.registry.preferences():
try:
db_pref = db_prefs[preference.... | python | def load_from_db(self, cache=False):
"""Return a dictionary of preferences by section directly from DB"""
a = {}
db_prefs = {p.preference.identifier(): p for p in self.queryset}
for preference in self.registry.preferences():
try:
db_pref = db_prefs[preference.... | [
"def",
"load_from_db",
"(",
"self",
",",
"cache",
"=",
"False",
")",
":",
"a",
"=",
"{",
"}",
"db_prefs",
"=",
"{",
"p",
".",
"preference",
".",
"identifier",
"(",
")",
":",
"p",
"for",
"p",
"in",
"self",
".",
"queryset",
"}",
"for",
"preference",
... | Return a dictionary of preferences by section directly from DB | [
"Return",
"a",
"dictionary",
"of",
"preferences",
"by",
"section",
"directly",
"from",
"DB"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/managers.py#L202-L221 |
17,168 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/api/serializers.py | PreferenceSerializer.validate_value | def validate_value(self, value):
"""
We call validation from the underlying form field
"""
field = self.instance.preference.setup_field()
value = field.to_python(value)
field.validate(value)
field.run_validators(value)
return value | python | def validate_value(self, value):
"""
We call validation from the underlying form field
"""
field = self.instance.preference.setup_field()
value = field.to_python(value)
field.validate(value)
field.run_validators(value)
return value | [
"def",
"validate_value",
"(",
"self",
",",
"value",
")",
":",
"field",
"=",
"self",
".",
"instance",
".",
"preference",
".",
"setup_field",
"(",
")",
"value",
"=",
"field",
".",
"to_python",
"(",
"value",
")",
"field",
".",
"validate",
"(",
"value",
")... | We call validation from the underlying form field | [
"We",
"call",
"validation",
"from",
"the",
"underlying",
"form",
"field"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/api/serializers.py#L58-L66 |
17,169 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/serializers.py | StringSerializer.to_python | def to_python(cls, value, **kwargs):
"""String deserialisation just return the value as a string"""
if not value:
return ''
try:
return str(value)
except:
pass
try:
return value.encode('utf-8')
except:
pass
... | python | def to_python(cls, value, **kwargs):
"""String deserialisation just return the value as a string"""
if not value:
return ''
try:
return str(value)
except:
pass
try:
return value.encode('utf-8')
except:
pass
... | [
"def",
"to_python",
"(",
"cls",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"value",
":",
"return",
"''",
"try",
":",
"return",
"str",
"(",
"value",
")",
"except",
":",
"pass",
"try",
":",
"return",
"value",
".",
"encode",
"(",
... | String deserialisation just return the value as a string | [
"String",
"deserialisation",
"just",
"return",
"the",
"value",
"as",
"a",
"string"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/serializers.py#L191-L203 |
17,170 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/registries.py | PreferenceModelsRegistry.get_by_instance | def get_by_instance(self, instance):
"""Return a preference registry using a model instance"""
# we iterate throught registered preference models in order to get the instance class
# and check if instance is and instance of this class
for model, registry in self.items():
try:... | python | def get_by_instance(self, instance):
"""Return a preference registry using a model instance"""
# we iterate throught registered preference models in order to get the instance class
# and check if instance is and instance of this class
for model, registry in self.items():
try:... | [
"def",
"get_by_instance",
"(",
"self",
",",
"instance",
")",
":",
"# we iterate throught registered preference models in order to get the instance class",
"# and check if instance is and instance of this class",
"for",
"model",
",",
"registry",
"in",
"self",
".",
"items",
"(",
... | Return a preference registry using a model instance | [
"Return",
"a",
"preference",
"registry",
"using",
"a",
"model",
"instance"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/registries.py#L60-L72 |
17,171 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/registries.py | PreferenceRegistry.register | def register(self, preference_class):
"""
Store the given preference class in the registry.
:param preference_class: a :py:class:`prefs.Preference` subclass
"""
preference = preference_class(registry=self)
self.section_objects[preference.section.name] = preference.sectio... | python | def register(self, preference_class):
"""
Store the given preference class in the registry.
:param preference_class: a :py:class:`prefs.Preference` subclass
"""
preference = preference_class(registry=self)
self.section_objects[preference.section.name] = preference.sectio... | [
"def",
"register",
"(",
"self",
",",
"preference_class",
")",
":",
"preference",
"=",
"preference_class",
"(",
"registry",
"=",
"self",
")",
"self",
".",
"section_objects",
"[",
"preference",
".",
"section",
".",
"name",
"]",
"=",
"preference",
".",
"section... | Store the given preference class in the registry.
:param preference_class: a :py:class:`prefs.Preference` subclass | [
"Store",
"the",
"given",
"preference",
"class",
"in",
"the",
"registry",
"."
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/registries.py#L105-L121 |
17,172 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/registries.py | PreferenceRegistry.get | def get(self, name, section=None, fallback=False):
"""
Returns a previously registered preference
:param section: The section name under which the preference is registered
:type section: str.
:param name: The name of the preference. You can use dotted notation 'section.name' if ... | python | def get(self, name, section=None, fallback=False):
"""
Returns a previously registered preference
:param section: The section name under which the preference is registered
:type section: str.
:param name: The name of the preference. You can use dotted notation 'section.name' if ... | [
"def",
"get",
"(",
"self",
",",
"name",
",",
"section",
"=",
"None",
",",
"fallback",
"=",
"False",
")",
":",
"# try dotted notation",
"try",
":",
"_section",
",",
"name",
"=",
"name",
".",
"split",
"(",
"preferences_settings",
".",
"SECTION_KEY_SEPARATOR",
... | Returns a previously registered preference
:param section: The section name under which the preference is registered
:type section: str.
:param name: The name of the preference. You can use dotted notation 'section.name' if you want to avoid providing section param
:type name: str.
... | [
"Returns",
"a",
"previously",
"registered",
"preference"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/registries.py#L146-L175 |
17,173 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/registries.py | PreferenceRegistry.manager | def manager(self, **kwargs):
"""Return a preference manager that can be used to retrieve preference values"""
return PreferencesManager(registry=self, model=self.preference_model, **kwargs) | python | def manager(self, **kwargs):
"""Return a preference manager that can be used to retrieve preference values"""
return PreferencesManager(registry=self, model=self.preference_model, **kwargs) | [
"def",
"manager",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"PreferencesManager",
"(",
"registry",
"=",
"self",
",",
"model",
"=",
"self",
".",
"preference_model",
",",
"*",
"*",
"kwargs",
")"
] | Return a preference manager that can be used to retrieve preference values | [
"Return",
"a",
"preference",
"manager",
"that",
"can",
"be",
"used",
"to",
"retrieve",
"preference",
"values"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/registries.py#L186-L188 |
17,174 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/registries.py | PreferenceRegistry.preferences | def preferences(self, section=None):
"""
Return a list of all registered preferences
or a list of preferences registered for a given section
:param section: The section name under which the preference is registered
:type section: str.
:return: a list of :py:class:`prefs.... | python | def preferences(self, section=None):
"""
Return a list of all registered preferences
or a list of preferences registered for a given section
:param section: The section name under which the preference is registered
:type section: str.
:return: a list of :py:class:`prefs.... | [
"def",
"preferences",
"(",
"self",
",",
"section",
"=",
"None",
")",
":",
"if",
"section",
"is",
"None",
":",
"return",
"[",
"self",
"[",
"section",
"]",
"[",
"name",
"]",
"for",
"section",
"in",
"self",
"for",
"name",
"in",
"self",
"[",
"section",
... | Return a list of all registered preferences
or a list of preferences registered for a given section
:param section: The section name under which the preference is registered
:type section: str.
:return: a list of :py:class:`prefs.BasePreference` instances | [
"Return",
"a",
"list",
"of",
"all",
"registered",
"preferences",
"or",
"a",
"list",
"of",
"preferences",
"registered",
"for",
"a",
"given",
"section"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/registries.py#L198-L211 |
17,175 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/api/viewsets.py | PreferenceViewSet.get_queryset | def get_queryset(self):
"""
We just ensure preferences are actually populated before fetching
from db
"""
self.init_preferences()
queryset = super(PreferenceViewSet, self).get_queryset()
section = self.request.query_params.get('section')
if section:
... | python | def get_queryset(self):
"""
We just ensure preferences are actually populated before fetching
from db
"""
self.init_preferences()
queryset = super(PreferenceViewSet, self).get_queryset()
section = self.request.query_params.get('section')
if section:
... | [
"def",
"get_queryset",
"(",
"self",
")",
":",
"self",
".",
"init_preferences",
"(",
")",
"queryset",
"=",
"super",
"(",
"PreferenceViewSet",
",",
"self",
")",
".",
"get_queryset",
"(",
")",
"section",
"=",
"self",
".",
"request",
".",
"query_params",
".",
... | We just ensure preferences are actually populated before fetching
from db | [
"We",
"just",
"ensure",
"preferences",
"are",
"actually",
"populated",
"before",
"fetching",
"from",
"db"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/api/viewsets.py#L30-L42 |
17,176 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/api/viewsets.py | PreferenceViewSet.bulk | def bulk(self, request, *args, **kwargs):
"""
Update multiple preferences at once
this is a long method because we ensure everything is valid
before actually persisting the changes
"""
manager = self.get_manager()
errors = {}
preferences = []
payl... | python | def bulk(self, request, *args, **kwargs):
"""
Update multiple preferences at once
this is a long method because we ensure everything is valid
before actually persisting the changes
"""
manager = self.get_manager()
errors = {}
preferences = []
payl... | [
"def",
"bulk",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"manager",
"=",
"self",
".",
"get_manager",
"(",
")",
"errors",
"=",
"{",
"}",
"preferences",
"=",
"[",
"]",
"payload",
"=",
"request",
".",
"data",
... | Update multiple preferences at once
this is a long method because we ensure everything is valid
before actually persisting the changes | [
"Update",
"multiple",
"preferences",
"at",
"once"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/api/viewsets.py#L82-L144 |
17,177 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/models.py | BasePreferenceModel.set_value | def set_value(self, value):
"""
Save serialized self.value to self.raw_value
"""
self.raw_value = self.preference.serializer.serialize(value) | python | def set_value(self, value):
"""
Save serialized self.value to self.raw_value
"""
self.raw_value = self.preference.serializer.serialize(value) | [
"def",
"set_value",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"raw_value",
"=",
"self",
".",
"preference",
".",
"serializer",
".",
"serialize",
"(",
"value",
")"
] | Save serialized self.value to self.raw_value | [
"Save",
"serialized",
"self",
".",
"value",
"to",
"self",
".",
"raw_value"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/models.py#L49-L53 |
17,178 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/management/commands/checkpreferences.py | delete_preferences | def delete_preferences(queryset):
"""
Delete preferences objects if they are not present in registry. Return a list of deleted objects
"""
deleted = []
# Iterate through preferences. If an error is raised when accessing preference object, just delete it
for p in queryset:
try:
... | python | def delete_preferences(queryset):
"""
Delete preferences objects if they are not present in registry. Return a list of deleted objects
"""
deleted = []
# Iterate through preferences. If an error is raised when accessing preference object, just delete it
for p in queryset:
try:
... | [
"def",
"delete_preferences",
"(",
"queryset",
")",
":",
"deleted",
"=",
"[",
"]",
"# Iterate through preferences. If an error is raised when accessing preference object, just delete it",
"for",
"p",
"in",
"queryset",
":",
"try",
":",
"pref",
"=",
"p",
".",
"registry",
"... | Delete preferences objects if they are not present in registry. Return a list of deleted objects | [
"Delete",
"preferences",
"objects",
"if",
"they",
"are",
"not",
"present",
"in",
"registry",
".",
"Return",
"a",
"list",
"of",
"deleted",
"objects"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/management/commands/checkpreferences.py#L10-L24 |
17,179 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/types.py | create_deletion_handler | def create_deletion_handler(preference):
"""
Will generate a dynamic handler to purge related preference
on instance deletion
"""
def delete_related_preferences(sender, instance, *args, **kwargs):
queryset = preference.registry.preference_model.objects\
... | python | def create_deletion_handler(preference):
"""
Will generate a dynamic handler to purge related preference
on instance deletion
"""
def delete_related_preferences(sender, instance, *args, **kwargs):
queryset = preference.registry.preference_model.objects\
... | [
"def",
"create_deletion_handler",
"(",
"preference",
")",
":",
"def",
"delete_related_preferences",
"(",
"sender",
",",
"instance",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"queryset",
"=",
"preference",
".",
"registry",
".",
"preference_model",
".... | Will generate a dynamic handler to purge related preference
on instance deletion | [
"Will",
"generate",
"a",
"dynamic",
"handler",
"to",
"purge",
"related",
"preference",
"on",
"instance",
"deletion"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/types.py#L250-L262 |
17,180 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/types.py | BasePreferenceType.get_field_kwargs | def get_field_kwargs(self):
"""
Return a dict of arguments to use as parameters for the field
class instianciation.
This will use :py:attr:`field_kwargs` as a starter,
and use sensible defaults for a few attributes:
- :py:attr:`instance.verbose_name` for the field label... | python | def get_field_kwargs(self):
"""
Return a dict of arguments to use as parameters for the field
class instianciation.
This will use :py:attr:`field_kwargs` as a starter,
and use sensible defaults for a few attributes:
- :py:attr:`instance.verbose_name` for the field label... | [
"def",
"get_field_kwargs",
"(",
"self",
")",
":",
"kwargs",
"=",
"self",
".",
"field_kwargs",
".",
"copy",
"(",
")",
"kwargs",
".",
"setdefault",
"(",
"'label'",
",",
"self",
".",
"get",
"(",
"'verbose_name'",
")",
")",
"kwargs",
".",
"setdefault",
"(",
... | Return a dict of arguments to use as parameters for the field
class instianciation.
This will use :py:attr:`field_kwargs` as a starter,
and use sensible defaults for a few attributes:
- :py:attr:`instance.verbose_name` for the field label
- :py:attr:`instance.help_text` for the... | [
"Return",
"a",
"dict",
"of",
"arguments",
"to",
"use",
"as",
"parameters",
"for",
"the",
"field",
"class",
"instianciation",
"."
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/types.py#L84-L106 |
17,181 | EliotBerriot/django-dynamic-preferences | dynamic_preferences/types.py | BasePreferenceType.get_api_field_data | def get_api_field_data(self):
"""
Field data to serialize for use on front-end side, for example
will include choices available for a choice field
"""
field = self.setup_field()
d = {
'class': field.__class__.__name__,
'widget': {
'... | python | def get_api_field_data(self):
"""
Field data to serialize for use on front-end side, for example
will include choices available for a choice field
"""
field = self.setup_field()
d = {
'class': field.__class__.__name__,
'widget': {
'... | [
"def",
"get_api_field_data",
"(",
"self",
")",
":",
"field",
"=",
"self",
".",
"setup_field",
"(",
")",
"d",
"=",
"{",
"'class'",
":",
"field",
".",
"__class__",
".",
"__name__",
",",
"'widget'",
":",
"{",
"'class'",
":",
"field",
".",
"widget",
".",
... | Field data to serialize for use on front-end side, for example
will include choices available for a choice field | [
"Field",
"data",
"to",
"serialize",
"for",
"use",
"on",
"front",
"-",
"end",
"side",
"for",
"example",
"will",
"include",
"choices",
"available",
"for",
"a",
"choice",
"field"
] | 12eab4f17b960290525b215d954d1b5fb91199df | https://github.com/EliotBerriot/django-dynamic-preferences/blob/12eab4f17b960290525b215d954d1b5fb91199df/dynamic_preferences/types.py#L120-L140 |
17,182 | Woile/commitizen | commitizen/factory.py | commiter_factory | def commiter_factory(config: dict) -> BaseCommitizen:
"""Return the correct commitizen existing in the registry."""
name: str = config["name"]
try:
_cz = registry[name](config)
except KeyError:
msg_error = (
"The commiter has not been found in the system.\n\n"
f"T... | python | def commiter_factory(config: dict) -> BaseCommitizen:
"""Return the correct commitizen existing in the registry."""
name: str = config["name"]
try:
_cz = registry[name](config)
except KeyError:
msg_error = (
"The commiter has not been found in the system.\n\n"
f"T... | [
"def",
"commiter_factory",
"(",
"config",
":",
"dict",
")",
"->",
"BaseCommitizen",
":",
"name",
":",
"str",
"=",
"config",
"[",
"\"name\"",
"]",
"try",
":",
"_cz",
"=",
"registry",
"[",
"name",
"]",
"(",
"config",
")",
"except",
"KeyError",
":",
"msg_... | Return the correct commitizen existing in the registry. | [
"Return",
"the",
"correct",
"commitizen",
"existing",
"in",
"the",
"registry",
"."
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/factory.py#L8-L21 |
17,183 | Woile/commitizen | commitizen/bump.py | generate_version | def generate_version(
current_version: str, increment: str, prerelease: Optional[str] = None
) -> Version:
"""Based on the given increment a proper semver will be generated.
For now the rules and versioning scheme is based on
python's PEP 0440.
More info: https://www.python.org/dev/peps/pep-0440/
... | python | def generate_version(
current_version: str, increment: str, prerelease: Optional[str] = None
) -> Version:
"""Based on the given increment a proper semver will be generated.
For now the rules and versioning scheme is based on
python's PEP 0440.
More info: https://www.python.org/dev/peps/pep-0440/
... | [
"def",
"generate_version",
"(",
"current_version",
":",
"str",
",",
"increment",
":",
"str",
",",
"prerelease",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Version",
":",
"pre_version",
"=",
"prerelease_generator",
"(",
"current_version",
",",
... | Based on the given increment a proper semver will be generated.
For now the rules and versioning scheme is based on
python's PEP 0440.
More info: https://www.python.org/dev/peps/pep-0440/
Example:
PATCH 1.0.0 -> 1.0.1
MINOR 1.0.0 -> 1.1.0
MAJOR 1.0.0 -> 2.0.0 | [
"Based",
"on",
"the",
"given",
"increment",
"a",
"proper",
"semver",
"will",
"be",
"generated",
"."
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/bump.py#L94-L112 |
17,184 | Woile/commitizen | commitizen/bump.py | update_version_in_files | def update_version_in_files(current_version: str, new_version: str, files: list):
"""Change old version to the new one in every file given.
Note that this version is not the tag formatted one.
So for example, your tag could look like `v1.0.0` while your version in
the package like `1.0.0`.
"""
... | python | def update_version_in_files(current_version: str, new_version: str, files: list):
"""Change old version to the new one in every file given.
Note that this version is not the tag formatted one.
So for example, your tag could look like `v1.0.0` while your version in
the package like `1.0.0`.
"""
... | [
"def",
"update_version_in_files",
"(",
"current_version",
":",
"str",
",",
"new_version",
":",
"str",
",",
"files",
":",
"list",
")",
":",
"for",
"filepath",
"in",
"files",
":",
"# Read in the file",
"with",
"open",
"(",
"filepath",
",",
"\"r\"",
")",
"as",
... | Change old version to the new one in every file given.
Note that this version is not the tag formatted one.
So for example, your tag could look like `v1.0.0` while your version in
the package like `1.0.0`. | [
"Change",
"old",
"version",
"to",
"the",
"new",
"one",
"in",
"every",
"file",
"given",
"."
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/bump.py#L115-L132 |
17,185 | Woile/commitizen | commitizen/bump.py | create_tag | def create_tag(version: Union[Version, str], tag_format: Optional[str] = None):
"""The tag and the software version might be different.
That's why this function exists.
Example:
| tag | version (PEP 0440) |
| --- | ------- |
| v0.9.0 | 0.9.0 |
| ver1.0.0 | 1.0.0 |
| ver1.0.0.a0 | 1.0.... | python | def create_tag(version: Union[Version, str], tag_format: Optional[str] = None):
"""The tag and the software version might be different.
That's why this function exists.
Example:
| tag | version (PEP 0440) |
| --- | ------- |
| v0.9.0 | 0.9.0 |
| ver1.0.0 | 1.0.0 |
| ver1.0.0.a0 | 1.0.... | [
"def",
"create_tag",
"(",
"version",
":",
"Union",
"[",
"Version",
",",
"str",
"]",
",",
"tag_format",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"version",
",",
"str",
")",
":",
"version",
"=",
"Version",
"(",
... | The tag and the software version might be different.
That's why this function exists.
Example:
| tag | version (PEP 0440) |
| --- | ------- |
| v0.9.0 | 0.9.0 |
| ver1.0.0 | 1.0.0 |
| ver1.0.0.a0 | 1.0.0a0 | | [
"The",
"tag",
"and",
"the",
"software",
"version",
"might",
"be",
"different",
"."
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/bump.py#L135-L163 |
17,186 | Woile/commitizen | commitizen/config.py | read_pyproject_conf | def read_pyproject_conf(data: str) -> dict:
"""We expect to have a section in pyproject looking like
```
[tool.commitizen]
name = "cz_conventional_commits"
```
"""
doc = parse(data)
try:
return doc["tool"]["commitizen"]
except exceptions.NonExistentKey:
return {} | python | def read_pyproject_conf(data: str) -> dict:
"""We expect to have a section in pyproject looking like
```
[tool.commitizen]
name = "cz_conventional_commits"
```
"""
doc = parse(data)
try:
return doc["tool"]["commitizen"]
except exceptions.NonExistentKey:
return {} | [
"def",
"read_pyproject_conf",
"(",
"data",
":",
"str",
")",
"->",
"dict",
":",
"doc",
"=",
"parse",
"(",
"data",
")",
"try",
":",
"return",
"doc",
"[",
"\"tool\"",
"]",
"[",
"\"commitizen\"",
"]",
"except",
"exceptions",
".",
"NonExistentKey",
":",
"retu... | We expect to have a section in pyproject looking like
```
[tool.commitizen]
name = "cz_conventional_commits"
``` | [
"We",
"expect",
"to",
"have",
"a",
"section",
"in",
"pyproject",
"looking",
"like"
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/config.py#L39-L51 |
17,187 | Woile/commitizen | commitizen/config.py | read_raw_parser_conf | def read_raw_parser_conf(data: str) -> dict:
"""We expect to have a section like this
```
[commitizen]
name = cz_jira
files = [
"commitizen/__version__.py",
"pyproject.toml"
] # this tab at the end is important
```
"""
config = configparser.ConfigParser(allow_no... | python | def read_raw_parser_conf(data: str) -> dict:
"""We expect to have a section like this
```
[commitizen]
name = cz_jira
files = [
"commitizen/__version__.py",
"pyproject.toml"
] # this tab at the end is important
```
"""
config = configparser.ConfigParser(allow_no... | [
"def",
"read_raw_parser_conf",
"(",
"data",
":",
"str",
")",
"->",
"dict",
":",
"config",
"=",
"configparser",
".",
"ConfigParser",
"(",
"allow_no_value",
"=",
"True",
")",
"config",
".",
"read_string",
"(",
"data",
")",
"try",
":",
"_data",
":",
"dict",
... | We expect to have a section like this
```
[commitizen]
name = cz_jira
files = [
"commitizen/__version__.py",
"pyproject.toml"
] # this tab at the end is important
``` | [
"We",
"expect",
"to",
"have",
"a",
"section",
"like",
"this"
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/config.py#L54-L78 |
17,188 | Woile/commitizen | commitizen/config.py | set_key | def set_key(key: str, value: str) -> dict:
"""Set or update a key in the conf.
For now only strings are supported.
We use to update the version number.
"""
if not _conf.path:
return {}
if "toml" in _conf.path:
with open(_conf.path, "r") as f:
parser = parse(f.read()... | python | def set_key(key: str, value: str) -> dict:
"""Set or update a key in the conf.
For now only strings are supported.
We use to update the version number.
"""
if not _conf.path:
return {}
if "toml" in _conf.path:
with open(_conf.path, "r") as f:
parser = parse(f.read()... | [
"def",
"set_key",
"(",
"key",
":",
"str",
",",
"value",
":",
"str",
")",
"->",
"dict",
":",
"if",
"not",
"_conf",
".",
"path",
":",
"return",
"{",
"}",
"if",
"\"toml\"",
"in",
"_conf",
".",
"path",
":",
"with",
"open",
"(",
"_conf",
".",
"path",
... | Set or update a key in the conf.
For now only strings are supported.
We use to update the version number. | [
"Set",
"or",
"update",
"a",
"key",
"in",
"the",
"conf",
"."
] | bc54b9a4b6ad281620179a1ed417c01addde55f6 | https://github.com/Woile/commitizen/blob/bc54b9a4b6ad281620179a1ed417c01addde55f6/commitizen/config.py#L130-L152 |
17,189 | pysathq/pysat | pysat/_fileio.py | FileObject.close | def close(self):
"""
Close a file pointer.
"""
if self.fp:
self.fp.close()
self.fp = None
if self.fp_extra:
self.fp_extra.close()
self.fp_extra = None
self.ctype = None | python | def close(self):
"""
Close a file pointer.
"""
if self.fp:
self.fp.close()
self.fp = None
if self.fp_extra:
self.fp_extra.close()
self.fp_extra = None
self.ctype = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
":",
"self",
".",
"fp",
".",
"close",
"(",
")",
"self",
".",
"fp",
"=",
"None",
"if",
"self",
".",
"fp_extra",
":",
"self",
".",
"fp_extra",
".",
"close",
"(",
")",
"self",
".",
... | Close a file pointer. | [
"Close",
"a",
"file",
"pointer",
"."
] | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/_fileio.py#L147-L160 |
17,190 | pysathq/pysat | pysat/_fileio.py | FileObject.get_compression_type | def get_compression_type(self, file_name):
"""
Determine compression type for a given file using its extension.
:param file_name: a given file name
:type file_name: str
"""
ext = os.path.splitext(file_name)[1]
if ext == '.gz':
self.ctype... | python | def get_compression_type(self, file_name):
"""
Determine compression type for a given file using its extension.
:param file_name: a given file name
:type file_name: str
"""
ext = os.path.splitext(file_name)[1]
if ext == '.gz':
self.ctype... | [
"def",
"get_compression_type",
"(",
"self",
",",
"file_name",
")",
":",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"file_name",
")",
"[",
"1",
"]",
"if",
"ext",
"==",
"'.gz'",
":",
"self",
".",
"ctype",
"=",
"'gzip'",
"elif",
"ext",
"==",
... | Determine compression type for a given file using its extension.
:param file_name: a given file name
:type file_name: str | [
"Determine",
"compression",
"type",
"for",
"a",
"given",
"file",
"using",
"its",
"extension",
"."
] | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/_fileio.py#L162-L179 |
17,191 | pysathq/pysat | solvers/prepare.py | do | def do(to_install):
"""
Prepare all solvers specified in the command line.
"""
for solver in to_install:
print('preparing {0}'.format(solver))
download_archive(sources[solver])
extract_archive(sources[solver][-1], solver)
adapt_files(solver)
patch_solver(sol... | python | def do(to_install):
"""
Prepare all solvers specified in the command line.
"""
for solver in to_install:
print('preparing {0}'.format(solver))
download_archive(sources[solver])
extract_archive(sources[solver][-1], solver)
adapt_files(solver)
patch_solver(sol... | [
"def",
"do",
"(",
"to_install",
")",
":",
"for",
"solver",
"in",
"to_install",
":",
"print",
"(",
"'preparing {0}'",
".",
"format",
"(",
"solver",
")",
")",
"download_archive",
"(",
"sources",
"[",
"solver",
"]",
")",
"extract_archive",
"(",
"sources",
"["... | Prepare all solvers specified in the command line. | [
"Prepare",
"all",
"solvers",
"specified",
"in",
"the",
"command",
"line",
"."
] | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/solvers/prepare.py#L272-L284 |
17,192 | pysathq/pysat | solvers/prepare.py | adapt_files | def adapt_files(solver):
"""
Rename and remove files whenever necessary.
"""
print("adapting {0}'s files".format(solver))
root = os.path.join('solvers', solver)
for arch in to_extract[solver]:
arch = os.path.join(root, arch)
extract_archive(arch, solver, put_inside=True)
... | python | def adapt_files(solver):
"""
Rename and remove files whenever necessary.
"""
print("adapting {0}'s files".format(solver))
root = os.path.join('solvers', solver)
for arch in to_extract[solver]:
arch = os.path.join(root, arch)
extract_archive(arch, solver, put_inside=True)
... | [
"def",
"adapt_files",
"(",
"solver",
")",
":",
"print",
"(",
"\"adapting {0}'s files\"",
".",
"format",
"(",
"solver",
")",
")",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'solvers'",
",",
"solver",
")",
"for",
"arch",
"in",
"to_extract",
"[",
... | Rename and remove files whenever necessary. | [
"Rename",
"and",
"remove",
"files",
"whenever",
"necessary",
"."
] | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/solvers/prepare.py#L380-L402 |
17,193 | pysathq/pysat | examples/mcsls.py | MCSls._map_extlit | def _map_extlit(self, l):
"""
Map an external variable to an internal one if necessary.
This method is used when new clauses are added to the formula
incrementally, which may result in introducing new variables
clashing with the previously used *clause selectors*... | python | def _map_extlit(self, l):
"""
Map an external variable to an internal one if necessary.
This method is used when new clauses are added to the formula
incrementally, which may result in introducing new variables
clashing with the previously used *clause selectors*... | [
"def",
"_map_extlit",
"(",
"self",
",",
"l",
")",
":",
"v",
"=",
"abs",
"(",
"l",
")",
"if",
"v",
"in",
"self",
".",
"vmap",
".",
"e2i",
":",
"return",
"int",
"(",
"copysign",
"(",
"self",
".",
"vmap",
".",
"e2i",
"[",
"v",
"]",
",",
"l",
"... | Map an external variable to an internal one if necessary.
This method is used when new clauses are added to the formula
incrementally, which may result in introducing new variables
clashing with the previously used *clause selectors*. The method
makes sure no clash occur... | [
"Map",
"an",
"external",
"variable",
"to",
"an",
"internal",
"one",
"if",
"necessary",
"."
] | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/mcsls.py#L409-L439 |
17,194 | pysathq/pysat | examples/hitman.py | Hitman.init | def init(self, bootstrap_with):
"""
This method serves for initializing the hitting set solver with a
given list of sets to hit. Concretely, the hitting set problem is
encoded into partial MaxSAT as outlined above, which is then fed
either to a MaxSAT solver or an... | python | def init(self, bootstrap_with):
"""
This method serves for initializing the hitting set solver with a
given list of sets to hit. Concretely, the hitting set problem is
encoded into partial MaxSAT as outlined above, which is then fed
either to a MaxSAT solver or an... | [
"def",
"init",
"(",
"self",
",",
"bootstrap_with",
")",
":",
"# formula encoding the sets to hit",
"formula",
"=",
"WCNF",
"(",
")",
"# hard clauses",
"for",
"to_hit",
"in",
"bootstrap_with",
":",
"to_hit",
"=",
"list",
"(",
"map",
"(",
"lambda",
"obj",
":",
... | This method serves for initializing the hitting set solver with a
given list of sets to hit. Concretely, the hitting set problem is
encoded into partial MaxSAT as outlined above, which is then fed
either to a MaxSAT solver or an MCS enumerator.
:param bootstrap_with: inp... | [
"This",
"method",
"serves",
"for",
"initializing",
"the",
"hitting",
"set",
"solver",
"with",
"a",
"given",
"list",
"of",
"sets",
"to",
"hit",
".",
"Concretely",
"the",
"hitting",
"set",
"problem",
"is",
"encoded",
"into",
"partial",
"MaxSAT",
"as",
"outline... | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/hitman.py#L254-L285 |
17,195 | pysathq/pysat | examples/hitman.py | Hitman.get | def get(self):
"""
This method computes and returns a hitting set. The hitting set is
obtained using the underlying oracle operating the MaxSAT problem
formulation. The computed solution is mapped back to objects of the
problem domain.
:rtype: list(ob... | python | def get(self):
"""
This method computes and returns a hitting set. The hitting set is
obtained using the underlying oracle operating the MaxSAT problem
formulation. The computed solution is mapped back to objects of the
problem domain.
:rtype: list(ob... | [
"def",
"get",
"(",
"self",
")",
":",
"model",
"=",
"self",
".",
"oracle",
".",
"compute",
"(",
")",
"if",
"model",
":",
"if",
"self",
".",
"htype",
"==",
"'rc2'",
":",
"# extracting a hitting set",
"self",
".",
"hset",
"=",
"filter",
"(",
"lambda",
"... | This method computes and returns a hitting set. The hitting set is
obtained using the underlying oracle operating the MaxSAT problem
formulation. The computed solution is mapped back to objects of the
problem domain.
:rtype: list(obj) | [
"This",
"method",
"computes",
"and",
"returns",
"a",
"hitting",
"set",
".",
"The",
"hitting",
"set",
"is",
"obtained",
"using",
"the",
"underlying",
"oracle",
"operating",
"the",
"MaxSAT",
"problem",
"formulation",
".",
"The",
"computed",
"solution",
"is",
"ma... | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/hitman.py#L296-L315 |
17,196 | pysathq/pysat | examples/hitman.py | Hitman.hit | def hit(self, to_hit):
"""
This method adds a new set to hit to the hitting set solver. This
is done by translating the input iterable of objects into a list of
Boolean variables in the MaxSAT problem formulation.
:param to_hit: a new set to hit
:type... | python | def hit(self, to_hit):
"""
This method adds a new set to hit to the hitting set solver. This
is done by translating the input iterable of objects into a list of
Boolean variables in the MaxSAT problem formulation.
:param to_hit: a new set to hit
:type... | [
"def",
"hit",
"(",
"self",
",",
"to_hit",
")",
":",
"# translating objects to variables",
"to_hit",
"=",
"list",
"(",
"map",
"(",
"lambda",
"obj",
":",
"self",
".",
"idpool",
".",
"id",
"(",
"obj",
")",
",",
"to_hit",
")",
")",
"# a soft clause should be a... | This method adds a new set to hit to the hitting set solver. This
is done by translating the input iterable of objects into a list of
Boolean variables in the MaxSAT problem formulation.
:param to_hit: a new set to hit
:type to_hit: iterable(obj) | [
"This",
"method",
"adds",
"a",
"new",
"set",
"to",
"hit",
"to",
"the",
"hitting",
"set",
"solver",
".",
"This",
"is",
"done",
"by",
"translating",
"the",
"input",
"iterable",
"of",
"objects",
"into",
"a",
"list",
"of",
"Boolean",
"variables",
"in",
"the"... | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/hitman.py#L317-L338 |
17,197 | pysathq/pysat | examples/hitman.py | Hitman.block | def block(self, to_block):
"""
The method serves for imposing a constraint forbidding the hitting
set solver to compute a given hitting set. Each set to block is
encoded as a hard clause in the MaxSAT problem formulation, which
is then added to the underlying orac... | python | def block(self, to_block):
"""
The method serves for imposing a constraint forbidding the hitting
set solver to compute a given hitting set. Each set to block is
encoded as a hard clause in the MaxSAT problem formulation, which
is then added to the underlying orac... | [
"def",
"block",
"(",
"self",
",",
"to_block",
")",
":",
"# translating objects to variables",
"to_block",
"=",
"list",
"(",
"map",
"(",
"lambda",
"obj",
":",
"self",
".",
"idpool",
".",
"id",
"(",
"obj",
")",
",",
"to_block",
")",
")",
"# a soft clause sho... | The method serves for imposing a constraint forbidding the hitting
set solver to compute a given hitting set. Each set to block is
encoded as a hard clause in the MaxSAT problem formulation, which
is then added to the underlying oracle.
:param to_block: a set to block
... | [
"The",
"method",
"serves",
"for",
"imposing",
"a",
"constraint",
"forbidding",
"the",
"hitting",
"set",
"solver",
"to",
"compute",
"a",
"given",
"hitting",
"set",
".",
"Each",
"set",
"to",
"block",
"is",
"encoded",
"as",
"a",
"hard",
"clause",
"in",
"the",... | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/hitman.py#L340-L362 |
17,198 | pysathq/pysat | examples/musx.py | MUSX._compute | def _compute(self, approx):
"""
Deletion-based MUS extraction. Given an over-approximation of an
MUS, i.e. an unsatisfiable core previously returned by a SAT
oracle, the method represents a loop, which at each iteration
removes a clause from the core and checks wh... | python | def _compute(self, approx):
"""
Deletion-based MUS extraction. Given an over-approximation of an
MUS, i.e. an unsatisfiable core previously returned by a SAT
oracle, the method represents a loop, which at each iteration
removes a clause from the core and checks wh... | [
"def",
"_compute",
"(",
"self",
",",
"approx",
")",
":",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"approx",
")",
":",
"to_test",
"=",
"approx",
"[",
":",
"i",
"]",
"+",
"approx",
"[",
"(",
"i",
"+",
"1",
")",
":",
"]",
"sel",
",",
"cli... | Deletion-based MUS extraction. Given an over-approximation of an
MUS, i.e. an unsatisfiable core previously returned by a SAT
oracle, the method represents a loop, which at each iteration
removes a clause from the core and checks whether the remaining
clauses of the appro... | [
"Deletion",
"-",
"based",
"MUS",
"extraction",
".",
"Given",
"an",
"over",
"-",
"approximation",
"of",
"an",
"MUS",
"i",
".",
"e",
".",
"an",
"unsatisfiable",
"core",
"previously",
"returned",
"by",
"a",
"SAT",
"oracle",
"the",
"method",
"represents",
"a",... | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/musx.py#L204-L250 |
17,199 | pysathq/pysat | setup.py | build.run | def run(self):
"""
Download, patch and compile SAT solvers before building.
"""
# download and compile solvers
prepare.do(to_install)
# now, do standard build
distutils.command.build.build.run(self) | python | def run(self):
"""
Download, patch and compile SAT solvers before building.
"""
# download and compile solvers
prepare.do(to_install)
# now, do standard build
distutils.command.build.build.run(self) | [
"def",
"run",
"(",
"self",
")",
":",
"# download and compile solvers",
"prepare",
".",
"do",
"(",
"to_install",
")",
"# now, do standard build",
"distutils",
".",
"command",
".",
"build",
".",
"build",
".",
"run",
"(",
"self",
")"
] | Download, patch and compile SAT solvers before building. | [
"Download",
"patch",
"and",
"compile",
"SAT",
"solvers",
"before",
"building",
"."
] | 522742e8f2d4c6ac50ecd9087f7a346206774c67 | https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/setup.py#L61-L70 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.