repo
stringclasses
12 values
instance_id
stringlengths
18
32
base_commit
stringlengths
40
40
patch
stringlengths
344
252k
test_patch
stringlengths
398
22.9k
problem_statement
stringlengths
119
25.4k
hints_text
stringlengths
1
55.7k
created_at
stringlengths
20
20
version
float64
0.12
2.02k
FAIL_TO_PASS
stringlengths
12
120k
PASS_TO_PASS
stringlengths
2
114k
environment_setup_commit
stringclasses
89 values
scikit-learn/scikit-learn
scikit-learn__scikit-learn-14092
df7dd8391148a873d157328a4f0328528a0c4ed9
diff --git a/sklearn/neighbors/nca.py b/sklearn/neighbors/nca.py --- a/sklearn/neighbors/nca.py +++ b/sklearn/neighbors/nca.py @@ -13,6 +13,7 @@ import numpy as np import sys import time +import numbers from scipy.optimize import minimize from ..utils.extmath import softmax from ..metrics import pairwise_distance...
diff --git a/sklearn/neighbors/tests/test_nca.py b/sklearn/neighbors/tests/test_nca.py --- a/sklearn/neighbors/tests/test_nca.py +++ b/sklearn/neighbors/tests/test_nca.py @@ -129,7 +129,7 @@ def test_params_validation(): # TypeError assert_raises(TypeError, NCA(max_iter='21').fit, X, y) assert_raises(Typ...
NCA fails in GridSearch due to too strict parameter checks NCA checks its parameters to have a specific type, which can easily fail in a GridSearch due to how param grid is made. Here is an example: ```python import numpy as np from sklearn.pipeline import Pipeline from sklearn.model_selection import GridSearchCV fro...
I have developed a framework, experimenting with parameter verification: https://github.com/thomasjpfan/skconfig (Don't expect the API to be stable) Your idea of using a simple dict for union types is really nice! Edit: I am currently trying out another idea. I'll update this issue when it becomes something presentab...
2019-06-14T14:16:17Z
0.22
["sklearn/neighbors/tests/test_nca.py::test_parameters_valid_types[max_iter-value1]", "sklearn/neighbors/tests/test_nca.py::test_parameters_valid_types[n_components-value0]", "sklearn/neighbors/tests/test_nca.py::test_parameters_valid_types[tol-value2]"]
["sklearn/neighbors/tests/test_nca.py::test_auto_init[11-11-11-11]", "sklearn/neighbors/tests/test_nca.py::test_auto_init[11-11-11-3]", "sklearn/neighbors/tests/test_nca.py::test_auto_init[11-11-11-5]", "sklearn/neighbors/tests/test_nca.py::test_auto_init[11-11-11-7]", "sklearn/neighbors/tests/test_nca.py::test_auto_in...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-14114
7b8cbc875b862ebb81a9b3415bdee235cca99ca6
diff --git a/sklearn/ensemble/weight_boosting.py b/sklearn/ensemble/weight_boosting.py --- a/sklearn/ensemble/weight_boosting.py +++ b/sklearn/ensemble/weight_boosting.py @@ -34,6 +34,7 @@ from ..tree import DecisionTreeClassifier, DecisionTreeRegressor from ..utils import check_array, check_random_state, check_X_y...
diff --git a/sklearn/ensemble/tests/test_weight_boosting.py b/sklearn/ensemble/tests/test_weight_boosting.py --- a/sklearn/ensemble/tests/test_weight_boosting.py +++ b/sklearn/ensemble/tests/test_weight_boosting.py @@ -1,6 +1,7 @@ """Testing for the boost module (sklearn.ensemble.boost).""" import numpy as np +impo...
AdaBoost's "SAMME" algorithm uses 'predict' while fitting and 'predict_proba' while predicting probas Subj. This seems to me to be a wrong approach, moreover this drives to such mistakes: <pre> AdaBoostClassifier(algorithm="SAMME", base_estimator=SVC()).fit(trainX, trainY).predict_proba(testX) ------------------------...
(Not an AdaBoost expert) Why is it wrong? How else would you define `predict_proba`? The idea of using only predictions during training and use afterwards probas of base_estimators is strange. The base_estimator can return -0.1 and 0.9 or -0.9 and 0.1. They will have same predictions and different probas - but you d...
2019-06-18T13:20:20Z
0.22
["sklearn/ensemble/tests/test_weight_boosting.py::test_adaboost_consistent_predict[SAMME]"]
["sklearn/ensemble/tests/test_weight_boosting.py::test_adaboost_consistent_predict[SAMME.R]", "sklearn/ensemble/tests/test_weight_boosting.py::test_base_estimator", "sklearn/ensemble/tests/test_weight_boosting.py::test_boston", "sklearn/ensemble/tests/test_weight_boosting.py::test_classification_toy[SAMME.R]", "sklearn...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-14309
f7e082d24ef9f3f9dea14ad82a9a8b2351715f54
diff --git a/sklearn/inspection/partial_dependence.py b/sklearn/inspection/partial_dependence.py --- a/sklearn/inspection/partial_dependence.py +++ b/sklearn/inspection/partial_dependence.py @@ -286,9 +286,15 @@ def partial_dependence(estimator, X, features, response_method='auto', raise ValueError( ...
diff --git a/sklearn/inspection/tests/test_partial_dependence.py b/sklearn/inspection/tests/test_partial_dependence.py --- a/sklearn/inspection/tests/test_partial_dependence.py +++ b/sklearn/inspection/tests/test_partial_dependence.py @@ -21,6 +21,7 @@ from sklearn.linear_model import LinearRegression from sklearn.li...
plot_partial_dependence() fails when used on DecisionTreeRegressor <!-- If your issue is a usage question, submit it here instead: - StackOverflow with the scikit-learn tag: https://stackoverflow.com/questions/tagged/scikit-learn - Mailing List: https://mail.python.org/mailman/listinfo/scikit-learn For more informatio...
null
2019-07-12T13:54:08Z
0.22
["sklearn/inspection/tests/test_partial_dependence.py::test_output_shape[features0-10-DecisionTreeRegressor-brute-data6]", "sklearn/inspection/tests/test_partial_dependence.py::test_output_shape[features0-5-DecisionTreeRegressor-brute-data6]", "sklearn/inspection/tests/test_partial_dependence.py::test_output_shape[feat...
["sklearn/inspection/tests/test_partial_dependence.py::test_grid_from_X", "sklearn/inspection/tests/test_partial_dependence.py::test_grid_from_X_error[1-percentiles6-'grid_resolution'", "sklearn/inspection/tests/test_partial_dependence.py::test_grid_from_X_error[100-12345-'percentiles'", "sklearn/inspection/tests/test_...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-14496
d49a6f13af2f22228d430ac64ac2b518937800d0
diff --git a/sklearn/cluster/optics_.py b/sklearn/cluster/optics_.py --- a/sklearn/cluster/optics_.py +++ b/sklearn/cluster/optics_.py @@ -44,7 +44,7 @@ class OPTICS(BaseEstimator, ClusterMixin): Parameters ---------- - min_samples : int > 1 or float between 0 and 1 (default=None) + min_samples : int ...
diff --git a/sklearn/cluster/tests/test_optics.py b/sklearn/cluster/tests/test_optics.py --- a/sklearn/cluster/tests/test_optics.py +++ b/sklearn/cluster/tests/test_optics.py @@ -101,6 +101,12 @@ def test_extract_xi(): xi=0.4).fit(X) assert_array_equal(clust.labels_, expected_labels) + # c...
[BUG] Optics float min_samples NN instantiation #### Reference Issues/PRs None yet. ``` data = load_some_data() clust = OPTICS(metric='minkowski', n_jobs=-1, min_samples=0.1) clust.fit(data) ``` #### What does this implement/fix? Explain your changes. When passing min_samples as a float to optics l439 & 440 execute ...
thanks for spotting this (1) OPTICS was introduced in 0.21, so we don't need to consider python2. maybe use int(...) directly? (2) please fix similar issues in cluster_optics_xi (3) please update the doc of min_samples in compute_optics_graph (4) please add some tests (5) please add what's new Where shall the what's ne...
2019-07-28T13:47:05Z
0.22
["sklearn/cluster/tests/test_optics.py::test_extract_xi"]
["sklearn/cluster/tests/test_optics.py::test_bad_extract", "sklearn/cluster/tests/test_optics.py::test_bad_reachability", "sklearn/cluster/tests/test_optics.py::test_close_extract", "sklearn/cluster/tests/test_optics.py::test_cluster_hierarchy_", "sklearn/cluster/tests/test_optics.py::test_compare_to_ELKI", "sklearn/cl...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-14890
14f5302b7000e9096de93beef37dcdb08f55f128
diff --git a/sklearn/compose/_target.py b/sklearn/compose/_target.py --- a/sklearn/compose/_target.py +++ b/sklearn/compose/_target.py @@ -148,7 +148,7 @@ def _fit_transformer(self, y): " you are sure you want to proceed regardless" ", set 'check_inverse=Fal...
diff --git a/sklearn/compose/tests/test_target.py b/sklearn/compose/tests/test_target.py --- a/sklearn/compose/tests/test_target.py +++ b/sklearn/compose/tests/test_target.py @@ -14,6 +14,8 @@ from sklearn.preprocessing import FunctionTransformer from sklearn.preprocessing import StandardScaler +from sklearn.pipeli...
Fitting TransformedTargetRegressor with sample_weight in Pipeline #### Description Can't fit a `TransformedTargetRegressor` using `sample_weight`. May be link to #10945 ? #### Steps/Code to Reproduce Example: ```python import pandas as pd import numpy as np from sklearn.pipeline import Pipeline from sklearn.preproce...
This has nothing to do with TransformedTargetRegressor. Pipeline requires you to pass model__sample_weight, not just sample_weight... But the error message is terrible! We should improve it. Thank you for your prompt reply @jnothman ### Second try : ```python clf_trans.fit(X_train[use_col], y_train, m...
2019-09-05T13:19:06Z
0.22
["sklearn/compose/tests/test_target.py::test_transform_target_regressor_pass_fit_parameters", "sklearn/compose/tests/test_target.py::test_transform_target_regressor_route_pipeline"]
["sklearn/compose/tests/test_target.py::test_transform_target_regressor_1d_transformer[X0-y0]", "sklearn/compose/tests/test_target.py::test_transform_target_regressor_1d_transformer[X1-y1]", "sklearn/compose/tests/test_target.py::test_transform_target_regressor_2d_transformer[X0-y0]", "sklearn/compose/tests/test_target...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-15084
5e4b2757d61563889672e395d9e92d9372d357f6
diff --git a/sklearn/ensemble/_stacking.py b/sklearn/ensemble/_stacking.py --- a/sklearn/ensemble/_stacking.py +++ b/sklearn/ensemble/_stacking.py @@ -15,6 +15,7 @@ from ..base import MetaEstimatorMixin from .base import _parallel_fit_estimator +from .base import _BaseHeterogeneousEnsemble from ..linear_model im...
diff --git a/sklearn/ensemble/tests/test_voting.py b/sklearn/ensemble/tests/test_voting.py --- a/sklearn/ensemble/tests/test_voting.py +++ b/sklearn/ensemble/tests/test_voting.py @@ -37,9 +37,9 @@ def test_estimator_init(): eclf = VotingClassifier(estimators=[]) - msg = ('Invalid `estimators` attribute, `est...
VotingClassifier and roc_auc TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe' and #### Description VotingClassifier TypeError: Cannot cast array data from dtype('float64') to dtype('int64') according to the rule 'safe' #### Steps/Code to Reproduce ```python from sk...
`Ridge` and `LinearRegression` are not classifiers, which makes them incompatible with `VotingClassifier`. > Ridge and LinearRegression are not classifiers, which makes them incompatible with VotingClassifier. +1 though maybe we should return a better error message. Shall we check the base estimators with `sklearn.bas...
2019-09-24T17:25:41Z
0.22
["sklearn/ensemble/tests/test_voting.py::test_estimator_init", "sklearn/ensemble/tests/test_voting.py::test_set_estimator_none[None]", "sklearn/ensemble/tests/test_voting.py::test_set_estimator_none[drop]"]
["sklearn/ensemble/tests/test_voting.py::test_check_estimators_voting_estimator[VotingClassifier]", "sklearn/ensemble/tests/test_voting.py::test_check_estimators_voting_estimator[VotingRegressor]", "sklearn/ensemble/tests/test_voting.py::test_estimator_weights_format", "sklearn/ensemble/tests/test_voting.py::test_grids...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-15100
af8a6e592a1a15d92d77011856d5aa0ec4db4c6c
diff --git a/sklearn/feature_extraction/text.py b/sklearn/feature_extraction/text.py --- a/sklearn/feature_extraction/text.py +++ b/sklearn/feature_extraction/text.py @@ -129,10 +129,13 @@ def strip_accents_unicode(s): Remove accentuated char for any unicode symbol that has a direct ASCII equivalent. ...
diff --git a/sklearn/feature_extraction/tests/test_text.py b/sklearn/feature_extraction/tests/test_text.py --- a/sklearn/feature_extraction/tests/test_text.py +++ b/sklearn/feature_extraction/tests/test_text.py @@ -97,6 +97,21 @@ def test_strip_accents(): expected = 'this is a test' assert strip_accents_unico...
strip_accents_unicode fails to strip accents from strings that are already in NFKD form <!-- If your issue is a usage question, submit it here instead: - StackOverflow with the scikit-learn tag: https://stackoverflow.com/questions/tagged/scikit-learn - Mailing List: https://mail.python.org/mailman/listinfo/scikit-learn...
Good catch. Are you able to provide a fix? It looks like we should just remove the `if` branch from `strip_accents_unicode`: ```python def strip_accents_unicode(s): normalized = unicodedata.normalize('NFKD', s) return ''.join([c for c in normalized if not unicodedata.combining(c)]) ``` If that sounds good to ...
2019-09-26T19:21:38Z
0.22
["sklearn/feature_extraction/tests/test_text.py::test_strip_accents"]
["sklearn/feature_extraction/tests/test_text.py::test_callable_analyzer_change_behavior[file-<lambda>0-CountVectorizer]", "sklearn/feature_extraction/tests/test_text.py::test_callable_analyzer_change_behavior[file-<lambda>0-HashingVectorizer]", "sklearn/feature_extraction/tests/test_text.py::test_callable_analyzer_chan...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-15119
4ca6ee4a5068f60fde2a70ed6e9f15bdfc2ce396
diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -876,7 +876,7 @@ def get_feature_names(self): trans.get_feature_names()]) return feature_names - def fit(self, X, y=None): + def fit(self, X, y=None, **fit_pa...
diff --git a/sklearn/tests/test_pipeline.py b/sklearn/tests/test_pipeline.py --- a/sklearn/tests/test_pipeline.py +++ b/sklearn/tests/test_pipeline.py @@ -21,7 +21,7 @@ from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_no_warnings -from sklearn.base import clone, B...
Inconsistent fit + transform and fit_transform for FeatureUnion Is there a reason why the `FeatureUnion` method signature `fit_transform` accepts `fit_args` but neither `fit` nor `transform` do? It seems to go against the pattern that `fit_transform()` is the same as calling `fit().transform()`? https://github.com/sci...
null
2019-10-02T11:43:19Z
0.22
["sklearn/tests/test_pipeline.py::test_feature_union_fit_params"]
["sklearn/tests/test_pipeline.py::test_classes_property", "sklearn/tests/test_pipeline.py::test_feature_union", "sklearn/tests/test_pipeline.py::test_feature_union_feature_names", "sklearn/tests/test_pipeline.py::test_feature_union_parallel", "sklearn/tests/test_pipeline.py::test_feature_union_weights", "sklearn/tests/...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-15512
b8a4da8baa1137f173e7035f104067c7d2ffde22
diff --git a/sklearn/cluster/_affinity_propagation.py b/sklearn/cluster/_affinity_propagation.py --- a/sklearn/cluster/_affinity_propagation.py +++ b/sklearn/cluster/_affinity_propagation.py @@ -194,17 +194,19 @@ def affinity_propagation(S, preference=None, convergence_iter=15, max_iter=200, unconverged = ...
diff --git a/sklearn/cluster/tests/test_affinity_propagation.py b/sklearn/cluster/tests/test_affinity_propagation.py --- a/sklearn/cluster/tests/test_affinity_propagation.py +++ b/sklearn/cluster/tests/test_affinity_propagation.py @@ -152,6 +152,14 @@ def test_affinity_propagation_predict_non_convergence(): assert...
Return values of non converged affinity propagation clustering The affinity propagation Documentation states: "When the algorithm does not converge, it returns an empty array as cluster_center_indices and -1 as label for each training sample." Example: ```python from sklearn.cluster import AffinityPropagation import ...
@JenniferHemmerich this affinity propagation code is not often updated. If you have time to improve its documentation and fix corner cases like the one you report please send us PR. I'll try to find the time to review the changes. thanks Working on this for the wmlds scikit learn sprint (pair programming with @akeshava...
2019-11-02T22:28:57Z
0.22
["sklearn/cluster/tests/test_affinity_propagation.py::test_affinity_propagation_non_convergence_regressiontest"]
["sklearn/cluster/tests/test_affinity_propagation.py::test_affinity_propagation", "sklearn/cluster/tests/test_affinity_propagation.py::test_affinity_propagation_convergence_warning_dense_sparse[centers0]", "sklearn/cluster/tests/test_affinity_propagation.py::test_affinity_propagation_convergence_warning_dense_sparse[ce...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-19664
2620a5545a806ee416d9d10e07c2de30cdd9bf20
diff --git a/sklearn/semi_supervised/_label_propagation.py b/sklearn/semi_supervised/_label_propagation.py --- a/sklearn/semi_supervised/_label_propagation.py +++ b/sklearn/semi_supervised/_label_propagation.py @@ -241,7 +241,7 @@ def fit(self, X, y): Parameters ---------- - X : array-like of...
diff --git a/sklearn/semi_supervised/tests/test_label_propagation.py b/sklearn/semi_supervised/tests/test_label_propagation.py --- a/sklearn/semi_supervised/tests/test_label_propagation.py +++ b/sklearn/semi_supervised/tests/test_label_propagation.py @@ -15,6 +15,9 @@ assert_allclose, assert_array_equal, ) +...
LabelPropagation raises TypeError: A sparse matrix was passed #### Describe the bug LabelPropagation (and LabelSpreading) error out for sparse matrices. #### Steps/Code to Reproduce ``` import sklearn from scipy.sparse import csr_matrix from sklearn.datasets import make_classification from sklearn.semi_supervised im...
Just checked: the fix seems to work for kernel='rbf', too. Hi, I would like to take over since this is stalled. Hi @cozek , sure go ahead: FYI you can comment "take" in this issue and it will automatically assigned to you.
2021-03-11T17:53:04Z
1.3
["sklearn/semi_supervised/tests/test_label_propagation.py::test_convergence_speed[sparse_csc]", "sklearn/semi_supervised/tests/test_label_propagation.py::test_convergence_speed[sparse_csr]", "sklearn/semi_supervised/tests/test_label_propagation.py::test_sparse_input_types[LabelPropagation-parameters0-float32-int32-spar...
["sklearn/semi_supervised/tests/test_label_propagation.py::test_convergence_speed[array]", "sklearn/semi_supervised/tests/test_label_propagation.py::test_convergence_warning", "sklearn/semi_supervised/tests/test_label_propagation.py::test_distribution[float64-LabelPropagation-parameters0]", "sklearn/semi_supervised/tes...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-23099
42d235924efa64987a19e945035c85414c53d4f0
diff --git a/sklearn/gaussian_process/_gpr.py b/sklearn/gaussian_process/_gpr.py --- a/sklearn/gaussian_process/_gpr.py +++ b/sklearn/gaussian_process/_gpr.py @@ -110,6 +110,14 @@ def optimizer(obj_func, initial_theta, bounds): which might cause predictions to change if the data is modified externally...
diff --git a/sklearn/gaussian_process/tests/test_gpr.py b/sklearn/gaussian_process/tests/test_gpr.py --- a/sklearn/gaussian_process/tests/test_gpr.py +++ b/sklearn/gaussian_process/tests/test_gpr.py @@ -773,6 +773,57 @@ def test_sample_y_shapes(normalize_y, n_targets): assert y_samples.shape == y_test_shape +@...
GPR `sample_y` enforce `n_targets=1` before calling `fit` In `GaussianProcessRegressor`, sampling in the prior before calling `fit` via `sample_y` will assume that `y` is made of a single target. However, this is not necessarily the case. Therefore, the shape of the output of `sample_y` before and after `fit` is differ...
I see that we have the same issue with `predict` indeed.
2022-04-10T13:13:15Z
1.3
["sklearn/gaussian_process/tests/test_gpr.py::test_n_targets_error", "sklearn/gaussian_process/tests/test_gpr.py::test_predict_shape_with_prior[1]", "sklearn/gaussian_process/tests/test_gpr.py::test_predict_shape_with_prior[2]", "sklearn/gaussian_process/tests/test_gpr.py::test_predict_shape_with_prior[3]", "sklearn/ga...
["sklearn/gaussian_process/tests/test_gpr.py::test_anisotropic_kernel", "sklearn/gaussian_process/tests/test_gpr.py::test_bound_check_fixed_hyperparameter", "sklearn/gaussian_process/tests/test_gpr.py::test_constant_target[kernel0]", "sklearn/gaussian_process/tests/test_gpr.py::test_constant_target[kernel1]", "sklearn/...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25363
cfd428afc5b6e25bbbe4bc92067f857fa9658442
diff --git a/benchmarks/bench_saga.py b/benchmarks/bench_saga.py --- a/benchmarks/bench_saga.py +++ b/benchmarks/bench_saga.py @@ -7,8 +7,7 @@ import time import os -from joblib import Parallel -from sklearn.utils.fixes import delayed +from sklearn.utils.parallel import delayed, Parallel import matplotlib.pyplot a...
diff --git a/sklearn/decomposition/tests/test_dict_learning.py b/sklearn/decomposition/tests/test_dict_learning.py --- a/sklearn/decomposition/tests/test_dict_learning.py +++ b/sklearn/decomposition/tests/test_dict_learning.py @@ -5,8 +5,6 @@ from functools import partial import itertools -from joblib import Parall...
FIX pass explicit configuration to delayed Working alternative to #25242 closes #25242 closes #25239 This is an alternative to #25242 that does not work if the thread import scikit-learn is different from the thread making the call to `Parallel`. Here, we have an alternative where we pass explicitly the configurati...
Thinking more about it, we could also make this more automatic by subclassing `joblib.Parallel` as `sklearn.fixes.Parallel` to overried the `Parallel.__call__` method to automatically call `sklearn.get_config` there and then rewrap the generator args of `Parallel.__call__` to call `delayed_object.set_config(config)` on...
2023-01-11T16:39:30Z
1.3
["sklearn/decomposition/tests/test_dict_learning.py::test_cd_work_on_joblib_memmapped_data", "sklearn/decomposition/tests/test_dict_learning.py::test_dict_learning_dtype_match[float32-float32-cd]", "sklearn/decomposition/tests/test_dict_learning.py::test_dict_learning_dtype_match[float32-float32-lars]", "sklearn/decomp...
[]
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25500
4db04923a754b6a2defa1b172f55d492b85d165e
diff --git a/sklearn/isotonic.py b/sklearn/isotonic.py --- a/sklearn/isotonic.py +++ b/sklearn/isotonic.py @@ -360,23 +360,16 @@ def fit(self, X, y, sample_weight=None): self._build_f(X, y) return self - def transform(self, T): - """Transform new data by linear interpolation. - - Pa...
diff --git a/sklearn/tests/test_isotonic.py b/sklearn/tests/test_isotonic.py --- a/sklearn/tests/test_isotonic.py +++ b/sklearn/tests/test_isotonic.py @@ -5,6 +5,7 @@ import pytest +import sklearn from sklearn.datasets import make_regression from sklearn.isotonic import ( check_increasing, @@ -680,3 +681,24...
CalibratedClassifierCV doesn't work with `set_config(transform_output="pandas")` ### Describe the bug CalibratedClassifierCV with isotonic regression doesn't work when we previously set `set_config(transform_output="pandas")`. The IsotonicRegression seems to return a dataframe, which is a problem for `_CalibratedClass...
I can reproduce it. We need to investigate but I would expect the inner estimator not being able to handle some dataframe because we expected NumPy arrays before. This could be a bit like https://github.com/scikit-learn/scikit-learn/pull/25370 where things get confused when pandas output is configured. I think the solu...
2023-01-27T19:49:28Z
1.3
["sklearn/tests/test_isotonic.py::test_isotonic_regression_output_predict"]
["sklearn/tests/test_isotonic.py::test_assert_raises_exceptions", "sklearn/tests/test_isotonic.py::test_check_ci_warn", "sklearn/tests/test_isotonic.py::test_check_increasing_down", "sklearn/tests/test_isotonic.py::test_check_increasing_down_extreme", "sklearn/tests/test_isotonic.py::test_check_increasing_small_number_...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25589
53e0d95cb10cba5827751657e487f792afd94329
diff --git a/sklearn/preprocessing/_encoders.py b/sklearn/preprocessing/_encoders.py --- a/sklearn/preprocessing/_encoders.py +++ b/sklearn/preprocessing/_encoders.py @@ -270,6 +270,10 @@ class OneHotEncoder(_BaseEncoder): - array : ``drop[i]`` is the category in feature ``X[:, i]`` that should be d...
diff --git a/sklearn/preprocessing/tests/test_encoders.py b/sklearn/preprocessing/tests/test_encoders.py --- a/sklearn/preprocessing/tests/test_encoders.py +++ b/sklearn/preprocessing/tests/test_encoders.py @@ -929,7 +929,7 @@ def test_ohe_infrequent_two_levels_drop_frequent(drop): max_categories=2, d...
OneHotEncoder `drop_idx_` attribute description in presence of infrequent categories ### Describe the issue linked to the documentation ### Issue summary In the OneHotEncoder documentation both for [v1.2](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html#sklearn.preprocessing....
Thank you for opening the issue! In this case, API-wise I think `drop_idx` is defined incorrectly and should be `1` point to `b`, because it is the categorical that is actually dropped. There seems to be a bigger issue with how `drop_idx` is defined when there are any infrequent categories. I am looking into a fix.
2023-02-10T17:30:04Z
1.3
["sklearn/preprocessing/tests/test_encoders.py::test_drop_idx_infrequent_categories", "sklearn/preprocessing/tests/test_encoders.py::test_ohe_infrequent_two_levels_drop_frequent[drop2]", "sklearn/preprocessing/tests/test_encoders.py::test_ohe_infrequent_two_levels_drop_frequent[first]", "sklearn/preprocessing/tests/tes...
["sklearn/preprocessing/tests/test_encoders.py::test_X_is_not_1D[X0-fit]", "sklearn/preprocessing/tests/test_encoders.py::test_X_is_not_1D[X0-fit_transform]", "sklearn/preprocessing/tests/test_encoders.py::test_X_is_not_1D[X1-fit]", "sklearn/preprocessing/tests/test_encoders.py::test_X_is_not_1D[X1-fit_transform]", "sk...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25601
c991e30c96ace1565604b429de22e36ed6b1e7bd
diff --git a/sklearn/ensemble/_forest.py b/sklearn/ensemble/_forest.py --- a/sklearn/ensemble/_forest.py +++ b/sklearn/ensemble/_forest.py @@ -117,7 +117,7 @@ def _get_n_samples_bootstrap(n_samples, max_samples): return max_samples if isinstance(max_samples, Real): - return round(n_samples * max_...
diff --git a/sklearn/ensemble/tests/test_forest.py b/sklearn/ensemble/tests/test_forest.py --- a/sklearn/ensemble/tests/test_forest.py +++ b/sklearn/ensemble/tests/test_forest.py @@ -1807,3 +1807,16 @@ def test_read_only_buffer(monkeypatch): clf = RandomForestClassifier(n_jobs=2, random_state=rng) cross_val...
RandomForestClassifier class_weight/max_samples interaction can lead to ungraceful and nondescriptive failure ### Describe the bug The acceptable values for `max_samples` are `(0, 1]`. One possible option for `class_weight` is `balanced_subsample`. However, for values of `max_samples` near zero and `class_weight='bala...
We should probably add a check before launching the actual `fit` to be sure that the condition is met to do so. A nice error message is indeed what we need here. @swight-prc are you interested to submit a bugfix and add your snippet of code as a non-regression test? > @swight-prc are you interested to submit a bugfix ...
2023-02-13T21:42:21Z
1.3
["sklearn/ensemble/tests/test_forest.py::test_round_samples_to_one_when_samples_too_low[balanced_subsample]"]
["sklearn/ensemble/tests/test_forest.py::test_1d_input[ExtraTreesClassifier]", "sklearn/ensemble/tests/test_forest.py::test_1d_input[ExtraTreesRegressor]", "sklearn/ensemble/tests/test_forest.py::test_1d_input[RandomForestClassifier]", "sklearn/ensemble/tests/test_forest.py::test_1d_input[RandomForestRegressor]", "skle...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25697
097c3683a73c5805a84e6eada71e4928cb35496e
diff --git a/sklearn/linear_model/_bayes.py b/sklearn/linear_model/_bayes.py --- a/sklearn/linear_model/_bayes.py +++ b/sklearn/linear_model/_bayes.py @@ -5,6 +5,7 @@ # Authors: V. Michel, F. Pedregosa, A. Gramfort # License: BSD 3 clause +import warnings from math import log from numbers import Integral, Real i...
diff --git a/sklearn/linear_model/tests/test_bayes.py b/sklearn/linear_model/tests/test_bayes.py --- a/sklearn/linear_model/tests/test_bayes.py +++ b/sklearn/linear_model/tests/test_bayes.py @@ -73,7 +73,7 @@ def test_bayesian_ridge_score_values(): alpha_2=alpha_2, lambda_1=lambda_1, lambda_2...
Deprecate `n_iter` in favor of `max_iter` for consistency `BayesianRidge` and `ARDRegression` are exposing the parameter `n_iter` instead of `max_iter` as in other models. I think that we should deprecate `n_iter` and rename it `max_iter` to be consistent.
@glemaitre I would like to attempt this one ! @saucam please go ahead and propose a pull-request. You can refer to the following documentation page to follow our deprecation rule: https://scikit-learn.org/dev/developers/contributing.html#deprecation @saucam ,let me know incase you need help. We can work together on thi...
2023-02-24T21:43:48Z
1.3
["sklearn/linear_model/tests/test_bayes.py::test_bayesian_ridge_ard_max_iter_and_n_iter_both_set[ARDRegression]", "sklearn/linear_model/tests/test_bayes.py::test_bayesian_ridge_ard_max_iter_and_n_iter_both_set[BayesianRidge]", "sklearn/linear_model/tests/test_bayes.py::test_bayesian_ridge_ard_n_iter_deprecated[ARDRegre...
["sklearn/linear_model/tests/test_bayes.py::test_ard_accuracy_on_easy_problem[42-10-100]", "sklearn/linear_model/tests/test_bayes.py::test_ard_accuracy_on_easy_problem[42-100-10]", "sklearn/linear_model/tests/test_bayes.py::test_bayesian_initial_params", "sklearn/linear_model/tests/test_bayes.py::test_bayesian_ridge_pa...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25744
2c867b8f822eb7a684f0d5c4359e4426e1c9cfe0
diff --git a/sklearn/tree/_classes.py b/sklearn/tree/_classes.py --- a/sklearn/tree/_classes.py +++ b/sklearn/tree/_classes.py @@ -99,16 +99,16 @@ class BaseDecisionTree(MultiOutputMixin, BaseEstimator, metaclass=ABCMeta): "max_depth": [Interval(Integral, 1, None, closed="left"), None], "min_samples_s...
diff --git a/sklearn/tree/tests/test_tree.py b/sklearn/tree/tests/test_tree.py --- a/sklearn/tree/tests/test_tree.py +++ b/sklearn/tree/tests/test_tree.py @@ -2425,3 +2425,25 @@ def test_tree_deserialization_from_read_only_buffer(tmpdir): clf.tree_, "The trees of the original and loaded classifiers ar...
Setting min_samples_split=1 in DecisionTreeClassifier does not raise exception ### Describe the bug If `min_samples_split` is set to 1, an exception should be raised according to the paramter's constraints: https://github.com/scikit-learn/scikit-learn/blob/e2e705021eb6c9f23f0972f119b56e37cd7567ef/sklearn/tree/_classe...
I think that this is on purpose. Otherwise, we would have used `closed="neither"` for the `Real` case and `1` is qualified as a `Real`. At least this is not a regression since the code in the past would have failed and now we allow it to be considered as 100% of the train set. If we exclude `1` it means that we don't...
2023-03-02T17:04:42Z
1.3
["sklearn/tree/tests/test_tree.py::test_min_sample_split_1_error[DecisionTreeClassifier]", "sklearn/tree/tests/test_tree.py::test_min_sample_split_1_error[DecisionTreeRegressor]", "sklearn/tree/tests/test_tree.py::test_min_sample_split_1_error[ExtraTreeClassifier]", "sklearn/tree/tests/test_tree.py::test_min_sample_spl...
["sklearn/tree/tests/test_tree.py::test_1d_input[DecisionTreeClassifier]", "sklearn/tree/tests/test_tree.py::test_1d_input[DecisionTreeRegressor]", "sklearn/tree/tests/test_tree.py::test_1d_input[ExtraTreeClassifier]", "sklearn/tree/tests/test_tree.py::test_1d_input[ExtraTreeRegressor]", "sklearn/tree/tests/test_tree.p...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25747
2c867b8f822eb7a684f0d5c4359e4426e1c9cfe0
diff --git a/sklearn/utils/_set_output.py b/sklearn/utils/_set_output.py --- a/sklearn/utils/_set_output.py +++ b/sklearn/utils/_set_output.py @@ -34,7 +34,7 @@ def _wrap_in_pandas_container( `range(n_features)`. index : array-like, default=None - Index for data. + Index for data. `index` ...
diff --git a/sklearn/utils/tests/test_set_output.py b/sklearn/utils/tests/test_set_output.py --- a/sklearn/utils/tests/test_set_output.py +++ b/sklearn/utils/tests/test_set_output.py @@ -33,7 +33,9 @@ def test__wrap_in_pandas_container_dense_update_columns_and_index(): new_df = _wrap_in_pandas_container(X_df, co...
FeatureUnion not working when aggregating data and pandas transform output selected ### Describe the bug I would like to use `pandas` transform output and use a custom transformer in a feature union which aggregates data. When I'm using this combination I got an error. When I use default `numpy` output it works fine. ...
As noted in the [glossery](https://scikit-learn.org/dev/glossary.html#term-transform), Scikit-learn transformers expects that `transform`'s output have the same number of samples as the input. This exception is held in `FeatureUnion` when processing data and tries to make sure that the output index is the same as the i...
2023-03-02T20:38:47Z
1.3
["sklearn/utils/tests/test_set_output.py::test_set_output_pandas_keep_index"]
["sklearn/utils/tests/test_set_output.py::test__get_output_config", "sklearn/utils/tests/test_set_output.py::test__safe_set_output", "sklearn/utils/tests/test_set_output.py::test__safe_set_output_error", "sklearn/utils/tests/test_set_output.py::test__wrap_in_pandas_container_column_errors", "sklearn/utils/tests/test_se...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25752
b397b8f2d952a26344cc062ff912c663f4afa6d5
diff --git a/sklearn/cluster/_bicluster.py b/sklearn/cluster/_bicluster.py --- a/sklearn/cluster/_bicluster.py +++ b/sklearn/cluster/_bicluster.py @@ -487,7 +487,7 @@ class SpectralBiclustering(BaseSpectral): >>> clustering.row_labels_ array([1, 1, 1, 0, 0, 0], dtype=int32) >>> clustering.column_labels_ ...
diff --git a/sklearn/cluster/tests/test_bisect_k_means.py b/sklearn/cluster/tests/test_bisect_k_means.py --- a/sklearn/cluster/tests/test_bisect_k_means.py +++ b/sklearn/cluster/tests/test_bisect_k_means.py @@ -4,34 +4,33 @@ from sklearn.utils._testing import assert_array_equal, assert_allclose from sklearn.cluster...
KMeans initialization does not use sample weights ### Describe the bug Clustering by KMeans does not weight the input data. ### Steps/Code to Reproduce ```py import numpy as np from sklearn.cluster import KMeans x = np.array([1, 1, 5, 5, 100, 100]) w = 10**np.array([8.,8,8,8,-8,-8]) # large weights for 1 and 5, smal...
Thanks for the reproducible example. `KMeans` **does** weight the data, but your example is an extreme case. Because `Kmeans` is a non-convex problem, the algorithm can get stuck in a local minimum, and not find the true minimum of the optimization landscape. This is the reason why the code proposes to use multiple i...
2023-03-03T09:07:31Z
1.3
["sklearn/cluster/tests/test_k_means.py::test_sample_weight_init[42-k-means++]", "sklearn/cluster/tests/test_k_means.py::test_sample_weight_init[42-random]", "sklearn/cluster/tests/test_k_means.py::test_sample_weight_zero[42-k-means++]", "sklearn/cluster/tests/test_k_means.py::test_sample_weight_zero[42-random]"]
["sklearn/cluster/tests/test_bisect_k_means.py::test_dtype_preserved[float64-False]", "sklearn/cluster/tests/test_bisect_k_means.py::test_dtype_preserved[float64-True]", "sklearn/cluster/tests/test_bisect_k_means.py::test_fit_predict[False]", "sklearn/cluster/tests/test_bisect_k_means.py::test_fit_predict[True]", "skle...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-25805
67ea7206bc052eb752f7881eb6043a00fe27c800
diff --git a/sklearn/calibration.py b/sklearn/calibration.py --- a/sklearn/calibration.py +++ b/sklearn/calibration.py @@ -308,9 +308,6 @@ def fit(self, X, y, sample_weight=None, **fit_params): if sample_weight is not None: sample_weight = _check_sample_weight(sample_weight, X) - for samp...
diff --git a/sklearn/tests/test_calibration.py b/sklearn/tests/test_calibration.py --- a/sklearn/tests/test_calibration.py +++ b/sklearn/tests/test_calibration.py @@ -974,23 +974,6 @@ def fit(self, X, y, **fit_params): pc_clf.fit(X, y, sample_weight=sample_weight) -def test_calibration_with_fit_params_inco...
CalibratedClassifierCV fails on lgbm fit_params Hi, I'm trying to use CalibratedClassifierCV to calibrate the probabilities from a LGBM model. The issue is that when I try CalibratedClassifierCV with eval_set, I get an error ValueError: Found input variables with inconsistent numbers of samples: [43364, 1] which is ca...
Once we have metadata routing with would have an explicit way to tell how to broadcast such parameters to the base estimators. However as far as I know, the current state of SLEP6 does not have a way to tell whether or not we want to apply cross-validation indexing and therefore disable the length consistency check for...
2023-03-10T12:37:03Z
1.3
["sklearn/tests/test_calibration.py::test_calibration_with_non_sample_aligned_fit_param"]
["sklearn/tests/test_calibration.py::test_calibrated_classifier_cv_double_sample_weights_equivalence[False-isotonic]", "sklearn/tests/test_calibration.py::test_calibrated_classifier_cv_double_sample_weights_equivalence[False-sigmoid]", "sklearn/tests/test_calibration.py::test_calibrated_classifier_cv_double_sample_weig...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-26242
b747bacfa1d706bf3c52680566590bfaf0d74363
diff --git a/sklearn/ensemble/_base.py b/sklearn/ensemble/_base.py --- a/sklearn/ensemble/_base.py +++ b/sklearn/ensemble/_base.py @@ -157,7 +157,7 @@ def _validate_estimator(self, default=None): if self.estimator is not None: self.estimator_ = self.estimator - elif self.base_estimator no...
diff --git a/sklearn/ensemble/tests/test_weight_boosting.py b/sklearn/ensemble/tests/test_weight_boosting.py --- a/sklearn/ensemble/tests/test_weight_boosting.py +++ b/sklearn/ensemble/tests/test_weight_boosting.py @@ -613,6 +613,27 @@ def test_base_estimator_argument_deprecated(AdaBoost, Estimator): model.fit...
AdaBoost: deprecation of "base_estimator" does not handle "base_estimator=None" setting properly ### Describe the bug Scikit-learn 1.2 deprecated `AdaBoostClassifier` 's `base_estimator` in favour of `estimator` (see #23819). Because there are also validators in place, old code that explicitly defined `base_estimator=...
null
2023-04-21T12:20:43Z
1.3
["sklearn/ensemble/tests/test_weight_boosting.py::test_base_estimator_argument_deprecated_none[AdaBoostClassifier]", "sklearn/ensemble/tests/test_weight_boosting.py::test_base_estimator_argument_deprecated_none[AdaBoostRegressor]"]
["sklearn/ensemble/tests/test_weight_boosting.py::test_adaboost_classifier_sample_weight_error", "sklearn/ensemble/tests/test_weight_boosting.py::test_adaboost_consistent_predict[SAMME.R]", "sklearn/ensemble/tests/test_weight_boosting.py::test_adaboost_consistent_predict[SAMME]", "sklearn/ensemble/tests/test_weight_boo...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-26400
1e8a5b833d1b58f3ab84099c4582239af854b23a
diff --git a/sklearn/preprocessing/_data.py b/sklearn/preprocessing/_data.py --- a/sklearn/preprocessing/_data.py +++ b/sklearn/preprocessing/_data.py @@ -3311,9 +3311,13 @@ def _box_cox_optimize(self, x): We here use scipy builtins which uses the brent optimizer. """ + mask = np.isnan(x) + ...
diff --git a/sklearn/preprocessing/tests/test_data.py b/sklearn/preprocessing/tests/test_data.py --- a/sklearn/preprocessing/tests/test_data.py +++ b/sklearn/preprocessing/tests/test_data.py @@ -2527,6 +2527,21 @@ def test_power_transformer_copy_False(method, standardize): assert X_trans is X_inv_trans +def te...
PowerTransformer fails with unhelpful stack trace with all-nan feature and method='box-cox' ### Describe the bug `PowerTransformer("box-cox").fit(x)` throws a difficult-to-debug error if x contains an all-nan column. ### Steps/Code to Reproduce ```python import pandas as pd import numpy as np from sklearn.preproce...
Thank you for opening the issue. I agree this is a bug. It is reasonable to return all nans to be consistent with `yeo-johnson`. Would the following approach be neat enough? ```python def _box_cox_optimize(self, x):     # The computation of lambda is influenced by NaNs so we need to     # get rid of them     x = x[~np...
2023-05-19T00:35:48Z
1.3
["sklearn/preprocessing/tests/test_data.py::test_power_transformer_box_cox_raise_all_nans_col"]
["sklearn/preprocessing/tests/test_data.py::test_add_dummy_feature", "sklearn/preprocessing/tests/test_data.py::test_add_dummy_feature_coo", "sklearn/preprocessing/tests/test_data.py::test_add_dummy_feature_csc", "sklearn/preprocessing/tests/test_data.py::test_add_dummy_feature_csr", "sklearn/preprocessing/tests/test_d...
1e8a5b833d1b58f3ab84099c4582239af854b23a
scikit-learn/scikit-learn
scikit-learn__scikit-learn-3840
6b5440a9964480ccb0fe1b59ab516d9228186571
diff --git a/sklearn/metrics/ranking.py b/sklearn/metrics/ranking.py --- a/sklearn/metrics/ranking.py +++ b/sklearn/metrics/ranking.py @@ -217,7 +217,8 @@ def _binary_uninterpolated_average_precision( sample_weight=sample_weight) -def roc_auc_score(y_true, y_score, average="macro",...
diff --git a/sklearn/metrics/tests/test_common.py b/sklearn/metrics/tests/test_common.py --- a/sklearn/metrics/tests/test_common.py +++ b/sklearn/metrics/tests/test_common.py @@ -163,6 +163,7 @@ "samples_roc_auc": partial(roc_auc_score, average="samples"), "micro_roc_auc": partial(roc_auc_score, average="micr...
partial AUC I suggest adding partial AUC to the metrics. this would compute the area under the curve up to a specified FPR (in the case of the ROC curve). this measure is important for comparing classifiers in cases where FPR is much more important than TPR. The partial AUC should also allow applying the McClish correc...
+1 +1 @arjoly @mblondel is anyone working on this right now? Hi, I'd like to help. @arjoly @mblondel @MechCoder , may I take this one? Only if it is ok for you @MechCoder . You can take this one. :-) sure :) Ok! I'll try my best. :) @eyaler In this pROC package, it is possible to choose between "specificity"...
2014-11-07T23:15:42Z
0.2
["sklearn/metrics/tests/test_common.py::test_inf_nan_input", "sklearn/metrics/tests/test_common.py::test_invariance_string_vs_numbers_labels", "sklearn/metrics/tests/test_common.py::test_sample_order_invariance_multilabel_and_multioutput", "sklearn/metrics/tests/test_ranking.py::test_partial_roc_auc_score"]
["sklearn/metrics/tests/test_common.py::test_format_invariance_with_1d_vectors", "sklearn/metrics/tests/test_common.py::test_multilabel_representation_invariance", "sklearn/metrics/tests/test_common.py::test_multioutput_number_of_output_differ", "sklearn/metrics/tests/test_common.py::test_multioutput_regression_invaria...
55bf5d93e5674f13a1134d93a11fd0cd11aabcd1
scikit-learn/scikit-learn
scikit-learn__scikit-learn-9274
faa940608befaeca99db501609c6db796739f30f
diff --git a/sklearn/neural_network/multilayer_perceptron.py b/sklearn/neural_network/multilayer_perceptron.py --- a/sklearn/neural_network/multilayer_perceptron.py +++ b/sklearn/neural_network/multilayer_perceptron.py @@ -51,7 +51,7 @@ def __init__(self, hidden_layer_sizes, activation, solver, max_it...
diff --git a/sklearn/neural_network/tests/test_mlp.py b/sklearn/neural_network/tests/test_mlp.py --- a/sklearn/neural_network/tests/test_mlp.py +++ b/sklearn/neural_network/tests/test_mlp.py @@ -48,6 +48,8 @@ Xboston = StandardScaler().fit_transform(boston.data)[: 200] yboston = boston.target[:200] +regression_data...
Training MLP using l-bfgs limited to default l-bfgs maxiter value #### Description Training an MLP regressor (or classifier) using l-bfgs currently cannot run for more than (approx) 15000 iterations. This artificial limit is caused by the call site to l-bfgs passing the MLP argument value "max_iters" to the argument f...
2017-07-03T22:39:22Z
0.22
["sklearn/neural_network/tests/test_mlp.py::test_lbfgs_classification_maxfun[X0-y0]", "sklearn/neural_network/tests/test_mlp.py::test_lbfgs_classification_maxfun[X1-y1]", "sklearn/neural_network/tests/test_mlp.py::test_lbfgs_regression_maxfun[X0-y0]"]
["sklearn/neural_network/tests/test_mlp.py::test_adaptive_learning_rate", "sklearn/neural_network/tests/test_mlp.py::test_alpha", "sklearn/neural_network/tests/test_mlp.py::test_early_stopping", "sklearn/neural_network/tests/test_mlp.py::test_early_stopping_stratified", "sklearn/neural_network/tests/test_mlp.py::test_f...
7e85a6d1f038bbb932b36f18d75df6be937ed00d
scikit-learn/scikit-learn
scikit-learn__scikit-learn-9775
5815bd58667da900814d8780d2a5ebfb976c08b1
diff --git a/sklearn/manifold/t_sne.py b/sklearn/manifold/t_sne.py --- a/sklearn/manifold/t_sne.py +++ b/sklearn/manifold/t_sne.py @@ -9,6 +9,7 @@ # http://cseweb.ucsd.edu/~lvdmaaten/workshops/nips2010/papers/vandermaaten.pdf from __future__ import division +import warnings from time import time import numpy as...
diff --git a/sklearn/manifold/tests/test_t_sne.py b/sklearn/manifold/tests/test_t_sne.py --- a/sklearn/manifold/tests/test_t_sne.py +++ b/sklearn/manifold/tests/test_t_sne.py @@ -14,6 +14,8 @@ from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_raises_regexp from sklearn.utils.t...
sklearn.manifold.t_sne.trustworthiness should allow custom metric `precomputed` boolean parameter should be replaced by more standard `metric='precomputed'`.
Hi ! I'm a first time contributor, i will work on this one Thanks. On 13 September 2017 at 20:07, wdevazelhes <notifications@github.com> wrote: > Hi ! I'm a first time contributor, i will work on this one > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub...
2017-09-15T08:31:41Z
0.2
["sklearn/manifold/tests/test_t_sne.py::test_preserve_trustworthiness_approximately_with_precomputed_distances", "sklearn/manifold/tests/test_t_sne.py::test_trustworthiness_not_euclidean_metric", "sklearn/manifold/tests/test_t_sne.py::test_trustworthiness_precomputed_deprecation"]
["sklearn/manifold/tests/test_t_sne.py::test_64bit", "sklearn/manifold/tests/test_t_sne.py::test_accessible_kl_divergence", "sklearn/manifold/tests/test_t_sne.py::test_angle_out_of_range_checks", "sklearn/manifold/tests/test_t_sne.py::test_answer_gradient_four_points", "sklearn/manifold/tests/test_t_sne.py::test_answer...
55bf5d93e5674f13a1134d93a11fd0cd11aabcd1
scikit-learn/scikit-learn
scikit-learn__scikit-learn-9939
f247ad5adfe86b2ee64a4a3db1b496c8bf1c9dff
diff --git a/sklearn/linear_model/logistic.py b/sklearn/linear_model/logistic.py --- a/sklearn/linear_model/logistic.py +++ b/sklearn/linear_model/logistic.py @@ -1101,14 +1101,18 @@ class LogisticRegression(BaseEstimator, LinearClassifierMixin, coef_ : array, shape (1, n_features) or (n_classes, n_features) ...
diff --git a/sklearn/linear_model/tests/test_logistic.py b/sklearn/linear_model/tests/test_logistic.py --- a/sklearn/linear_model/tests/test_logistic.py +++ b/sklearn/linear_model/tests/test_logistic.py @@ -198,6 +198,23 @@ def test_multinomial_binary(): assert_greater(np.mean(pred == target), .9) +def tes...
Incorrect predictions when fitting a LogisticRegression model on binary outcomes with `multi_class='multinomial'`. #### Description Incorrect predictions when fitting a LogisticRegression model on binary outcomes with `multi_class='multinomial'`. <!-- Example: Joblib Error thrown when calling fit on LatentDirichletAllo...
Yes, just taking the coef for one class indeed seems incorrect. Is there any way to adjust the coef of one class (and the intercept) given the other to get the right probabilities? > This is essentially a difference between softmax (redundancy allowed) and logistic regression. Indeed, there is a difference in the way...
2017-10-17T10:52:38Z
0.2
["sklearn/linear_model/tests/test_logistic.py::test_multinomial_binary_probabilities"]
["sklearn/linear_model/tests/test_logistic.py::test_check_solver_option", "sklearn/linear_model/tests/test_logistic.py::test_consistency_path", "sklearn/linear_model/tests/test_logistic.py::test_dtype_match", "sklearn/linear_model/tests/test_logistic.py::test_error", "sklearn/linear_model/tests/test_logistic.py::test_i...
55bf5d93e5674f13a1134d93a11fd0cd11aabcd1
sphinx-doc/sphinx
sphinx-doc__sphinx-10067
e1fa6c79be8b3928c21e312a0c0e65e1cfd9a7f7
diff --git a/sphinx/application.py b/sphinx/application.py --- a/sphinx/application.py +++ b/sphinx/application.py @@ -266,7 +266,7 @@ def _init_i18n(self) -> None: """Load translated strings from the configured localedirs if enabled in the configuration. """ - if self.config.language ...
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -528,7 +528,7 @@ def test_babel_with_no_language_settings(app, status, warning): assert '\\usepackage[Bjarne]{fncychap}' in result assert ('\\addto\\captionsenglish{\\renewcomm...
To improve accessibility, set language in conf.py using sphinx-quickstart **Is your feature request related to a problem? Please describe.** By default, Sphinx documentation does not include the language, for example in `docs/conf.py` `language = 'en'` result in built web pages: `<html lang="en">` This leads to the f...
null
2022-01-08T17:42:55Z
5
["tests/test_build_latex.py::test_babel_with_no_language_settings"]
["tests/test_build_latex.py::test_babel_with_language_de", "tests/test_build_latex.py::test_babel_with_language_ja", "tests/test_build_latex.py::test_babel_with_language_ru", "tests/test_build_latex.py::test_babel_with_language_tr", "tests/test_build_latex.py::test_babel_with_unknown_language", "tests/test_build_latex....
60775ec4c4ea08509eee4b564cbf90f316021aff
sphinx-doc/sphinx
sphinx-doc__sphinx-10321
4689ec6de1241077552458ed38927c0e713bb85d
diff --git a/sphinx/ext/autodoc/preserve_defaults.py b/sphinx/ext/autodoc/preserve_defaults.py --- a/sphinx/ext/autodoc/preserve_defaults.py +++ b/sphinx/ext/autodoc/preserve_defaults.py @@ -79,7 +79,11 @@ def update_defvalue(app: Sphinx, obj: Any, bound_method: bool) -> None: kw_defaults = list(function.a...
diff --git a/tests/roots/test-ext-autodoc/target/preserve_defaults.py b/tests/roots/test-ext-autodoc/target/preserve_defaults.py --- a/tests/roots/test-ext-autodoc/target/preserve_defaults.py +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults.py @@ -8,7 +8,10 @@ def foo(name: str = CONSTANT, sentinel...
autodoc_preserve_defaults=True does not work for mixture of keyword only arguments with/without defaults ### Describe the bug If I understand [PEP 0570](https://peps.python.org/pep-0570/) correctly, the following is a valid signature of a class method: ``` class Thing: def __init__( self, ...
null
2022-04-02T07:57:50Z
5
["tests/test_ext_autodoc_preserve_defaults.py::test_preserve_defaults"]
[]
60775ec4c4ea08509eee4b564cbf90f316021aff
sphinx-doc/sphinx
sphinx-doc__sphinx-10449
36367765fe780f962bba861bf368a765380bbc68
diff --git a/sphinx/ext/autodoc/typehints.py b/sphinx/ext/autodoc/typehints.py --- a/sphinx/ext/autodoc/typehints.py +++ b/sphinx/ext/autodoc/typehints.py @@ -59,7 +59,10 @@ def merge_typehints(app: Sphinx, domain: str, objtype: str, contentnode: Element for field_list in field_lists: if app.con...
diff --git a/tests/test_ext_autodoc_configs.py b/tests/test_ext_autodoc_configs.py --- a/tests/test_ext_autodoc_configs.py +++ b/tests/test_ext_autodoc_configs.py @@ -1041,9 +1041,6 @@ def test_autodoc_typehints_description_with_documented_init(app): ' Parameters:\n' ' **x** (*int*) --\...
`autodoc_typehints = "description"` causes autoclass to put a return type ### Describe the bug Using the `autodoc_typehints = "description"` option causes Sphinx's `autoclass` to include the class's "return type" for code such as this: ```py class Square: """A class representing a square figure.""" def __init...
Confirmed also on Python 3.10, Sphinx 4.4.0.
2022-05-14T14:02:26Z
5.1
["tests/test_ext_autodoc_configs.py::test_autodoc_typehints_description_with_documented_init"]
["tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_both", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_init", "tests/test_ext_autodoc_configs.py::test_autocla...
571b55328d401a6e1d50e37407df56586065a7be
sphinx-doc/sphinx
sphinx-doc__sphinx-10451
195e911f1dab04b8ddeacbe04b7d214aaf81bb0b
diff --git a/sphinx/ext/autodoc/typehints.py b/sphinx/ext/autodoc/typehints.py --- a/sphinx/ext/autodoc/typehints.py +++ b/sphinx/ext/autodoc/typehints.py @@ -115,7 +115,15 @@ def modify_field_list(node: nodes.field_list, annotations: Dict[str, str], if name == 'return': continue - arg = ...
diff --git a/tests/roots/test-ext-autodoc/target/typehints.py b/tests/roots/test-ext-autodoc/target/typehints.py --- a/tests/roots/test-ext-autodoc/target/typehints.py +++ b/tests/roots/test-ext-autodoc/target/typehints.py @@ -94,8 +94,10 @@ def missing_attr(c, class _ClassWithDocumentedInit: """Class docstring."...
Fix duplicated *args and **kwargs with autodoc_typehints Fix duplicated *args and **kwargs with autodoc_typehints ### Bugfix - Bugfix ### Detail Consider this ```python class _ClassWithDocumentedInitAndStarArgs: """Class docstring.""" def __init__(self, x: int, *args: int, **kwargs: int) -> None: """...
I noticed this docstring causes warnings because `*` and `**` are considered as mark-up symbols: ``` def __init__(self, x: int, *args: int, **kwargs: int) -> None: """Init docstring. :param x: Some integer :param *args: Some integer :param **kwargs: Some integer """ ``` He...
2022-05-15T11:49:39Z
5.1
["tests/test_ext_napoleon_docstring.py::test_napoleon_and_autodoc_typehints_description_all", "tests/test_ext_napoleon_docstring.py::test_napoleon_and_autodoc_typehints_description_documented_params"]
["tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_both", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_init", "tests/test_ext_autodoc_configs.py::test_autocla...
571b55328d401a6e1d50e37407df56586065a7be
sphinx-doc/sphinx
sphinx-doc__sphinx-10481
004012b6df0fcec67312373f8d89327f5b09a7e6
diff --git a/sphinx/config.py b/sphinx/config.py --- a/sphinx/config.py +++ b/sphinx/config.py @@ -163,6 +163,17 @@ def read(cls, confdir: str, overrides: Dict = None, tags: Tags = None) -> "Confi raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") % ...
diff --git a/tests/test_config.py b/tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -381,3 +381,49 @@ def test_nitpick_ignore_regex_fullmatch(app, status, warning): assert len(warning) == len(nitpick_warnings) for actual, expected in zip(warning, nitpick_warnings): asser...
If a project defines "language = None" in conf.py, treat it like "en" Hello, I started working on integrating Sphinx 5 to Fedora to ensure distribution packages work smoothly when the final is out. I ran across is a side effect of the change inspired by #10062. If a project has already "language = None" defined in the...
null
2022-05-27T22:54:01Z
5
["tests/test_config.py::test_conf_py_language_none", "tests/test_config.py::test_conf_py_language_none_warning"]
["tests/test_config.py::test_builtin_conf", "tests/test_config.py::test_check_enum", "tests/test_config.py::test_check_enum_failed", "tests/test_config.py::test_check_enum_for_list", "tests/test_config.py::test_check_enum_for_list_failed", "tests/test_config.py::test_check_types[value1-string-None-123-True]", "tests/te...
60775ec4c4ea08509eee4b564cbf90f316021aff
sphinx-doc/sphinx
sphinx-doc__sphinx-10819
276f430b57957771f23355a6a1eb10a55899a677
diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py --- a/sphinx/search/__init__.py +++ b/sphinx/search/__init__.py @@ -14,6 +14,7 @@ from sphinx import addnodes, package_dir from sphinx.deprecation import RemovedInSphinx70Warning from sphinx.environment import BuildEnvironment +from sphinx.util impor...
diff --git a/tests/test_search.py b/tests/test_search.py --- a/tests/test_search.py +++ b/tests/test_search.py @@ -178,7 +178,8 @@ def test_IndexBuilder(): 'test': [0, 1, 2, 3]}, 'titles': ('title1_1', 'title1_2', 'title2_1', 'title2_2'), 'titleterms': {'section_titl': [0, 1, 2, 3]}...
Use the index directive as a source for search **Is your feature request related to a problem? Please describe.** My problem is the search engine is not good at finding terms that are indexed, for example: - https://docs.python.org/3/search.html?q=for should find https://docs.python.org/3/reference/compound_stmts.html...
A non-python example, searching for `ciphertext` in [pyca/cryptography](https://github.com/pyca/cryptography), the glossary `ciphertext` term is pretty low on the page and hidden among mentions of it within autodoc pages. There's also a bpo issue on that subject: https://bugs.python.org/issue42106 It provides more exa...
2022-09-12T21:47:01Z
5.2
["tests/test_search.py::test_IndexBuilder"]
["tests/test_search.py::test_IndexBuilder_lookup", "tests/test_search.py::test_meta_keys_are_handled_for_language_de", "tests/test_search.py::test_meta_keys_are_handled_for_language_en", "tests/test_search.py::test_nosearch", "tests/test_search.py::test_objects_are_escaped", "tests/test_search.py::test_search_index_gen...
a651e6bf4ad7a1dc293525d0a70e6d0d11b827db
sphinx-doc/sphinx
sphinx-doc__sphinx-11312
5cf3dce36ec35c429724bf1312ece9faa0c8db39
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -350,38 +350,64 @@ def safe_getattr(obj: Any, name: str, *defargs: Any) -> Any: raise AttributeError(name) from exc -def object_description(object: Any) -> str: - """A repr() impleme...
diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py --- a/tests/test_util_inspect.py +++ b/tests/test_util_inspect.py @@ -503,10 +503,32 @@ def test_set_sorting(): assert description == "{'a', 'b', 'c', 'd', 'e', 'f', 'g'}" +def test_set_sorting_enum(): + class MyEnum(enum.Enum): + a...
util.inspect.object_description: does not emit reliable ordering for a set nested within another collection ### Describe the bug ### Summary Differences appear in some `sphinx` v5.3.0 generated `set` object descriptions for `alembic` v1.8.1, as demonstrated by [recent results visible on the Reproducible Builds diffosc...
null
2023-04-10T15:35:57Z
7.2
["tests/test_util_inspect.py::test_deterministic_nested_collection_descriptions", "tests/test_util_inspect.py::test_nested_tuple_sorting", "tests/test_util_inspect.py::test_recursive_collection_description", "tests/test_util_inspect.py::test_set_sorting_enum"]
["tests/test_util_inspect.py::test_TypeAliasForwardRef", "tests/test_util_inspect.py::test_TypeAliasNamespace", "tests/test_util_inspect.py::test_dict_customtype", "tests/test_util_inspect.py::test_dictionary_sorting", "tests/test_util_inspect.py::test_frozenset_sorting", "tests/test_util_inspect.py::test_frozenset_sor...
7758e016231c3886e5a290c00fcb2c75d1f36c18
sphinx-doc/sphinx
sphinx-doc__sphinx-11502
71db08c05197545944949d5aa76cd340e7143627
diff --git a/sphinx/transforms/i18n.py b/sphinx/transforms/i18n.py --- a/sphinx/transforms/i18n.py +++ b/sphinx/transforms/i18n.py @@ -512,11 +512,6 @@ def apply(self, **kwargs: Any) -> None: node['raw_entries'] = entries node['entries'] = new_entries - # remove translated att...
diff --git a/tests/test_intl.py b/tests/test_intl.py --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -615,6 +615,20 @@ def test_gettext_buildr_ignores_only_directive(app): assert expect_msg.id in [m.id for m in actual if m.id] +@sphinx_intl +def test_node_translated_attribute(app): + app.build() + ...
Keep 'translated' node attribute **Is your feature request related to a problem? Please describe.** In my internationalized documentation, I am adding markers to untranslated or partially translated pages, to warn the user that they can see English content and nudge them to help translating (e.g., like this: ![image]...
By the way, #1246 is related. On second thought, I believe that providing at least a way to access the percentage of translated paragraphs on the entire documentation. ```restructuredtext .. warning:: This document is not fully translated yet (progress: XXXXX %). ``` would be a valuable feature for Sphinx. I wou...
2023-07-23T14:35:44Z
7.1
["tests/test_intl.py::test_node_translated_attribute"]
["tests/test_intl.py::test_additional_targets_should_be_translated", "tests/test_intl.py::test_additional_targets_should_not_be_translated", "tests/test_intl.py::test_customize_system_message", "tests/test_intl.py::test_customize_today_date_format", "tests/test_intl.py::test_gettext_allow_fuzzy_translations", "tests/te...
89808c6f49e1738765d18309244dca0156ee28f6
sphinx-doc/sphinx
sphinx-doc__sphinx-7268
a73617c51b9e29d7f059a2794f4574bb80cfcf57
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1004,7 +1004,7 @@ def can_document_member(cls, member: Any, membername: str, isattr: bool, parent: (inspect.isroutine(member) and isinstance(parent,...
diff --git a/tests/test_ext_autodoc_configs.py b/tests/test_ext_autodoc_configs.py --- a/tests/test_ext_autodoc_configs.py +++ b/tests/test_ext_autodoc_configs.py @@ -462,10 +462,9 @@ def test_mocked_module_imports(app, warning): assert warning.getvalue() == '' -@pytest.mark.sphinx('html', testroot='ext-autodo...
autodoc: Load sphinx.ext.autodoc.typehints automatically After typehints enough matured, it should be loaded automatically from autodoc extension. refs: #6418
null
2020-03-07T04:21:04Z
3
["tests/test_ext_autodoc_configs.py::test_autodoc_typehints_description"]
["tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_both", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_init", "tests/test_ext_autodoc_configs.py::test_autocla...
50d2d289e150cb429de15770bdd48a723de8c45d
sphinx-doc/sphinx
sphinx-doc__sphinx-7350
c75470f9b79046f6d32344be5eacf60a4e1c1b7d
diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -583,7 +583,11 @@ def _parse_attributes_section(self, section: str) -> List[str]: if _type: lines.append(':vartype %s: %...
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py --- a/tests/test_ext_napoleon_docstring.py +++ b/tests/test_ext_napoleon_docstring.py @@ -1020,6 +1020,34 @@ def test_custom_generic_sections(self): actual = str(GoogleDocstring(docstring, testConfig)) sel...
Napoleon's Attributes directive ignores :noindex: option. **Description of the bug** Sphinxcontrib-napoleon's `Attributes:` directive appears to ignore the `:noindex:` option. The following reST code produces an index that includes the `Attributes:` directives found in `example_google.py` but leaves out all other dir...
I'm hitting this bug as well, but I believe this bug is in `autodoc` not `napoleon`, since all `napoleon` does is convert Google/Numpy style docstrings to valid reST. As far as I can tell from the code, it doesn't set `:noindex:` for any other option so I don't see how Attributes is handled any differently.
2020-03-21T09:55:42Z
3
["tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_noindex"]
["tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_attributes_with_class_reference", "tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_code_block_in_returns_section", "tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_colon_in_return_type", "tests/test_ext_napoleon_docstring....
50d2d289e150cb429de15770bdd48a723de8c45d
sphinx-doc/sphinx
sphinx-doc__sphinx-7374
70c61e44c34b4dadf1a7552be7c5feabd74b98bc
diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -259,6 +259,15 @@ def fix_ids(self, tree: nodes.document) -> None: Some readers crash because they interpret the part as a transport protocol specificat...
diff --git a/tests/test_build_epub.py b/tests/test_build_epub.py --- a/tests/test_build_epub.py +++ b/tests/test_build_epub.py @@ -320,13 +320,11 @@ def test_epub_anchor_id(app): app.build() html = (app.outdir / 'index.xhtml').read_text() - assert ('<p id="std-setting-staticfiles_finders">' - ...
Breaking change to Python domain IDs **Describe the bug** Previously, anchors for Python functions were using underscores, #7236 changed this to dashes. **To Reproduce** Document some Python function whose name contains underscores: ```rst .. py:function:: example_python_function(foo) Some function. ``` **Exp...
Are you sure the old links are broken? While the permalink is indeed using a new ID generation scheme, the old ID should still be attached to the declaration (using ``<span id="theOldID"></span>``). Yes, I changed the style of node_ids in #7236. Therefore, the main hyperlink anchor will be changed in the next release. ...
2020-03-24T16:53:16Z
3
["tests/test_build_epub.py::test_epub_anchor_id", "tests/test_build_html.py::test_html5_output[autodoc.html-expect25]", "tests/test_build_html.py::test_html5_output[markup.html-expect53]", "tests/test_build_html.py::test_html5_output[objects.html-expect123]", "tests/test_build_html.py::test_html5_output[objects.html-ex...
["tests/test_build_epub.py::test_build_epub", "tests/test_build_epub.py::test_duplicated_toctree_entry", "tests/test_build_epub.py::test_epub_assets", "tests/test_build_epub.py::test_epub_cover", "tests/test_build_epub.py::test_epub_css_files", "tests/test_build_epub.py::test_epub_writing_mode", "tests/test_build_epub....
50d2d289e150cb429de15770bdd48a723de8c45d
sphinx-doc/sphinx
sphinx-doc__sphinx-7440
9bb204dcabe6ba0fc422bf4a45ad0c79c680d90b
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -305,7 +305,7 @@ def make_glossary_term(env: "BuildEnvironment", textnodes: Iterable[Node], index term['ids'].append(node_id) std = cast(StandardDomain, env.get_domain('std')) - std.n...
diff --git a/tests/test_domain_std.py b/tests/test_domain_std.py --- a/tests/test_domain_std.py +++ b/tests/test_domain_std.py @@ -99,7 +99,7 @@ def test_glossary(app): text = (".. glossary::\n" "\n" " term1\n" - " term2\n" + " TERM2\n" " des...
glossary duplicate term with a different case **Describe the bug** ``` Warning, treated as error: doc/glossary.rst:243:duplicate term description of mysql, other instance in glossary ``` **To Reproduce** Steps to reproduce the behavior: [.travis.yml#L168](https://github.com/phpmyadmin/phpmyadmin/blob/f7cc383674b709919...
Sorry for the inconvenience. Indeed, this must be a bug. I'll take a look this later.
2020-04-08T13:46:43Z
3
["tests/test_domain_std.py::test_glossary"]
["tests/test_domain_std.py::test_cmdoption", "tests/test_domain_std.py::test_disabled_docref", "tests/test_domain_std.py::test_get_full_qualified_name", "tests/test_domain_std.py::test_glossary_alphanumeric", "tests/test_domain_std.py::test_glossary_comment", "tests/test_domain_std.py::test_glossary_comment2", "tests/t...
50d2d289e150cb429de15770bdd48a723de8c45d
sphinx-doc/sphinx
sphinx-doc__sphinx-7454
aca3f825f2e4a8817190f3c885a242a285aa0dba
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -71,8 +71,13 @@ def _parse_annotation(annotation: str) -> List[Node]: """Parse type annotation.""" def make_xref(text: str) -> addnodes.pending_xref: + if text == 'None': +...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -239,6 +239,7 @@ def test_get_full_qualified_name(): def test_parse_annotation(): doctree = _parse_annotation("int") assert_node(doctree, ([pending_xref, "int"],)) + assert_node(do...
Inconsistent handling of None by `autodoc_typehints` **Describe the bug** With `autodoc_typehints='description'`, a function that returns `None` generates a clickable link to [None's documentation](https://docs.python.org/3/library/constants.html#None). With `autodoc_typehints='signature'`, the `None` in the signature...
null
2020-04-09T17:08:30Z
3
["tests/test_domain_py.py::test_parse_annotation"]
["tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_exceptions_module_is_ignored", "tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_get_full_qualified_na...
50d2d289e150cb429de15770bdd48a723de8c45d
sphinx-doc/sphinx
sphinx-doc__sphinx-7597
c13ecd243709d1e210a030be5aa09b7714e35730
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -77,17 +77,19 @@ ('deprecated', bool)]) -def _parse_annotation(annotation: str) -> List[Node]: - """Parse type annotation.""" - def make_x...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -420,7 +420,8 @@ def test_pydata_signature(app): doctree = restructuredtext.parse(app, text) assert_node(doctree, (addnodes.index, [desc, ([desc_signature, (...
py domain: Change a type annotation for variables to a hyperlink **Is your feature request related to a problem? Please describe.** py domain: Change a type annotation for variables to a hyperlink **Describe the solution you'd like** `type` option was added to python directives since 2.x. But it has been represented ...
null
2020-05-02T13:44:52Z
3.1
["tests/test_domain_py.py::test_pyattribute", "tests/test_domain_py.py::test_pydata_signature"]
["tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_exceptions_module_is_ignored", "tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_get_full_qualified_na...
5afc77ee27fc01c57165ab260d3a76751f9ddb35
sphinx-doc/sphinx
sphinx-doc__sphinx-7615
6ce265dc813f9ecb92bf1cdf8733fbada7f5c967
diff --git a/sphinx/transforms/__init__.py b/sphinx/transforms/__init__.py --- a/sphinx/transforms/__init__.py +++ b/sphinx/transforms/__init__.py @@ -23,6 +23,7 @@ from sphinx.config import Config from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias from sphinx.locale import _, __ +from sphinx....
diff --git a/tests/test_markup.py b/tests/test_markup.py --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -13,7 +13,6 @@ import pytest from docutils import frontend, utils, nodes from docutils.parsers.rst import Parser as RstParser -from docutils.transforms.universal import SmartQuotes from sphinx import ...
Sphinx, unlike Docutils, incorrectly renders consecutive backslashes **Describe the bug** Sphinx incorrectly renders four or more consecutive backslashes. In pure Docutils, they are renderer properly according with RST spec. **To Reproduce** The following snippet demonstrantes buggy rendering. ``` Two \\ Three \\\ ...
null
2020-05-05T09:27:36Z
3.1
["tests/test_markup.py::test_inline_docutils16[verify-4"]
["tests/test_markup.py::test_XRefRole", "tests/test_markup.py::test_compact_refonly_bullet_list", "tests/test_markup.py::test_default_role1", "tests/test_markup.py::test_default_role2", "tests/test_markup.py::test_download_role", "tests/test_markup.py::test_inline[verify-\"John\"-<p>\\u201cJohn\\u201d</p>-\\u201cJohn\\...
5afc77ee27fc01c57165ab260d3a76751f9ddb35
sphinx-doc/sphinx
sphinx-doc__sphinx-7814
55fc097833ee1e0efc689ddc85bd2af2e77f4af7
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -623,7 +623,8 @@ def handle_signature(self, sig: str, signode: desc_signature) -> Tuple[str, str] typ = self.options.get('type') if typ: - signode += addnodes....
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -679,7 +679,7 @@ def test_pyattribute(app): text = (".. py:class:: Class\n" "\n" " .. py:attribute:: attr\n" - " :type: str\n" + " ...
Warnings raised on variable and attribute type annotations **Describe the bug** autodoc signature for non-builtin types raises warning and thus fails nitpicking: ``` /path/to/foo.py:docstring of foo.Foo.a:: WARNING: py:class reference target not found: Optional[str] ``` **To Reproduce** Steps to reproduce the behav...
We have a similar problem in the Trio project where we use annotations like "str or list", ThisType or None" or even "bytes-like" in a number of place. Here's an example: https://github.com/python-trio/trio/blob/dependabot/pip/sphinx-3.1.0/trio/_subprocess.py#L75-L96 To clarify a bit on the Trio issue: we don't expect ...
2020-06-10T14:00:51Z
3.1
["tests/test_domain_py.py::test_pyattribute"]
["tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_exceptions_module_is_ignored", "tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_get_full_qualified_na...
5afc77ee27fc01c57165ab260d3a76751f9ddb35
sphinx-doc/sphinx
sphinx-doc__sphinx-7854
66e55a02d125e7b65b211a7cf9b48506195e3bf4
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -28,7 +28,8 @@ from sphinx.roles import SphinxRole, XRefRole from sphinx.util import logging from sphinx.util.cfamily import ( - NoOldIdError, ASTBaseBase, verify_description_mode, StringifyTransform, + ...
diff --git a/tests/test_domain_c.py b/tests/test_domain_c.py --- a/tests/test_domain_c.py +++ b/tests/test_domain_c.py @@ -469,6 +469,8 @@ def test_attributes(): check('member', '__attribute__(()) int f', {1: 'f'}) check('member', '__attribute__((a)) int f', {1: 'f'}) check('member', '__attribute__((a, b...
Support for parameterized GNU style attributes on C++ code. Hi folks. My C++ codebase uses GNU attributes for code like `__attribute__ ((optimize(3))) void readMatrix(void)` Unfortunately, it looks like Sphinx doesn't support them. ``` Exception occurred: File "/usr/local/lib/python3.7/site-packages/sphinx/doma...
null
2020-06-20T08:02:58Z
3.2
["tests/test_domain_c.py::test_attributes", "tests/test_domain_cpp.py::test_attributes"]
["tests/test_domain_c.py::test_anon_definitions", "tests/test_domain_c.py::test_build_domain_c", "tests/test_domain_c.py::test_build_domain_c_anon_dup_decl", "tests/test_domain_c.py::test_build_domain_c_namespace", "tests/test_domain_c.py::test_build_domain_c_semicolon", "tests/test_domain_c.py::test_cfunction", "tests...
f92fa6443fe6f457ab0c26d41eb229e825fda5e1
sphinx-doc/sphinx
sphinx-doc__sphinx-7906
fdd1aaf77058a579a5b5c2e3e6aff935265a7e49
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -16,6 +16,7 @@ from docutils import nodes from docutils.nodes import Element, Node, TextElement, system_message +from docutils.parsers.rst import directives from sphinx import addnodes from sphinx.addno...
diff --git a/tests/test_domain_c.py b/tests/test_domain_c.py --- a/tests/test_domain_c.py +++ b/tests/test_domain_c.py @@ -10,6 +10,7 @@ import pytest from sphinx import addnodes +from sphinx.addnodes import desc from sphinx.domains.c import DefinitionParser, DefinitionError from sphinx.domains.c import _max_id, ...
:noindex: prevents cross-referencing If a `:noindex:` flag is added to a directive, it can't be cross-referenced, and no permalink to it is generated. The following ReST: ``` .. class:: Indexed .. class:: Unindexed :noindex: ``` generates the following HTML: ``` <dl class="class"> <dt id="Indexed"> <em class="pro...
The `:noindex:` option is usually used to disable to create a cross-reference target. For example, `.. py:module::` directive goes to create a target and to switch current module (current namespace). And we give `:noindex:` option to one of `py:module:` definition to avoid conflicts. ``` # in getcwd.rst .. py:module:: ...
2020-07-02T15:31:35Z
3.2
["tests/test_domain_c.py::test_noindexentry", "tests/test_domain_cpp.py::test_noindexentry", "tests/test_domain_js.py::test_noindexentry", "tests/test_domain_py.py::test_noindexentry"]
["tests/test_domain_c.py::test_anon_definitions", "tests/test_domain_c.py::test_attributes", "tests/test_domain_c.py::test_build_domain_c", "tests/test_domain_c.py::test_build_domain_c_anon_dup_decl", "tests/test_domain_c.py::test_build_domain_c_namespace", "tests/test_domain_c.py::test_build_domain_c_semicolon", "test...
f92fa6443fe6f457ab0c26d41eb229e825fda5e1
sphinx-doc/sphinx
sphinx-doc__sphinx-7923
533b4ac7d6f2a1a20f08c3a595a2580a9742d944
diff --git a/sphinx/util/rst.py b/sphinx/util/rst.py --- a/sphinx/util/rst.py +++ b/sphinx/util/rst.py @@ -103,6 +103,11 @@ def prepend_prolog(content: StringList, prolog: str) -> None: def append_epilog(content: StringList, epilog: str) -> None: """Append a string to content body as epilog.""" if epilog: - ...
diff --git a/tests/test_parser.py b/tests/test_parser.py --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -50,7 +50,7 @@ def test_RSTParser_prolog_epilog(RSTStateMachine, app): (content, _), _ = RSTStateMachine().run.call_args assert list(content.xitems()) == [('dummy.rst', 0, 'hello Sphinx world'), ...
Bad refs in pot files, when using rst_epilog **To Reproduce** conf.py ```python rst_epilog = """ .. |var1| replace:: VAR1 """ ``` index.rst ``` A ====== a b ``` `make gettext` produces index.pot with bad string numbers and "\<generated\>" refs: ``` #: ../../index.rst:2 msgid "A" msgstr "" #: ../../<generated>:1 m...
null
2020-07-06T16:23:19Z
3.2
["tests/test_parser.py::test_RSTParser_prolog_epilog", "tests/test_util_rst.py::test_append_epilog"]
["tests/test_util_rst.py::test_escape", "tests/test_util_rst.py::test_heading", "tests/test_util_rst.py::test_prepend_prolog", "tests/test_util_rst.py::test_prepend_prolog_with_CR", "tests/test_util_rst.py::test_prepend_prolog_without_CR", "tests/test_util_rst.py::test_textwidth"]
f92fa6443fe6f457ab0c26d41eb229e825fda5e1
sphinx-doc/sphinx
sphinx-doc__sphinx-7930
2feb0b43b64012ac982a9d07af85002b43b59226
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -77,18 +77,24 @@ ('deprecated', bool)]) -def type_to_xref(text: str) -> addnodes.pending_xref: +def type_to_xref(text: str, env: BuildEnvironmen...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -236,18 +236,18 @@ def test_get_full_qualified_name(): assert domain.get_full_qualified_name(node) == 'module1.Class.func' -def test_parse_annotation(): - doctree = _parse_annotation...
Regression: autodoc Dataclass variables reference target not found **Describe the bug** When I use `sphinx.ext.autodoc` and `nitpicky = True` with my code which includes a dataclass with a variable of a custom type, I get a warning. **To Reproduce** Open the attached project [sphinx-example.zip](https://github.com/s...
Thank you for reporting. Note: Internally, the autodoc generates the following code: ``` .. py:module:: example .. py:class:: Report(status: example.Statuses) :module: example .. py:attribute:: Report.status :module: example :type: Statuses .. py:class:: Statuses() :module: example ``` It ...
2020-07-08T16:50:21Z
3.2
["tests/test_domain_py.py::test_parse_annotation", "tests/test_domain_py.py::test_pyattribute", "tests/test_domain_py.py::test_pydata"]
["tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_exceptions_module_is_ignored", "tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_get_full_qualified_na...
f92fa6443fe6f457ab0c26d41eb229e825fda5e1
sphinx-doc/sphinx
sphinx-doc__sphinx-7975
4ec6cbe341fd84468c448e20082c778043bbea4b
diff --git a/sphinx/environment/adapters/indexentries.py b/sphinx/environment/adapters/indexentries.py --- a/sphinx/environment/adapters/indexentries.py +++ b/sphinx/environment/adapters/indexentries.py @@ -98,9 +98,8 @@ def keyfunc0(entry: Tuple[str, str]) -> Tuple[bool, str]: for subentry in indexentry[1...
diff --git a/tests/test_environment_indexentries.py b/tests/test_environment_indexentries.py --- a/tests/test_environment_indexentries.py +++ b/tests/test_environment_indexentries.py @@ -25,12 +25,14 @@ def test_create_single_index(app): ".. index:: ёлка\n" ".. index:: ‏תירבע‎\n" ...
Two sections called Symbols in index When using index entries with the following leading characters: _@_, _£_, and _←_ I get two sections called _Symbols_ in the HTML output, the first containing all _@_ entries before ”normal” words and the second containing _£_ and _←_ entries after the ”normal” words. Both have the...
null
2020-07-18T06:39:32Z
3.2
["tests/test_environment_indexentries.py::test_create_single_index"]
["tests/test_environment_indexentries.py::test_create_index_by_key", "tests/test_environment_indexentries.py::test_create_index_with_name", "tests/test_environment_indexentries.py::test_create_main_index", "tests/test_environment_indexentries.py::test_create_pair_index", "tests/test_environment_indexentries.py::test_cr...
f92fa6443fe6f457ab0c26d41eb229e825fda5e1
sphinx-doc/sphinx
sphinx-doc__sphinx-8007
9175da437ed84e43b00ed4c28ccfe629260d3c13
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1213,7 +1213,8 @@ def format_args(self, **kwargs: Any) -> str: try: self.env.app.emit('autodoc-before-process-signature', self.object, False)...
diff --git a/tests/roots/test-ext-autodoc/target/annotations.py b/tests/roots/test-ext-autodoc/target/annotations.py new file mode 100644 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/annotations.py @@ -0,0 +1,25 @@ +from __future__ import annotations +from typing import overload + + +myint = int + + +def sum...
Option for not unfolding aliases Would it be possible to add an option for autodoc not to unfold user-defined type aliases? For example, if I introduce a type synonym Position = int and then define a method with argument pos: Position then I would like to see this typing in the documentation and not pos: int. For me, ...
How did you define the type? If you're using [type aliases](https://mypy.readthedocs.io/en/latest/kinds_of_types.html#type-aliases), it does not define a new type as mypy docs says: >A type alias does not create a new type. It’s just a shorthand notation for another type – it’s equivalent to the target type except for...
2020-07-26T17:21:43Z
3.3
["tests/test_ext_autodoc_configs.py::test_autodoc_type_aliases"]
["tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_both", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_init", "tests/test_ext_autodoc_configs.py::test_autocla...
3b85187ffa3401e88582073c23188c147857a8a3
sphinx-doc/sphinx
sphinx-doc__sphinx-8075
487b8436c6e8dc596db4b8d4d06e9145105a2ac2
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -610,8 +610,6 @@ class StandardDomain(Domain): dangling_warnings = { 'term': 'term not in glossary: %(target)s', - 'ref': 'undefined label: %(target)s (if the link has no caption...
diff --git a/tests/roots/test-domain-py-xref-warning/conf.py b/tests/roots/test-domain-py-xref-warning/conf.py new file mode 100644 diff --git a/tests/roots/test-domain-py-xref-warning/index.rst b/tests/roots/test-domain-py-xref-warning/index.rst new file mode 100644 --- /dev/null +++ b/tests/roots/test-domain-py-xref-...
References to figures without captions: errors in both HTML and LaTeX **Describe the bug** Using figures without captions causes errors in both HTML (though these are properly reported when source is processed) and in LaTeX (they are not reported until LaTeX says there were undefined references). This was the test do...
null
2020-08-08T11:20:59Z
3.4
["tests/test_domain_py.py::test_warn_missing_reference"]
["tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_exceptions_module_is_ignored", "tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_get_full_qualified_na...
3f560cd67239f75840cc7a439ab54d8509c855f6
sphinx-doc/sphinx
sphinx-doc__sphinx-8095
bf26080042fabf6e3aba22cfe05ad8d93bcad3e9
diff --git a/sphinx/ext/napoleon/__init__.py b/sphinx/ext/napoleon/__init__.py --- a/sphinx/ext/napoleon/__init__.py +++ b/sphinx/ext/napoleon/__init__.py @@ -41,6 +41,7 @@ class Config: napoleon_use_param = True napoleon_use_rtype = True napoleon_use_keyword = True + napoleon_preproce...
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py --- a/tests/test_ext_napoleon_docstring.py +++ b/tests/test_ext_napoleon_docstring.py @@ -66,19 +66,19 @@ def test_attributes_docstring(self): Quick description of attr1 - :type: :class:`Arbitrary type` + :type: Arbitra...
Warning: Inline literal start-string without end-string in Numpy style Parameters section **Describe the bug** The following docstring generates a warning on the line of the timeout parameter. Removing the quote around `default` cause the warning to go away. ```python def lock( self, timeout: Union[floa...
@keewis Could you check this please? I think this is related to convert_numpy_type_spec. `napoleon` converts the docstring to ```rst Establish a shared lock to the resource. :Parameters: * **timeout** (:class:`Union[float`, :class:`Literal[```"default"``:class:`]]`, *optional*) -- Absolute time period (in milliseconds...
2020-08-10T11:09:15Z
3.3
["tests/test_ext_napoleon_docstring.py::NamedtupleSubclassTest::test_attributes_docstring", "tests/test_ext_napoleon_docstring.py::NumpyDocstringTest::test_list_in_parameter_description", "tests/test_ext_napoleon_docstring.py::NumpyDocstringTest::test_multiple_parameters", "tests/test_ext_napoleon_docstring.py::NumpyDo...
["tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_attributes_with_class_reference", "tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_code_block_in_returns_section", "tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_colon_in_return_type", "tests/test_ext_napoleon_docstring....
3b85187ffa3401e88582073c23188c147857a8a3
sphinx-doc/sphinx
sphinx-doc__sphinx-8435
5d8d6275a54f2c5fb72b82383b5712c22d337634
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1702,7 +1702,8 @@ def add_directive_header(self, sig: str) -> None: if not self.options.annotation: # obtain annotation for this data ...
diff --git a/tests/roots/test-ext-autodoc/target/annotations.py b/tests/roots/test-ext-autodoc/target/annotations.py --- a/tests/roots/test-ext-autodoc/target/annotations.py +++ b/tests/roots/test-ext-autodoc/target/annotations.py @@ -4,6 +4,9 @@ myint = int +#: docstring +variable: myint + def sum(x: myint, y:...
autodoc_type_aliases does not effect to variables and attributes **Describe the bug** autodoc_type_aliases does not effect to variables and attributes **To Reproduce** ``` # example.py from __future__ import annotations #: blah blah blah var: String class MyString: "mystring" #: blah blah blah var: S...
null
2020-11-15T17:12:24Z
3.4
["tests/test_ext_autodoc_configs.py::test_autodoc_type_aliases"]
["tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_both", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_init", "tests/test_ext_autodoc_configs.py::test_autocla...
3f560cd67239f75840cc7a439ab54d8509c855f6
sphinx-doc/sphinx
sphinx-doc__sphinx-8539
e888a4424939fd34590e5443838709d00d8d8874
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -2656,6 +2656,8 @@ def setup(app: Sphinx) -> Dict[str, Any]: app.add_config_value('autodoc_mock_imports', [], True) app.add_config_value('autodoc_typehints'...
diff --git a/tests/roots/test-ext-autodoc/target/typehints.py b/tests/roots/test-ext-autodoc/target/typehints.py --- a/tests/roots/test-ext-autodoc/target/typehints.py +++ b/tests/roots/test-ext-autodoc/target/typehints.py @@ -68,3 +68,13 @@ def missing_attr(c, ): # type: (...) -> str return...
autodoc_typehints='description' does not combine well with autoclass_content='class' With this configuration: ~~~~~~~~ python extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autodoc.typehints', ] autodoc_default_options = { 'members': True, 'special-members': '__init__', } autoclass_content = 'class' ...
The bug reported in #7329 was that, when `autodoc_typehints="description"`, `autoclass_content="class"`, and `__init__` is documented separately from the class because `special-members` includes `__init__`, the constructor parameters would be duplicated in both the class documentation and the `__init__` method documen...
2020-12-15T01:06:47Z
4
["tests/test_ext_autodoc_configs.py::test_autodoc_typehints_description_no_undoc", "tests/test_ext_autodoc_configs.py::test_autodoc_typehints_description_with_documented_init", "tests/test_ext_autodoc_configs.py::test_autodoc_typehints_description_with_documented_init_no_undoc"]
["tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_both", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_and_docstring_signature_init", "tests/test_ext_autodoc_configs.py::test_autocla...
8939a75efaa911a12dbe6edccedf261e88bf7eef
sphinx-doc/sphinx
sphinx-doc__sphinx-8548
dd1615c59dc6fff633e27dbb3861f2d27e1fb976
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1584,7 +1584,7 @@ def add_directive_header(self, sig: str) -> None: self.add_line(' ' + _('Bases: %s') % ', '.join(bases), sourcename) def ...
diff --git a/tests/roots/test-ext-autodoc/target/instance_variable.py b/tests/roots/test-ext-autodoc/target/instance_variable.py new file mode 100644 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/instance_variable.py @@ -0,0 +1,10 @@ +class Foo: + def __init__(self): + self.attr1 = None #: docstrin...
autodoc inherited-members won't work for inherited attributes (data members). autodoc searches for a cached docstring using (namespace, attrname) as search-key, but doesn't check for baseclass-namespace. --- - Bitbucket: https://bitbucket.org/birkenfeld/sphinx/issue/741 - Originally reported by: Anonymous - Originally...
_From [mitar](https://bitbucket.org/mitar) on 2012-01-07 18:21:47+00:00_ Also {{{find_attr_doc}}} seems to not find inherited attributes? _From [mitar](https://bitbucket.org/mitar) on 2012-01-07 20:04:22+00:00_ The problem is also that parser for attributes' doc strings parses only one module. It should also parses ...
2020-12-17T13:46:32Z
3.4
["tests/test_ext_autodoc_autoclass.py::test_inherited_instance_variable"]
["tests/test_ext_autodoc_autoclass.py::test_classes", "tests/test_ext_autodoc_autoclass.py::test_decorators", "tests/test_ext_autodoc_autoclass.py::test_instance_variable", "tests/test_ext_autodoc_autoclass.py::test_show_inheritance_for_subclass_of_generic_type", "tests/test_ext_autodoc_autoclass.py::test_slots_attribu...
3f560cd67239f75840cc7a439ab54d8509c855f6
sphinx-doc/sphinx
sphinx-doc__sphinx-8579
955d6558ec155dffaef999d890c2cdb224cbfbb9
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -22,7 +22,7 @@ from urllib.parse import unquote, urlparse from docutils import nodes -from docutils.nodes import Node +from docutils.nodes import Element, Node from requ...
diff --git a/tests/roots/test-linkcheck-localserver-two-links/conf.py b/tests/roots/test-linkcheck-localserver-two-links/conf.py new file mode 100644 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-two-links/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-linkcheck-localser...
Linkcheck crashes in 3.4.0 **Describe the bug** When running linkcheck in Weblate docs, it crashes with: ``` Exception in thread Thread-2: Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/threading.py", line 932, in _bootstrap_inner Exception occurred: self.run() ...
Hi, Thanks for the report! I can reproduce the issue. I’ll be looking into fixing it later today. I understand what is wrong: Linkcheck organizes the urls to checks in a `PriorityQueue`. The items are tuples `(priority, url, docname, lineno)`. For some links, the `get_node_line()` returns `None`, I’m guessing the line...
2020-12-22T20:03:13Z
3.4
["tests/test_build_linkcheck.py::test_priorityqueue_items_are_comparable"]
["tests/test_build_linkcheck.py::test_TooManyRedirects_on_HEAD", "tests/test_build_linkcheck.py::test_anchors_ignored", "tests/test_build_linkcheck.py::test_auth_header_no_match", "tests/test_build_linkcheck.py::test_auth_header_uses_first_match", "tests/test_build_linkcheck.py::test_connect_to_selfsigned_fails", "test...
3f560cd67239f75840cc7a439ab54d8509c855f6
sphinx-doc/sphinx
sphinx-doc__sphinx-8599
3a0a6556c59a7b31586dd97b43101f8dbfd2ef63
diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -1205,6 +1205,16 @@ def validate_html_favicon(app: Sphinx, config: Config) -> None: config.html_favicon = None # type: ignore +def migrate_html_...
diff --git a/tests/test_build_html.py b/tests/test_build_html.py --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -1665,3 +1665,23 @@ def test_highlight_options_old(app): location=ANY, opts={}) assert call_args[2] == call(ANY, 'java', force=False, linenos=Fa...
Allow custom link texts for permalinks and links to source code. I'd like to be able to customize the content of the HTML links that Sphinx generates for permalinks and links to source code (generated by the `viewcode` extension). E.g. instead of ``<a class="headerlink" href="..." title="Permalink to this definition">...
Thank you for proposal. I agree with your idea. But it would better to customize it via CSS to me. How about wrapping these labels with `<span>`? Adding a custom node will cause incompatibility to writers. Please take a look errors in Travis CI. I agree that adding a custom node might be to invasive, but I don't know h...
2020-12-27T09:15:38Z
3.5
["tests/test_build_html.py::test_html_permalink_disable", "tests/test_build_html.py::test_html_permalink_icon"]
["tests/test_build_html.py::test_alternate_stylesheets[index.html-expect0]", "tests/test_build_html.py::test_alternate_stylesheets[index.html-expect1]", "tests/test_build_html.py::test_alternate_stylesheets[index.html-expect2]", "tests/test_build_html.py::test_alternate_stylesheets[index.html-expect3]", "tests/test_bui...
4f8cb861e3b29186b38248fe81e4944fd987fcce
sphinx-doc/sphinx
sphinx-doc__sphinx-8621
21698c14461d27933864d73e6fba568a154e83b3
diff --git a/sphinx/builders/html/transforms.py b/sphinx/builders/html/transforms.py --- a/sphinx/builders/html/transforms.py +++ b/sphinx/builders/html/transforms.py @@ -37,7 +37,7 @@ class KeyboardTransform(SphinxPostTransform): """ default_priority = 400 builders = ('html',) - pattern = re.compile(...
diff --git a/tests/test_markup.py b/tests/test_markup.py --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -251,6 +251,17 @@ def get(name): '</kbd></p>'), '\\sphinxkeyboard{\\sphinxupquote{Control+X}}', ), + ( + # kbd role + 'verify', + ':kbd:`Alt+^`', + ('<...
kbd role produces incorrect HTML when compound-key separators (-, + or ^) are used as keystrokes **Describe the bug** The `:kbd:` role produces incorrect HTML when: 1) defining standalone keystrokes that use any of the compound-key separators (`-`, `+` and `^`) 2) defining compound keystrokes where one or more keystr...
null
2020-12-30T12:13:09Z
3.5
["tests/test_markup.py::test_inline[verify-:kbd:`-`-<p><kbd", "tests/test_markup.py::test_inline[verify-:kbd:`Alt+^`-<p><kbd"]
["tests/test_markup.py::test_XRefRole", "tests/test_markup.py::test_compact_refonly_bullet_list", "tests/test_markup.py::test_default_role1", "tests/test_markup.py::test_default_role2", "tests/test_markup.py::test_download_role", "tests/test_markup.py::test_inline[verify-\"John\"-<p>\\u201cJohn\\u201d</p>-\\u201cJohn\\...
4f8cb861e3b29186b38248fe81e4944fd987fcce
sphinx-doc/sphinx
sphinx-doc__sphinx-8658
40f2c832ff3ce2d908b0d8bace3e1f6698eed712
diff --git a/sphinx/ext/napoleon/__init__.py b/sphinx/ext/napoleon/__init__.py --- a/sphinx/ext/napoleon/__init__.py +++ b/sphinx/ext/napoleon/__init__.py @@ -253,10 +253,15 @@ def __unicode__(self): * To create a custom "generic" section, just pass a string. * To create an alias for an existing s...
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py --- a/tests/test_ext_napoleon_docstring.py +++ b/tests/test_ext_napoleon_docstring.py @@ -1072,10 +1072,27 @@ def test_custom_generic_sections(self): Sooper Warning: Stop hitting yourself! """, """:Warns: **Stop hitting your...
Napoleon: more custom docstring section styles Although the `napoleon_custom_sections` option help renders custom docstring section, the style is inconsistent with the rest of the doc. For example, I have a custom docstring section `Side Effect`. I would like it to be displayed as `returns` or `parameters` docstring s...
Boy, I could really use this right away. If it were up to me: * `napoleon_custom_sections` would be called `napoleon_custom_aliases`, and only accept a list of `(new alias, existing section)` tuples. * A hypothetical new `napoleon_custom_sections` would only accept a list of `(new section, existing section)` or `(new...
2021-01-05T21:26:21Z
3.5
["tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_custom_generic_sections"]
["tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_attributes_with_class_reference", "tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_code_block_in_returns_section", "tests/test_ext_napoleon_docstring.py::GoogleDocstringTest::test_colon_in_return_type", "tests/test_ext_napoleon_docstring....
4f8cb861e3b29186b38248fe81e4944fd987fcce
sphinx-doc/sphinx
sphinx-doc__sphinx-8801
7ca279e33aebb60168d35e6be4ed059f4a68f2c1
diff --git a/sphinx/ext/autodoc/importer.py b/sphinx/ext/autodoc/importer.py --- a/sphinx/ext/autodoc/importer.py +++ b/sphinx/ext/autodoc/importer.py @@ -294,24 +294,35 @@ def get_class_members(subject: Any, objpath: List[str], attrgetter: Callable try: for cls in getmro(subject): + try: + ...
diff --git a/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py b/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py new file mode 100644 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py @@ -0,0 +1,8 @@ +class Base: + attr1: int #: docstring + attr2: s...
autodoc: The annotation only member in superclass is treated as "undocumented" **Describe the bug** autodoc: The annotation only member in superclass is treated as "undocumented". **To Reproduce** ``` # example.py class Foo: """docstring""" attr1: int #: docstring class Bar(Foo): """docstring""" at...
null
2021-01-31T11:12:59Z
3.5
["tests/test_ext_autodoc_autoclass.py::test_uninitialized_attributes"]
["tests/test_ext_autodoc_autoclass.py::test_class_alias", "tests/test_ext_autodoc_autoclass.py::test_classes", "tests/test_ext_autodoc_autoclass.py::test_decorators", "tests/test_ext_autodoc_autoclass.py::test_inherited_instance_variable", "tests/test_ext_autodoc_autoclass.py::test_instance_variable", "tests/test_ext_a...
4f8cb861e3b29186b38248fe81e4944fd987fcce
sphinx-doc/sphinx
sphinx-doc__sphinx-8969
ae413e95ed6fd2b3a9d579a3d802e38846906b54
diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -6,7 +6,9 @@ :license: BSD, see LICENSE for details. """ +import os import warnings +from os import path from typing import TYPE_CHECKING, Any, Dict, List, Tuple, c...
diff --git a/tests/roots/test-directive-csv-table/conf.py b/tests/roots/test-directive-csv-table/conf.py new file mode 100644 diff --git a/tests/roots/test-directive-csv-table/example.csv b/tests/roots/test-directive-csv-table/example.csv new file mode 100644 --- /dev/null +++ b/tests/roots/test-directive-csv-table/exa...
Absolute/"source-relative" imports for csv-table :file: **Describe the bug** To be honest, I am not sure if this can be considered a bug, or if it is rather a feature request. Sorry about that. When using the `csv-table` directive, the use of `:file:` with absolute paths are really absolute, unlike with (eg) the `figu...
+1: I agree this is inconsistent behavior. It should behave like the figure directive. But changing the behavior is an incompatible change. So we have to change it carefully... I'd greatly appreciate this change too. Changing the behavior of `:file:` flag for `csv-table` to mimic that of `figure` directive would be gre...
2021-03-06T17:04:30Z
4
["tests/test_directive_patch.py::test_csv_table_directive"]
["tests/test_directive_patch.py::test_code_directive", "tests/test_directive_patch.py::test_math_directive"]
8939a75efaa911a12dbe6edccedf261e88bf7eef
sphinx-doc/sphinx
sphinx-doc__sphinx-9128
dfdc7626b5dd06bff3d326e6efddc492ef00c471
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -68,7 +68,7 @@ class ObjectEntry(NamedTuple): docname: str node_id: str objtype: str - canonical: bool + aliased: bool class ModuleEntry(NamedTuple): @@ -505,7 +505...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -870,6 +870,39 @@ def test_canonical(app): assert domain.objects['_io.StringIO'] == ('index', 'io.StringIO', 'class', True) +def test_canonical_definition_overrides(app, warning): + ...
autodoc: duplication warning on documenting aliased object **Describe the bug** autodoc: duplication warning on documenting aliased object **To Reproduce** ``` # example.py from io import StringIO ``` ``` # index.rst .. autoclass:: example.StringIO .. autoclass:: io.StringIO ``` ``` Removing everything under '_build'....
I noticed the example is not good. Both `example.StringIO` and `io.StringIO` are aliases of `_io.StringIO`. So they're surely conflicted. It would be better to not emit a warning for this case: ``` .. autoclass:: _io.StringIO .. autoclass:: io.StringIO ``` The former one is a canonical name of the `io.StringIO`. So t...
2021-04-22T16:21:25Z
4
["tests/test_domain_py.py::test_canonical_definition_overrides", "tests/test_domain_py.py::test_canonical_definition_skip"]
["tests/test_domain_py.py::test_canonical", "tests/test_domain_py.py::test_canonical_duplicated", "tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_xrefs_abbreviations", "tests/...
8939a75efaa911a12dbe6edccedf261e88bf7eef
sphinx-doc/sphinx
sphinx-doc__sphinx-9230
567ff22716ac258b9edd2c1711d766b440ac0b11
diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -298,7 +298,7 @@ def transform(self, node: nodes.field_list) -> None: # also support syntax like ``:param type name:`` if typedesc.is_typed: try: -...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -922,7 +922,8 @@ def test_info_field_list(app): " :param age: blah blah\n" " :type age: int\n" " :param items: blah blah\n" - " :type it...
Doc rendering is incorrect when :param has datatype dict(str,str) **Describe the bug** I have a parameter defined under docstring of a method as:- :param dict(str, str) opc_meta: (optional) Which is being incorrectly rendered in the generated docs as:- str) opc_meta (dict(str,) –(optional) **To Reproduce** Create an...
null
2021-05-15T11:33:05Z
4.1
["tests/test_domain_py.py::test_info_field_list"]
["tests/test_domain_py.py::test_canonical", "tests/test_domain_py.py::test_canonical_definition_overrides", "tests/test_domain_py.py::test_canonical_definition_skip", "tests/test_domain_py.py::test_canonical_duplicated", "tests/test_domain_py.py::test_domain_py_canonical", "tests/test_domain_py.py::test_domain_py_find_...
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9231
d6c19126c5ebd788619d491d4e70c949de9fd2ff
diff --git a/sphinx/builders/manpage.py b/sphinx/builders/manpage.py --- a/sphinx/builders/manpage.py +++ b/sphinx/builders/manpage.py @@ -79,8 +79,9 @@ def write(self, *ignored: Any) -> None: docsettings.section = section if self.config.man_make_section_directory: - ensuredir...
diff --git a/tests/test_build_manpage.py b/tests/test_build_manpage.py --- a/tests/test_build_manpage.py +++ b/tests/test_build_manpage.py @@ -34,7 +34,7 @@ def test_all(app, status, warning): confoverrides={'man_make_section_directory': True}) def test_man_make_section_directory(app, status, warn...
man_make_section_directory should not be enabled by default Enabling `man_make_section_directory` by default in #8284 breaks projects relying on the previous behavior. This is a serious problem for Linux distributions that will end up with misplaced and unusable man pages. Please consider keeping it disabled by default...
Thank you for letting us know. I just reverted the change of default setting in #9232. It will be released as 4.0.2 soon. And I'll change the directory name in #9231. It will be released as 4.1.0.
2021-05-15T12:39:26Z
4.1
["tests/test_build_manpage.py::test_man_make_section_directory"]
["tests/test_build_manpage.py::test_all", "tests/test_build_manpage.py::test_captioned_code_block", "tests/test_build_manpage.py::test_default_man_pages", "tests/test_build_manpage.py::test_rubric"]
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9233
8d87dde43ba0400c46d791e42d9b50bc879cdddb
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -1641,18 +1641,23 @@ def add_directive_header(self, sig: str) -> None: # add inheritance info, if wanted if not self.doc_as_attr and self.options....
diff --git a/tests/test_ext_autodoc_autoclass.py b/tests/test_ext_autodoc_autoclass.py --- a/tests/test_ext_autodoc_autoclass.py +++ b/tests/test_ext_autodoc_autoclass.py @@ -10,6 +10,7 @@ """ import sys +from typing import List, Union import pytest @@ -264,6 +265,47 @@ def test_show_inheritance_for_subclass_o...
New hook to customize base list I would like to change the formatting of the base list for classes. Specifially I would like to provide information about parameterized types (e.g. `Dict[str, int`]). See agronholm/sphinx-autodoc-typehints#8 for how I want to use it. For that I need a new hook/event similar to the exist...
null
2021-05-15T15:38:25Z
4.1
["tests/test_ext_autodoc_autoclass.py::test_autodoc_process_bases"]
["tests/test_ext_autodoc_autoclass.py::test_class_alias", "tests/test_ext_autodoc_autoclass.py::test_class_alias_having_doccomment", "tests/test_ext_autodoc_autoclass.py::test_class_doc_from_both", "tests/test_ext_autodoc_autoclass.py::test_class_doc_from_class", "tests/test_ext_autodoc_autoclass.py::test_class_doc_fro...
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9234
f0fef96906d80d89e290a780767a92ba85977733
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -272,8 +272,12 @@ def process_result(self, result: CheckResult) -> None: except KeyError: text, color = ('with unknown code', purple) ...
diff --git a/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py b/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py new file mode 100644 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-lin...
Link checker should be able to prohibit unknown redirects **Is your feature request related to a problem? Please describe.** A lot of links become stale or move. Good websites will provide redirects to the correct new location or return an HTTP error code. Bad websites will redirect to an unrelated page or the root of ...
If one can tell in advance where they are redirected, might as well use the direct link in the docs and skip the redirect. Perhaps a step forward would be a new setting to treat redirects as errors? I provided a reason why I want to be able to link to a redirect, unless you think the base URL of sphinx itself should no...
2021-05-15T17:28:42Z
4.1
["tests/test_build_linkcheck.py::test_linkcheck_allowed_redirects"]
["tests/test_build_linkcheck.py::test_TooManyRedirects_on_HEAD", "tests/test_build_linkcheck.py::test_auth_header_no_match", "tests/test_build_linkcheck.py::test_auth_header_uses_first_match", "tests/test_build_linkcheck.py::test_connect_to_selfsigned_fails", "tests/test_build_linkcheck.py::test_connect_to_selfsigned_n...
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9320
e05cef574b8f23ab1b57f57e7da6dee509a4e230
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -95,6 +95,12 @@ def is_path(x: str) -> str: return x +def is_path_or_empty(x: str) -> str: + if x == '': + return x + return is_path(x) + + def allow_empty(x: str) -> ...
diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -10,6 +10,7 @@ import time from io import StringIO +from os import path import pytest @@ -250,3 +251,18 @@ def test_extensions(tempdir): ns = {} exec(conffile.read_text(),...
`sphinx-quickstart` with existing conf.py doesn't exit easily **Describe the bug** I've attached a screenshot in the screenshots section which I think explains the bug better. - I'm running `sphinx-quickstart` in a folder with a conf.py already existing. - It says *"Please enter a new root path name (or just Enter to...
I could try fix this myself (maybe?) Good catch @dogenstein! In my opinion, if the selected path already has a `conf.py`, `sphinx-quickstart` should exit with status 1 immediately.
2021-06-11T13:29:04Z
4.1
["tests/test_quickstart.py::test_exits_when_existing_confpy"]
["tests/test_quickstart.py::test_default_filename", "tests/test_quickstart.py::test_do_prompt", "tests/test_quickstart.py::test_do_prompt_inputstrip", "tests/test_quickstart.py::test_do_prompt_with_nonascii", "tests/test_quickstart.py::test_extensions", "tests/test_quickstart.py::test_generated_files_eol", "tests/test_...
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9367
6918e69600810a4664e53653d6ff0290c3c4a788
diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py --- a/sphinx/pycode/ast.py +++ b/sphinx/pycode/ast.py @@ -213,10 +213,12 @@ def visit_UnaryOp(self, node: ast.UnaryOp) -> str: return "%s %s" % (self.visit(node.op), self.visit(node.operand)) def visit_Tuple(self, node: ast.Tuple) -> str: - ...
diff --git a/tests/test_pycode_ast.py b/tests/test_pycode_ast.py --- a/tests/test_pycode_ast.py +++ b/tests/test_pycode_ast.py @@ -53,8 +53,9 @@ ("+ a", "+ a"), # UAdd ("- 1", "- 1"), # UnaryOp ("- a", "- a"), # USub - ...
1-element tuple rendered incorrectly **Describe the bug** This is a followup to #7964 which has been addressed in #8265. However the special case of a 1-element tuple is still not handled correctly. `(1,)` is rendered as `(1)`, but should keep the trailing comma. **To Reproduce** Add a testcase ``` ("(1,)", "(1,...
null
2021-06-20T17:49:40Z
4.1
["tests/test_pycode_ast.py::test_unparse[(1,)-(1,)]"]
["tests/test_pycode_ast.py::test_unparse['str'-'str']", "tests/test_pycode_ast.py::test_unparse[()-()]", "tests/test_pycode_ast.py::test_unparse[(1,", "tests/test_pycode_ast.py::test_unparse[+", "tests/test_pycode_ast.py::test_unparse[-", "tests/test_pycode_ast.py::test_unparse[...-...]", "tests/test_pycode_ast.py::tes...
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9464
810a1e2988b14f4d139b5ef328a91967f5ed7a08
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py --- a/sphinx/util/typing.py +++ b/sphinx/util/typing.py @@ -310,7 +310,10 @@ def stringify(annotation: Any) -> str: return INVALID_BUILTIN_CLASSES[annotation] elif (getattr(annotation, '__module__', None) == 'builtins' and hasattr(annot...
diff --git a/tests/test_util_typing.py b/tests/test_util_typing.py --- a/tests/test_util_typing.py +++ b/tests/test_util_typing.py @@ -175,6 +175,18 @@ def test_stringify_type_hints_containers(): assert stringify(Generator[None, None, None]) == "Generator[None, None, None]" +@pytest.mark.skipif(sys.version_inf...
PEP 585 type hints not rendered correctly ### Describe the bug If you use a PEP 585 generic as an annotation i.e. `list[str]`, autodoc renders the annotation as `list` rather than `list[str]`, this behaviour differs from using `typing.List[str]` which renders as expected. Fixing this is quite simple as far as I can t...
Hi @Gobot1234 , would you please upload your project to GitHub instead? Google Drive is not very convenient to read code. https://github.com/Gobot1234/sphinx-test @astrojuanlu Should I open a PR to fix this? @Gobot1234 Yes, please!
2021-07-17T17:02:31Z
4.2
["tests/test_util_typing.py::test_stringify_type_hints_pep_585"]
["tests/test_util_typing.py::test_restify", "tests/test_util_typing.py::test_restify_broken_type_hints", "tests/test_util_typing.py::test_restify_type_ForwardRef", "tests/test_util_typing.py::test_restify_type_Literal", "tests/test_util_typing.py::test_restify_type_hints_Callable", "tests/test_util_typing.py::test_rest...
336605b8e4b14c5da9f4d872fb730dc6894edb77
sphinx-doc/sphinx
sphinx-doc__sphinx-9467
9a2c3c4a1559e37e95fdee88c128bb116642c897
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -714,7 +714,10 @@ def setup(app: Sphinx) -> Dict[str, Any]: app.add_event('linkcheck-process-uri') app.connect('config-inited', compile_linkcheck_allowed_redirect...
diff --git a/tests/roots/test-linkcheck/links.txt b/tests/roots/test-linkcheck/links.txt --- a/tests/roots/test-linkcheck/links.txt +++ b/tests/roots/test-linkcheck/links.txt @@ -13,8 +13,7 @@ Some additional anchors to exercise ignore code * `Complete nonsense <https://localhost:7777/doesnotexist>`_ * `Example valid...
github linkcheck anchor change in 4.1.0 break some usage ### Describe the bug Given a link like: ```rst .. _`OpenSSL's test vectors`: https://github.com/openssl/openssl/blob/97cf1f6c2854a3a955fd7dd3a1f113deba00c9ef/crypto/evp/evptests.txt#L232 ``` in a github doc, with release 4.1.0 this will fail with linkcheck, w...
A simple fix here would be for the linkcheck logic to simply exclude links of the form `L\d+`. But of course really the current logic is broken for _any_ link that's generated by github itself and thus doesn't have this prefix. > But of course really the current logic is broken for any link that's generated by github ...
2021-07-18T04:10:10Z
4.1
["tests/test_build_linkcheck.py::test_TooManyRedirects_on_HEAD", "tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_tls_verify_false", "tests/test_build_linkcheck.py::test_get_after_head_raises_connection_error", "tests/test_build_linkcheck.py::test_too_many_requests_retry_after_int_delay"]
["tests/test_build_linkcheck.py::test_auth_header_no_match", "tests/test_build_linkcheck.py::test_auth_header_uses_first_match", "tests/test_build_linkcheck.py::test_connect_to_selfsigned_fails", "tests/test_build_linkcheck.py::test_connect_to_selfsigned_nonexistent_cert_file", "tests/test_build_linkcheck.py::test_conn...
9a2c3c4a1559e37e95fdee88c128bb116642c897
sphinx-doc/sphinx
sphinx-doc__sphinx-9602
6c38f68dae221e8cfc70c137974b8b88bd3baaab
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -123,7 +123,7 @@ def unparse(node: ast.AST) -> List[Node]: if node.value is Ellipsis: return [addnodes.desc_sig_punctuation('', "...")] else: - ...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -342,6 +342,27 @@ def test_parse_annotation(app): assert_node(doctree[0], pending_xref, refdomain="py", reftype="obj", reftarget="None") +@pytest.mark.skipif(sys.version_info < (3, 8), ...
Nitpick flags Literal annotation values as missing py:class ### Describe the bug When a value is present in a type annotation as `Literal`, sphinx will treat the value as a `py:class`. With nitpick enabled, values like `Literal[True]` end up failing, because `True` is not a class. This is a problem for builds which w...
null
2021-09-01T17:26:58Z
4.2
["tests/test_domain_py.py::test_parse_annotation_Literal"]
["tests/test_domain_py.py::test_canonical", "tests/test_domain_py.py::test_canonical_definition_overrides", "tests/test_domain_py.py::test_canonical_definition_skip", "tests/test_domain_py.py::test_canonical_duplicated", "tests/test_domain_py.py::test_domain_py_canonical", "tests/test_domain_py.py::test_domain_py_find_...
336605b8e4b14c5da9f4d872fb730dc6894edb77
sphinx-doc/sphinx
sphinx-doc__sphinx-9798
4c91c038b220d07bbdfe0c1680af42fe897f342c
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -353,17 +353,21 @@ def make_xrefs(self, rolename: str, domain: str, target: str, split_contnode = bool(contnode and contnode.astext() == target) + in_literal = False ...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -1110,6 +1110,42 @@ def test_info_field_list_piped_type(app): **{"py:module": "example", "py:class": "Class"}) +def test_info_field_list_Literal(app): + text = (".. py:mo...
Nitpick flags Literal annotation values as missing py:class (with type hints in description) ### Describe the bug This is basically the same issue as #9576, which was fixed in #9602. However, I still get this issue when using `autodoc_typehints = 'description'`. ### How to Reproduce ``` $ unzip attachment.zip $ pyt...
@tk0miya is there any additional info I can provide? Or any suggestions you can make to help me narrow down the source of this issue within the code base. I ran it also with -vvv and it provide the traceback, but it doesn't really provide any additional insight to me. Thank you for reporting. I reproduce the same err...
2021-10-30T07:41:41Z
4.3
["tests/test_domain_py.py::test_info_field_list_Literal"]
["tests/test_domain_py.py::test_canonical", "tests/test_domain_py.py::test_canonical_definition_overrides", "tests/test_domain_py.py::test_canonical_definition_skip", "tests/test_domain_py.py::test_canonical_duplicated", "tests/test_domain_py.py::test_domain_py_canonical", "tests/test_domain_py.py::test_domain_py_find_...
6c6cc8a6f50b18331cb818160d168d7bb9c03e55
sphinx-doc/sphinx
sphinx-doc__sphinx-9799
2b5c55e45a0fc4e2197a9b8edb482b77c2fa3f85
diff --git a/sphinx/ext/autodoc/preserve_defaults.py b/sphinx/ext/autodoc/preserve_defaults.py --- a/sphinx/ext/autodoc/preserve_defaults.py +++ b/sphinx/ext/autodoc/preserve_defaults.py @@ -11,7 +11,8 @@ import ast import inspect -from typing import Any, Dict +import sys +from typing import Any, Dict, List, Option...
diff --git a/tests/roots/test-ext-autodoc/target/preserve_defaults.py b/tests/roots/test-ext-autodoc/target/preserve_defaults.py --- a/tests/roots/test-ext-autodoc/target/preserve_defaults.py +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults.py @@ -7,7 +7,8 @@ def foo(name: str = CONSTANT, sentine...
Re-opening #8255: hexadecimal default arguments are changed to decimal ### Describe the bug I am experiencing the exact same problem as described in #8255: hexadecimal default arguments are changed to decimal. ### How to Reproduce Autodoc the following function: ```python3 def some_function( param_a, ...
Does `autodoc_preserve_defaults` help you? https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_preserve_defaults I had already added ```python3 autodoc_preserve_defaults = True ``` to my `conf.py` file but it didn't change the output. So no, it doesn't help.
2021-10-30T15:26:46Z
4.3
["tests/test_ext_autodoc_preserve_defaults.py::test_preserve_defaults"]
[]
6c6cc8a6f50b18331cb818160d168d7bb9c03e55
sphinx-doc/sphinx
sphinx-doc__sphinx-9829
6c6cc8a6f50b18331cb818160d168d7bb9c03e55
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py --- a/sphinx/ext/mathjax.py +++ b/sphinx/ext/mathjax.py @@ -81,7 +81,7 @@ def install_mathjax(app: Sphinx, pagename: str, templatename: str, context: Dict domain = cast(MathDomain, app.env.get_domain('math')) if app.registry.html_assets_policy == 'alw...
diff --git a/tests/test_ext_math.py b/tests/test_ext_math.py --- a/tests/test_ext_math.py +++ b/tests/test_ext_math.py @@ -71,7 +71,7 @@ def test_mathjax_options(app, status, warning): app.builder.build_all() content = (app.outdir / 'index.html').read_text() - assert ('<script async="async" integrity="sh...
Add a way to defer loading of MathJax **Is your feature request related to a problem? Please describe.** It is quite tricky to configure MathJax to work with Sphinx currently. Sphinx loads MathJax asynchronously since https://github.com/sphinx-doc/sphinx/issues/3606 and https://github.com/sphinx-doc/sphinx/pull/5005....
I'm not good at loading JS. Could you let me know the impact of changing `async` to `defer`? Are there any incompatible change for users? If not, we can change the loading option for MathJax to `defer` in the next version. I don't think it's an incompatible change. For MDN: > - If the async attribute is present, then...
2021-11-08T16:56:39Z
4.3
["tests/test_ext_math.py::test_mathjax_options"]
["tests/test_ext_math.py::test_math_compat", "tests/test_ext_math.py::test_math_eqref_format_html", "tests/test_ext_math.py::test_math_eqref_format_latex", "tests/test_ext_math.py::test_math_number_all_latex", "tests/test_ext_math.py::test_math_number_all_mathjax", "tests/test_ext_math.py::test_mathjax2_config", "tests...
6c6cc8a6f50b18331cb818160d168d7bb9c03e55
sphinx-doc/sphinx
sphinx-doc__sphinx-9931
17dfa811078205bd415700361e97e945112b89eb
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -80,7 +80,8 @@ class ModuleEntry(NamedTuple): deprecated: bool -def type_to_xref(target: str, env: BuildEnvironment = None) -> addnodes.pending_xref: +def type_to_xref(target: str, ...
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -350,6 +350,18 @@ def test_parse_annotation(app): assert_node(doctree[0], pending_xref, refdomain="py", reftype="obj", reftarget="None") +def test_parse_annotation_suppress(app): + d...
autodoc add_module_names equivalent for arguments The `add_module_names = False` configuration seems to only affect the class/function/attribute header names. The type hints are still always rendered as fully qualified names. `mypackage/mymodule.py`: ```python class MyClass: """Whatever 1.""" pass def foo(ar...
+1 for adding a new confval only for autodoc. It would be nice if we can give better name to it. I feel "add_module_names" is a bit ambiguous and difficult to understand its behavior from the name. To be clear, the [`add_module_names` confval](https://www.sphinx-doc.org/en/master/usage/configuration.html?highlight=add_...
2021-12-02T17:47:00Z
4.4
["tests/test_domain_py.py::test_parse_annotation_suppress", "tests/test_ext_autodoc_configs.py::test_autodoc_unqualified_typehints", "tests/test_util_inspect.py::test_signature_annotations", "tests/test_util_typing.py::test_stringify", "tests/test_util_typing.py::test_stringify_Annotated", "tests/test_util_typing.py::t...
["tests/test_domain_py.py::test_canonical", "tests/test_domain_py.py::test_canonical_definition_overrides", "tests/test_domain_py.py::test_canonical_definition_skip", "tests/test_domain_py.py::test_canonical_duplicated", "tests/test_domain_py.py::test_domain_py_canonical", "tests/test_domain_py.py::test_domain_py_find_...
0938c193ea6f56dbb930bfb323602bc4e2b7b9c6
sphinx-doc/sphinx
sphinx-doc__sphinx-9999
4e8bca2f2ffd6e3f1a4de4403de9e4600497fc61
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1092,8 +1092,8 @@ def visit_term(self, node: Element) -> None: ctx = r'\phantomsection' for node_id in node['ids']: ctx += self.hypertarget(node_id, a...
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -834,18 +834,18 @@ def test_latex_show_urls_is_inline(app, status, warning): 'Footnote inside footnote\n%\n\\end{footnotetext}\\ignorespaces') in result assert ('\\sphi...
Latex: terms are not separated by a newline ### Describe the bug I use simple indentations for terms and their explanation: Example: ```rst Listing: :samp:`{file}.cc` :samp:`{file}.cp` :samp:`{file}.cxx` :samp:`{file}.cpp` :samp:`{file}.CPP` :samp:`{file}.c++` :samp:`{file}.C` C++ source code that must be preproce...
I don't think this is not a bug. It's not promised a term and description of the definition list are displayed as line-folded. But I agree it's better to fold them as HTML does. Great, thanks for the suggested pull request! @marxin It may take some time before a solution is found because the natural #9988 approach bre...
2021-12-20T18:28:24Z
5
["tests/test_build_latex.py::test_latex_glossary", "tests/test_build_latex.py::test_latex_show_urls_footnote_and_substitutions", "tests/test_build_latex.py::test_latex_show_urls_is_footnote", "tests/test_build_latex.py::test_latex_show_urls_is_inline", "tests/test_build_latex.py::test_latex_show_urls_is_no"]
["tests/test_build_latex.py::test_babel_with_language_de", "tests/test_build_latex.py::test_babel_with_language_ja", "tests/test_build_latex.py::test_babel_with_language_ru", "tests/test_build_latex.py::test_babel_with_language_tr", "tests/test_build_latex.py::test_babel_with_no_language_settings", "tests/test_build_la...
60775ec4c4ea08509eee4b564cbf90f316021aff
sympy/sympy
sympy__sympy-11232
4c8a8590be682e74ec91ab217c646baa4686a255
diff --git a/sympy/core/expr.py b/sympy/core/expr.py --- a/sympy/core/expr.py +++ b/sympy/core/expr.py @@ -1044,7 +1044,7 @@ def args_cnc(self, cset=False, warn=True, split_1=True): Note: -1 is always separated from a Number unless split_1 is False. >>> from sympy import symbols, oo - >>> A, ...
diff --git a/sympy/core/tests/test_subs.py b/sympy/core/tests/test_subs.py --- a/sympy/core/tests/test_subs.py +++ b/sympy/core/tests/test_subs.py @@ -595,9 +595,9 @@ def test_issue_6559(): # though this involves cse it generated a failure in Mul._eval_subs x0, x1 = symbols('x0 x1') e = -log(-12*sqrt(2) ...
cse leaves behind unevaluated subexpressions ``` python >>> cse((j*l**2*y, j*l*o*r*y, k*o*r*s)) ([(x0, j*y)], [l**2*x0, l*o*r*x0, (k*s)*(o*r)]) >>> u = _[1][-1] >>> u.args (k*s, o*r) This can lead to problems when trying to work with the result: >>> u.subs(s*o, 2) (k*s)*(o*r) >>> Mul(*flatten([i.args for i in u.args]...
null
2016-06-12T14:14:58Z
1
["test_issue_10228", "test_issue_11230", "test_issue_4499"]
["test_2arg_hack", "test_Function_subs", "test_Piecewise", "test_add", "test_adjoint", "test_any_zeros", "test_bug", "test_bypass_non_commutatives", "test_collapse_MatrixBase", "test_cse_Indexed", "test_cse_MatrixExpr", "test_cse_MatrixSymbol", "test_cse_not_possible", "test_cse_single", "test_cse_single2", "test_deriv...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-11384
496e776108957d8c049cbef49522cef4c1955e2f
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py --- a/sympy/printing/latex.py +++ b/sympy/printing/latex.py @@ -1605,7 +1605,7 @@ def _print_FourierSeries(self, s): return self._print_Add(s.truncate()) + self._print(' + \ldots') def _print_FormalPowerSeries(self, s): - return self....
diff --git a/sympy/printing/pretty/tests/test_pretty.py b/sympy/printing/pretty/tests/test_pretty.py --- a/sympy/printing/pretty/tests/test_pretty.py +++ b/sympy/printing/pretty/tests/test_pretty.py @@ -3430,20 +3430,32 @@ def test_pretty_FourierSeries(): def test_pretty_FormalPowerSeries(): f = fps(log(1 + x)) ...
fps should print as a formal power series When I first used `fps`, I didn't realize it really was a formal power series as it claims to be, because it prints like a normal series (same as `series`) ``` In [21]: fps(sin(x)) Out[21]: 3 5 x x ⎛ 6⎞ x - ── + ─── + O⎝x ⎠ 6 120 ``` But if you loo...
> That is, it really does represent it as the formula Sum((-1)**n/factorial(2_n + 1)_x**n, (n, 0, oo)) (albiet, not simplified). It out to print it like this, so you can see that that's what it's working with. I got to admit that not much discussion was done on the printing aspect of Formal Power Series. When I first...
2016-07-11T22:33:27Z
1
["test_pretty_FourierSeries"]
["test_Adjoint", "test_Assignment", "test_AugmentedAssignment", "test_EulerGamma", "test_GoldenRatio", "test_GroebnerBasis", "test_Hadamard", "test_Homomorphism", "test_MatrixExpressions", "test_Modules", "test_Mul", "test_PolynomialRingBase", "test_Pow", "test_PrettyModules", "test_PrettyPoly", "test_ProductSet_parant...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-11400
8dcb12a6cf500e8738d6729ab954a261758f49ca
diff --git a/sympy/printing/ccode.py b/sympy/printing/ccode.py --- a/sympy/printing/ccode.py +++ b/sympy/printing/ccode.py @@ -231,6 +231,20 @@ def _print_Symbol(self, expr): else: return name + def _print_Relational(self, expr): + lhs_code = self._print(expr.lhs) + rhs_code = s...
diff --git a/sympy/printing/tests/test_ccode.py b/sympy/printing/tests/test_ccode.py --- a/sympy/printing/tests/test_ccode.py +++ b/sympy/printing/tests/test_ccode.py @@ -120,6 +120,16 @@ def test_ccode_boolean(): assert ccode((x | y) & z) == "z && (x || y)" +def test_ccode_Relational(): + from sympy import...
ccode(sinc(x)) doesn't work ``` In [30]: ccode(sinc(x)) Out[30]: '// Not supported in C:\n// sinc\nsinc(x)' ``` I don't think `math.h` has `sinc`, but it could print ``` In [38]: ccode(Piecewise((sin(theta)/theta, Ne(theta, 0)), (1, True))) Out[38]: '((Ne(theta, 0)) ? (\n sin(theta)/theta\n)\n: (\n 1\n))' ```
@asmeurer I would like to fix this issue. Should I work upon the codegen.py file ? If there's something else tell me how to start ? The relevant file is sympy/printing/ccode.py @asmeurer I am new here. I would like to work on this issue. Please tell me how to start? Since there are two people asking, maybe one pers...
2016-07-15T21:40:49Z
1
["test_ccode_Relational", "test_ccode_sinc"]
["test_Matrix_printing", "test_ccode_Assignment", "test_ccode_ITE", "test_ccode_Indexed", "test_ccode_Indexed_without_looking_for_contraction", "test_ccode_Integer", "test_ccode_Piecewise", "test_ccode_Piecewise_deep", "test_ccode_Pow", "test_ccode_Rational", "test_ccode_boolean", "test_ccode_constants_mathh", "test_cc...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-11618
360290c4c401e386db60723ddb0109ed499c9f6e
diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py --- a/sympy/geometry/point.py +++ b/sympy/geometry/point.py @@ -266,6 +266,20 @@ def distance(self, p): sqrt(x**2 + y**2) """ + if type(p) is not type(self): + if len(p) == len(self): + return sqrt(sum([(...
diff --git a/sympy/geometry/tests/test_point.py b/sympy/geometry/tests/test_point.py --- a/sympy/geometry/tests/test_point.py +++ b/sympy/geometry/tests/test_point.py @@ -243,6 +243,11 @@ def test_issue_9214(): assert Point3D.are_collinear(p1, p2, p3) is False +def test_issue_11617(): + p1 = Point3D(1,0,2) ...
distance calculation wrong ``` python >>> Point(2,0).distance(Point(1,0,2)) 1 ``` The 3rd dimension is being ignored when the Points are zipped together to calculate the distance so `sqrt((2-1)**2 + (0-0)**2)` is being computed instead of `sqrt(5)`.
null
2016-09-15T20:01:58Z
1
["test_issue_11617"]
["test_Point2D", "test_issue_9214", "test_point3D", "test_transform"]
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-11796
8e80c0be90728b915942d7953e4b2c5d56deb570
diff --git a/sympy/sets/sets.py b/sympy/sets/sets.py --- a/sympy/sets/sets.py +++ b/sympy/sets/sets.py @@ -737,6 +737,8 @@ def __new__(cls, start, end, left_open=False, right_open=False): if end == start and (left_open or right_open): return S.EmptySet if end == start and not (left_open o...
diff --git a/sympy/sets/tests/test_sets.py b/sympy/sets/tests/test_sets.py --- a/sympy/sets/tests/test_sets.py +++ b/sympy/sets/tests/test_sets.py @@ -35,6 +35,8 @@ def test_interval_arguments(): assert Interval(-oo, 0) == Interval(-oo, 0, True, False) assert Interval(-oo, 0).left_open is true assert Int...
Where oo belongs? (Concept) Hi again, well, i'm little confuse of the conditions to take or not `oo` in some sets: ``` python >>> Interval(-oo, oo) (-oo, oo) ``` First the means the interval is created excluding `oo` and `-oo`, and interval interpret it in that way, but now: ``` python >>> Interval(oo, oo) {oo} ``` ...
Interval should represent a real interval. I think we decided in another issue that Interval should always be open for infinite boundaries, because it should always be a subset of S.Reals. So ``` >>> Interval(oo, oo) {oo} ``` is wrong. I'm going to modify the issue title to make this clearer. Regarding your other...
2016-11-02T07:46:32Z
1
["test_interval_arguments"]
["test_EmptySet", "test_Eq", "test_Finite_as_relational", "test_Intersection_as_relational", "test_Interval_as_relational", "test_Interval_free_symbols", "test_Interval_is_left_unbounded", "test_Interval_is_right_unbounded", "test_ProductSet_of_single_arg_is_arg", "test_SymmetricDifference", "test_Union_as_relational",...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-11831
9ce74956ad542e069a9a7743bf0a751c5a26e727
diff --git a/sympy/sets/sets.py b/sympy/sets/sets.py --- a/sympy/sets/sets.py +++ b/sympy/sets/sets.py @@ -665,6 +665,11 @@ def _measure(self): def __len__(self): return Mul(*[len(s) for s in self.args]) + def __bool__(self): + return all([bool(s) for s in self.args]) + + __nonzero__ = __bo...
diff --git a/sympy/sets/tests/test_sets.py b/sympy/sets/tests/test_sets.py --- a/sympy/sets/tests/test_sets.py +++ b/sympy/sets/tests/test_sets.py @@ -963,6 +963,8 @@ def test_issue_Symbol_inter(): assert Intersection(FiniteSet(x**2, 1, sin(x)), FiniteSet(x**2, 2, sin(x)), r) == \ Intersection(r, FiniteSe...
set intersection gives TypeError: object of type 'Naturals0' has no len() This is from https://stackoverflow.com/questions/40441532/how-to-restrict-sympy-finiteset-containing-symbol ``` In [47]: d = symbols("d") In [48]: solution = sets.FiniteSet((d + 1, -d + 4, -d + 5, d)) In [49]: solution.intersect(S.Naturals0**4...
null
2016-11-09T17:16:28Z
1
["test_issue_11827"]
["test_EmptySet", "test_Eq", "test_Finite_as_relational", "test_Intersection_as_relational", "test_Interval_as_relational", "test_Interval_free_symbols", "test_Interval_is_left_unbounded", "test_Interval_is_right_unbounded", "test_ProductSet_of_single_arg_is_arg", "test_SymmetricDifference", "test_Union_as_relational",...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-12301
5155b7641fa389e10aeb5cfebcbefba02cb9221c
diff --git a/sympy/simplify/cse_main.py b/sympy/simplify/cse_main.py --- a/sympy/simplify/cse_main.py +++ b/sympy/simplify/cse_main.py @@ -310,10 +310,18 @@ def update(k): # remove it if Func is Add: take = min(func_dicts[k][i] for i in com_dict) - com_func_take...
diff --git a/sympy/simplify/tests/test_cse.py b/sympy/simplify/tests/test_cse.py --- a/sympy/simplify/tests/test_cse.py +++ b/sympy/simplify/tests/test_cse.py @@ -422,6 +422,13 @@ def test_issue_8891(): def test_issue_11230(): + # a specific test that always failed + a, b, f, k, l, i = symbols('a b f k l i')...
Test failure in Travis ``` ______________ sympy/simplify/tests/test_cse.py:test_issue_11230 _______________ File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/simplify/tests/test_cse.py", line 433, in test_issue_11230 assert not any(i.is_Mul for a in C for i in ...
Log is here, https://travis-ci.org/sympy/sympy/jobs/163790187 Permanent link, https://gist.github.com/isuruf/9410c21df1be658d168727018007a63a ping @smichr Seeing jobs failing frequently now https://travis-ci.org/sympy/sympy/jobs/164977570 https://travis-ci.org/sympy/sympy/jobs/164880234 It seems that the failure is...
2017-03-13T01:22:47Z
1
["test_issue_11230"]
["test_Piecewise", "test_bypass_non_commutatives", "test_cse_MatrixExpr", "test_cse_MatrixSymbol", "test_cse_not_possible", "test_cse_single", "test_cse_single2", "test_dont_cse_tuples", "test_hollow_rejection", "test_issue_10228", "test_issue_4020", "test_issue_4203", "test_issue_4498", "test_issue_4499", "test_issue_...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-12307
c9c6b85407a5d2b1bd5ee750e66b03c75ff35271
diff --git a/sympy/printing/fcode.py b/sympy/printing/fcode.py --- a/sympy/printing/fcode.py +++ b/sympy/printing/fcode.py @@ -106,6 +106,14 @@ def _get_statement(self, codestring): def _get_comment(self, text): return "! {0}".format(text) +#issue 12267 + def _print_sign(self,func): + if func....
diff --git a/sympy/printing/tests/test_fcode.py b/sympy/printing/tests/test_fcode.py --- a/sympy/printing/tests/test_fcode.py +++ b/sympy/printing/tests/test_fcode.py @@ -1,6 +1,6 @@ from sympy import (sin, cos, atan2, log, exp, gamma, conjugate, sqrt, factorial, Integral, Piecewise, Add, diff, symbols, S, Float,...
Codegen: sign function in Fortran The Fortran code generated by Sympy for the sign function is not a valid Fortran syntax. With Sympy 1.0 and Python 3.6: ```python In [1]: import sympy as sp In [2]: from sympy.abc import x In [3]: sp.fcode(sp.sign(x)) Out[3]: ' sign(x)' ``` (The same behavior is obtained with `...
The x=0 case probably matters, because SymPy could return an expression that uses `sign` assuming that meaning. Does Fortran have ternary expressions? Looks like fortran does support ternary expressions though `merge`: https://en.wikipedia.org/wiki/%3F:#Fortran @bjodah I would like to work in this issue. Could you pl...
2017-03-14T05:25:07Z
1
["test_fcode_sign"]
["test_Matrix_printing", "test_assign_to", "test_derived_classes", "test_fcode_Float", "test_fcode_Integer", "test_fcode_Logical", "test_fcode_NumberSymbol", "test_fcode_Piecewise", "test_fcode_Pow", "test_fcode_Rational", "test_fcode_Relational", "test_fcode_Xlogical", "test_fcode_complex", "test_fcode_functions", "te...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-12419
479939f8c65c8c2908bbedc959549a257a7c0b0b
diff --git a/sympy/matrices/expressions/matexpr.py b/sympy/matrices/expressions/matexpr.py --- a/sympy/matrices/expressions/matexpr.py +++ b/sympy/matrices/expressions/matexpr.py @@ -2,11 +2,12 @@ from functools import wraps -from sympy.core import S, Symbol, Tuple, Integer, Basic, Expr +from sympy.core import S, ...
diff --git a/sympy/matrices/expressions/tests/test_matexpr.py b/sympy/matrices/expressions/tests/test_matexpr.py --- a/sympy/matrices/expressions/tests/test_matexpr.py +++ b/sympy/matrices/expressions/tests/test_matexpr.py @@ -65,6 +65,7 @@ def test_ZeroMatrix(): with raises(ShapeError): Z**2 + def tes...
Sum of the elements of an identity matrix is zero I think this is a bug. I created a matrix by M.T * M under an assumption that M is orthogonal. SymPy successfully recognized that the result is an identity matrix. I tested its identity-ness by element-wise, queries, and sum of the diagonal elements and received expe...
@wakita shouldn't these be 1 I would like to work on this issue ``` >>> Sum(e[0,i],(i,0,n-1)).doit() 0 >>> Sum(e[i,0],(i,0,n-1)).doit() 0 ``` Hey, I would like to try to solve this issue. Where should I look first? Interesting observation if I replace j with i in e[i, j] the answer comes as n**2 which is correct.. @Ve...
2017-03-25T15:02:26Z
1
["test_Identity"]
["test_Identity_doit", "test_MatPow", "test_MatrixElement_commutative", "test_MatrixElement_diff", "test_MatrixElement_doit", "test_MatrixSymbol", "test_MatrixSymbol_determinant", "test_ZeroMatrix", "test_ZeroMatrix_doit", "test_Zero_power", "test_addition", "test_dense_conversion", "test_free_symbols", "test_identity_...
50b81f9f6be151014501ffac44e5dc6b2416938f
sympy/sympy
sympy__sympy-12881
d2c3800fd3aaa226c0d37da84086530dd3e5abaf
diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py --- a/sympy/polys/polytools.py +++ b/sympy/polys/polytools.py @@ -255,7 +255,7 @@ def free_symbols(self): ======== >>> from sympy import Poly - >>> from sympy.abc import x, y + >>> from sympy.abc import x, y, z ...
diff --git a/sympy/polys/tests/test_polytools.py b/sympy/polys/tests/test_polytools.py --- a/sympy/polys/tests/test_polytools.py +++ b/sympy/polys/tests/test_polytools.py @@ -468,6 +468,8 @@ def test_Poly_free_symbols(): assert Poly(x**2 + sin(y*z)).free_symbols == {x, y, z} assert Poly(x**2 + sin(y*z), x).fr...
Poly(x,x,y).free_symbols -> {x, y} instead of just {x} No free symbols of generators that don't appear in the expression of the polynomial should appear in the set of free symbols. ``` def free_symbols(poly): free = set() for i in range(len(poly.gens)): for m in poly.monoms(): if i in m: free...
```diff diff --git a/sympy/polys/polytools.py b/sympy/polys/polytools.py index 9c12741..92e7ca6 100644 --- a/sympy/polys/polytools.py +++ b/sympy/polys/polytools.py @@ -255,7 +255,7 @@ def free_symbols(self): ======== >>> from sympy import Poly - >>> from sympy.abc import x, y + >>> fr...
2017-07-03T15:25:50Z
1.1
["test_Poly_free_symbols", "test_Poly_ltrim"]
["test_GroebnerBasis", "test_Poly_EC", "test_Poly_EM", "test_Poly_ET", "test_Poly_LC", "test_Poly_LM", "test_Poly_LM_custom_order", "test_Poly_LT", "test_Poly_TC", "test_Poly___call__", "test_Poly__args", "test_Poly__eq__", "test_Poly__gen_to_level", "test_Poly__gens", "test_Poly__new__", "test_Poly__unify", "test_Poly...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13031
2dfa7457f20ee187fbb09b5b6a1631da4458388c
diff --git a/sympy/matrices/sparse.py b/sympy/matrices/sparse.py --- a/sympy/matrices/sparse.py +++ b/sympy/matrices/sparse.py @@ -985,8 +985,10 @@ def col_join(self, other): >>> C == A.row_insert(A.rows, Matrix(B)) True """ - if not self: - return type(self)(other) + ...
diff --git a/sympy/matrices/tests/test_sparse.py b/sympy/matrices/tests/test_sparse.py --- a/sympy/matrices/tests/test_sparse.py +++ b/sympy/matrices/tests/test_sparse.py @@ -26,6 +26,12 @@ def sparse_zeros(n): assert type(a.row_join(b)) == type(a) assert type(a.col_join(b)) == type(a) + # make sure 0 x ...
Behavior of Matrix hstack and vstack changed in sympy 1.1 In sympy 1.0: ``` import sympy as sy M1 = sy.Matrix.zeros(0, 0) M2 = sy.Matrix.zeros(0, 1) M3 = sy.Matrix.zeros(0, 2) M4 = sy.Matrix.zeros(0, 3) sy.Matrix.hstack(M1, M2, M3, M4).shape ``` returns `(0, 6)` Now, same in sympy 1.1: ``` import sympy as sy M1 = sy....
CC @siefkenj I update my comment in case someone already read it. We still have an issue with matrices shape in [pyphs](https://github.com/pyphs/pyphs/issues/49#issuecomment-316618994), but hstack and vstack seem ok in sympy 1.1.1rc1: ``` >>> import sympy as sy >>> sy.__version__ '1.1.1rc1' >>> '1.1.1rc1' '1.1.1rc1' ...
2017-07-23T15:48:13Z
1.1
["test_sparse_matrix"]
["test_CL_RL", "test_add", "test_copyin", "test_errors", "test_len", "test_sparse_solve", "test_sparse_zeros_sparse_eye", "test_trace", "test_transpose"]
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13091
d1320814eda6549996190618a21eaf212cfd4d1e
diff --git a/sympy/core/basic.py b/sympy/core/basic.py --- a/sympy/core/basic.py +++ b/sympy/core/basic.py @@ -313,7 +313,7 @@ def __eq__(self, other): try: other = _sympify(other) except SympifyError: - return False # sympy != other + return N...
diff --git a/sympy/core/tests/test_basic.py b/sympy/core/tests/test_basic.py --- a/sympy/core/tests/test_basic.py +++ b/sympy/core/tests/test_basic.py @@ -38,6 +38,43 @@ def test_equality(): assert Basic() != 0 assert not(Basic() == 0) + class Foo(object): + """ + Class that is unaware of B...
Return NotImplemented, not False, upon rich comparison with unknown type Comparison methods should ideally return ``NotImplemented`` when unable to make sense of the arguments. This way, the comparison is delegated to the reflected method on the other object, which might support the comparison (see https://docs.python....
Classes are generally required to subclass from Basic to interoperate with SymPy. What happens in the test suite if you change it to NotImplemented? Subclassing won't help in this case, it will just move the problem to line 319 (returns ``False`` if sympy types are different). Which is to say, ``NotImplemented`` shou...
2017-08-05T08:04:32Z
1.1
["test_comparisons_with_unknown_type", "test_equality", "test_powers_Integer", "test_powers_Rational"]
["test_Catalan_EulerGamma_prec", "test_Div_By_Zero", "test_Float", "test_Float_RealElement", "test_Float_default_to_highprec_from_str", "test_Float_eq", "test_Float_eval", "test_Float_gcd_lcm_cofactors", "test_Float_idempotence", "test_Float_issue_2107", "test_GoldenRatio_expand", "test_Infinity", "test_Infinity_2", "t...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13185
5f35c254434bfda69ecf2b6879590ec6b3478136
diff --git a/sympy/simplify/cse_main.py b/sympy/simplify/cse_main.py --- a/sympy/simplify/cse_main.py +++ b/sympy/simplify/cse_main.py @@ -485,6 +485,7 @@ def tree_cse(exprs, symbols, opt_subs=None, order='canonical', ignore=()): Substitutions containing any Symbol from ``ignore`` will be ignored. """ ...
diff --git a/sympy/simplify/tests/test_cse.py b/sympy/simplify/tests/test_cse.py --- a/sympy/simplify/tests/test_cse.py +++ b/sympy/simplify/tests/test_cse.py @@ -323,6 +323,10 @@ def test_cse_MatrixSymbol(): B = MatrixSymbol("B", n, n) assert cse(B) == ([], [B]) + assert cse(A[0] * A[0]) == ([], [A[0]*A...
cse() has strange behaviour for MatrixSymbol indexing Example: ```python import sympy as sp from pprint import pprint def sub_in_matrixsymbols(exp, matrices): for matrix in matrices: for i in range(matrix.shape[0]): for j in range(matrix.shape[1]): name = "%s_%d_%d" % (matrix....
Can you create a very simple example using MatrixSymbol and the expected output that you'd like to see? I think one would expect the output to be similar to the following (except for the expression returned by CSE being a matrix where the individual elements are terms as defined by matrix multiplication, that is, uncha...
2017-08-24T05:47:38Z
1.1
["test_cse_MatrixSymbol"]
["test_Piecewise", "test_bypass_non_commutatives", "test_cse_MatrixExpr", "test_cse__performance", "test_cse_ignore", "test_cse_not_possible", "test_cse_single", "test_cse_single2", "test_dont_cse_tuples", "test_hollow_rejection", "test_ignore_order_terms", "test_issue_11230", "test_issue_12070", "test_issue_13000", "t...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13265
1599a0d7cdf529c2d0db3a68e74a9aabb8334aa5
diff --git a/sympy/simplify/simplify.py b/sympy/simplify/simplify.py --- a/sympy/simplify/simplify.py +++ b/sympy/simplify/simplify.py @@ -594,7 +594,7 @@ def shorter(*choices): short = shorter(short, cancel(short)) short = shorter(short, factor_terms(short), expand_power_exp(expand_mul(short))) if short...
diff --git a/sympy/simplify/tests/test_simplify.py b/sympy/simplify/tests/test_simplify.py --- a/sympy/simplify/tests/test_simplify.py +++ b/sympy/simplify/tests/test_simplify.py @@ -156,8 +156,11 @@ def test_simplify_other(): def test_simplify_complex(): cosAsExp = cos(x)._eval_rewrite_as_exp(x) tanAsExp = ...
Simplification fails to recognize sin expressed as exponentials ``` In [2]: exp(Matrix([[0, -1, 0], [1, 0, 0], [0, 0, 0]])) Out[2]: ⎡ -ⅈ ⅈ -ⅈ ⅈ ⎤ ⎢ ℯ ℯ ⅈ⋅ℯ ⅈ⋅ℯ ⎥ ⎢ ─── + ── - ───── + ──── 0⎥ ⎢ 2 2 2 2 ⎥ ⎢ ⎥ ⎢ ...
null
2017-09-06T17:22:10Z
1.1
["test_exptrigsimp", "test_simplify_complex"]
["test_Piecewise", "test_as_content_primitive", "test_diff", "test_extract_minus_sign", "test_hyperbolic_simp", "test_hypersimp", "test_inequality_no_auto_simplify", "test_issue_2827_trigsimp_methods", "test_issue_3210", "test_issue_3557", "test_issue_4194", "test_issue_4280", "test_issue_4373", "test_issue_4494", "tes...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13286
42136729bb7252803b0b52a8326a33d6e9b1e06a
diff --git a/sympy/calculus/util.py b/sympy/calculus/util.py --- a/sympy/calculus/util.py +++ b/sympy/calculus/util.py @@ -328,22 +328,66 @@ def periodicity(f, symbol, check=False): """ from sympy import simplify, lcm_list - from sympy.functions.elementary.trigonometric import TrigonometricFunction + ...
diff --git a/sympy/calculus/tests/test_util.py b/sympy/calculus/tests/test_util.py --- a/sympy/calculus/tests/test_util.py +++ b/sympy/calculus/tests/test_util.py @@ -94,6 +94,14 @@ def test_periodicity(): assert periodicity(exp(x)**sin(x), x) is None assert periodicity(sin(x)**y, y) is None + assert per...
periodicity(Abs(sin(x)),x) return 2*pi periodicity(Abs(sin(x)),x) returns 2*pi instead of pi ``` >>> from sympy import * >>> x=Symbol('x') >>> periodicity(Abs(sin(x)),x,check=True) 2*pi >>> periodicity(Abs(sin(x)),x) 2*pi ``` #13205 periodicity(x > 2, x) give recursion error and #13207 It fixes issue #13205 it will st...
Can I have this issue ? Note by the docstring we are not guaranteed to get the fundamental period. But of course it would be good to improve the answer if possible. @souravghosh97 Can you add few tests that could justify your changes. @smichr I don't know why this test fails.But the test runs locally [https://travis-...
2017-09-09T16:46:34Z
1.1
["test_decompogen", "test_periodicity_check"]
["test_AccumBounds", "test_AccumBounds_div", "test_AccumBounds_func", "test_AccumBounds_mul", "test_AccumBounds_pow", "test_comparison_AccumBounds", "test_continuous_domain", "test_decompogen_poly", "test_lcim", "test_not_empty_in"]
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13429
ac03325b44485e603992a0bb783536a9f8a9152f
diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py --- a/sympy/core/numbers.py +++ b/sympy/core/numbers.py @@ -1259,13 +1259,13 @@ def __eq__(self, other): other = _sympify(other) except SympifyError: return NotImplemented - if isinstance(other, NumberSymbol): + ...
diff --git a/sympy/core/tests/test_relational.py b/sympy/core/tests/test_relational.py --- a/sympy/core/tests/test_relational.py +++ b/sympy/core/tests/test_relational.py @@ -718,6 +718,55 @@ def test_issue_10927(): assert str(Eq(x, -oo)) == 'Eq(x, -oo)' +def test_issues_13081_12583_12534(): + # 13081 + ...
Some comparisons between rational and irrational numbers are incorrect If you choose just the right rational number, you can end up in a situation where it is neither less than pi, nor equal to it, nor is pi less than it. This is with sympy 1.1.1, using Python 3.6.0 from Anaconda on Ubuntu 16.04. ``` >>> import sympy >...
Some experimentation shows that the behavior can be improved by computing the difference and then looking at the sign with .is_positive and .is_negative. However, that can break as well, you just need a bigger fraction: ``` >>> r = sympy.Rational('472202503979844695356573871761845338575143343779448489867569357017941709...
2017-10-10T13:20:35Z
1.1
["test_issues_13081_12583_12534"]
["test_Eq", "test_Not", "test_binary_symbols", "test_bool", "test_canonical", "test_complex_compare_not_real", "test_complex_infinity_inequalities", "test_complex_pure_imag_not_ordered", "test_doit", "test_equals", "test_evaluate", "test_imaginary_and_inf_compare_raises_TypeError", "test_imaginary_compare_raises_TypeEr...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13441
e0cd7d65857a90376a9b49529840f96908dd774f
diff --git a/sympy/core/add.py b/sympy/core/add.py --- a/sympy/core/add.py +++ b/sympy/core/add.py @@ -396,13 +396,26 @@ def matches(self, expr, repl_dict={}, old=False): @staticmethod def _combine_inverse(lhs, rhs): """ - Returns lhs - rhs, but treats arguments like symbols, so things like - ...
diff --git a/sympy/core/tests/test_match.py b/sympy/core/tests/test_match.py --- a/sympy/core/tests/test_match.py +++ b/sympy/core/tests/test_match.py @@ -396,7 +396,7 @@ def test_match_wild_wild(): assert p.match(q*r) is None -def test_combine_inverse(): +def test__combine_inverse(): x, y = symbols("x y"...
count_ops is slow for large expressions It seems that this script was hanging inside `count_ops`: ``` moorepants@garuda:pydy.wiki(master)$ SYMPY_CACHE_SIZE=10000 ipython Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec 7 2015, 11:16:01) Type "copyright", "credits" or "license" for more information. IPython 4....
My first thought is that the following ``` 202 if not old and (expr.is_Add or expr.is_Mul): 203 if newexpr.count_ops() > expr.count_ops(): ``` should be ``` if not old and (expr.is_Add or expr.is_Mul): len(expr.func.make_args(newexpr)) > len(expr.args): ``` Here is a pyinstrument pro...
2017-10-13T13:05:09Z
1.1
["test__combine_inverse"]
["test_Derivative_bug1", "test_add", "test_complex", "test_derivative1", "test_derivative2", "test_derivative_bug1", "test_exclude", "test_floats", "test_functions", "test_interface", "test_issue_3539", "test_issue_3773", "test_issue_3778", "test_issue_3883", "test_issue_4319", "test_issue_4418", "test_issue_4559", "te...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13551
9476425b9e34363c2d9ac38e9f04aa75ae54a775
diff --git a/sympy/concrete/products.py b/sympy/concrete/products.py --- a/sympy/concrete/products.py +++ b/sympy/concrete/products.py @@ -282,8 +282,8 @@ def _eval_product(self, term, limits): # There is expression, which couldn't change by # as_numer_denom(). E.g. n**(2/3) + 1 --> (n...
diff --git a/sympy/concrete/tests/test_products.py b/sympy/concrete/tests/test_products.py --- a/sympy/concrete/tests/test_products.py +++ b/sympy/concrete/tests/test_products.py @@ -355,6 +355,13 @@ def test_issue_9983(): assert product(1 + 1/n**(S(2)/3), (n, 1, oo)) == p.doit() +def test_issue_13546(): + ...
Product(n + 1 / 2**k, [k, 0, n-1]) is incorrect >>> from sympy import * >>> from sympy.abc import n,k >>> p = Product(n + 1 / 2**k, [k, 0, n-1]).doit() >>> print(simplify(p)) 2**(n*(-n + 1)/2) + n**n >>> print(p.subs(n,2)) 9/2 This is incorrect- for example, the product for `n=2` is `(2 + 2...
The responsible line seems to be [line 286](https://github.com/sympy/sympy/blob/97571bba21c7cab8ef81c40ff6d257a5e151cc8d/sympy/concrete/products.py#L286) in concrete/products. This line seems to be assuming that the product of a sum is the same as the sum of the products of its summands. This leads to nonsense like t...
2017-10-29T20:51:01Z
1.1
["test_issue_13546"]
["test_Product_is_convergent", "test__eval_product", "test_change_index", "test_conjugate_transpose", "test_infinite_product", "test_issue_9983", "test_karr_convention", "test_karr_proposition_2a", "test_karr_proposition_2b", "test_multiple_products", "test_product_pow", "test_rational_products", "test_reorder", "test_...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13581
a531dfdf2c536620fdaf080f7470dde08c257e92
diff --git a/sympy/core/mod.py b/sympy/core/mod.py --- a/sympy/core/mod.py +++ b/sympy/core/mod.py @@ -107,6 +107,38 @@ def doit(p, q): elif (qinner*(q + qinner)).is_nonpositive: # |qinner| < |q| and have different sign return p + elif isinstance(p, Add): + ...
diff --git a/sympy/core/tests/test_arit.py b/sympy/core/tests/test_arit.py --- a/sympy/core/tests/test_arit.py +++ b/sympy/core/tests/test_arit.py @@ -1655,6 +1655,12 @@ def test_Mod(): # issue 10963 assert (x**6000%400).args[1] == 400 + #issue 13543 + assert Mod(Mod(x + 1, 2) + 1 , 2) == Mod(x,2) + +...
Mod(Mod(x + 1, 2) + 1, 2) should simplify to Mod(x, 2) From [stackoverflow](https://stackoverflow.com/questions/46914006/modulo-computations-in-sympy-fail) Also, something like `Mod(foo*Mod(x + 1, 2) + non_mod_terms + 1, 2)` could be simplified. Recursively.
null
2017-11-09T19:53:47Z
1.1
["test_Mod"]
["test_Add_Mul_is_finite", "test_Add_Mul_is_integer", "test_Add_as_coeff_mul", "test_Add_as_content_primitive", "test_Add_is_comparable", "test_Add_is_even_odd", "test_Add_is_irrational", "test_Add_is_negative_positive", "test_Add_is_nonpositive_nonnegative", "test_Add_is_positive_2", "test_Add_is_rational", "test_Mod_...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13773
7121bdf1facdd90d05b6994b4c2e5b2865a4638a
diff --git a/sympy/matrices/common.py b/sympy/matrices/common.py --- a/sympy/matrices/common.py +++ b/sympy/matrices/common.py @@ -1973,6 +1973,10 @@ def __div__(self, other): @call_highest_priority('__rmatmul__') def __matmul__(self, other): + other = _matrixify(other) + if not getattr(other,...
diff --git a/sympy/matrices/tests/test_commonmatrix.py b/sympy/matrices/tests/test_commonmatrix.py --- a/sympy/matrices/tests/test_commonmatrix.py +++ b/sympy/matrices/tests/test_commonmatrix.py @@ -674,6 +674,30 @@ def test_multiplication(): assert c[1, 0] == 3*5 assert c[1, 1] == 0 +def test_matmu...
@ (__matmul__) should fail if one argument is not a matrix ``` >>> A = Matrix([[1, 2], [3, 4]]) >>> B = Matrix([[2, 3], [1, 2]]) >>> A@B Matrix([ [ 4, 7], [10, 17]]) >>> 2@B Matrix([ [4, 6], [2, 4]]) ``` Right now `@` (`__matmul__`) just copies `__mul__`, but it should actually only work if the multiplication is actu...
Note to anyone fixing this: `@`/`__matmul__` only works in Python 3.5+. I would like to work on this issue.
2017-12-19T10:44:38Z
1.1
["test_matmul"]
["test__MinimalMatrix", "test_abs", "test_add", "test_adjoint", "test_adjugate", "test_as_real_imag", "test_atoms", "test_charpoly", "test_cofactor_and_minors", "test_col_insert", "test_col_join", "test_col_op", "test_columnspace", "test_conjugate", "test_det", "test_diag", "test_diagonal_symmetrical", "test_doit", "te...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13808
4af4487cfd254af747670a2324b6f24ae0a55a66
diff --git a/sympy/integrals/integrals.py b/sympy/integrals/integrals.py --- a/sympy/integrals/integrals.py +++ b/sympy/integrals/integrals.py @@ -8,7 +8,7 @@ from sympy.core.expr import Expr from sympy.core.function import diff from sympy.core.mul import Mul -from sympy.core.numbers import oo +from sympy.core.numbe...
diff --git a/sympy/integrals/tests/test_integrals.py b/sympy/integrals/tests/test_integrals.py --- a/sympy/integrals/tests/test_integrals.py +++ b/sympy/integrals/tests/test_integrals.py @@ -8,6 +8,7 @@ symbols, sympify, tan, trigsimp, Tuple, Si, Ci ) from sympy.functions.elementary.complexes import periodic_arg...
integrate(1/(2-cos(theta)),(theta,0,pi)) Sympy produces NaN. Actually for integrate(1/(a-cos(theta)),(theta,0,pi)) for a > 1 should be pi/sqrt((a-1)*(a+1)). So, the right answer should be pi/sqrt(3). However sympy seems to use the subtitution like t = tan(x/2) which is infinite when x = pi. When I try integrate(1/(2-...
null
2017-12-29T17:24:26Z
1.1
["test_issue_13749", "test_issue_8623", "test_issue_9569"]
["test_as_sum_left", "test_as_sum_midpoint1", "test_as_sum_midpoint2", "test_as_sum_raises", "test_as_sum_right", "test_as_sum_trapezoid", "test_atom_bug", "test_basics", "test_basics_multiple", "test_conjugate_transpose", "test_constructor", "test_diff_wrt", "test_doit_integrals", "test_double_integrals", "test_evalf_...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13840
8be967b5b2b81365c12030c41da68230e39cdf33
diff --git a/sympy/printing/rcode.py b/sympy/printing/rcode.py --- a/sympy/printing/rcode.py +++ b/sympy/printing/rcode.py @@ -22,7 +22,6 @@ known_functions = { #"Abs": [(lambda x: not x.is_integer, "fabs")], "Abs": "abs", - "gamma": "gamma", "sin": "sin", "cos": "cos", "tan": "tan", @@ -42...
diff --git a/sympy/printing/tests/test_rcode.py b/sympy/printing/tests/test_rcode.py --- a/sympy/printing/tests/test_rcode.py +++ b/sympy/printing/tests/test_rcode.py @@ -1,7 +1,7 @@ from sympy.core import (S, pi, oo, Symbol, symbols, Rational, Integer, GoldenRatio, EulerGamma, Catalan, Lambda...
Max & Min converting using SymPy Why many languages likes js and R cannot be converted from Max & Min? ![image](https://user-images.githubusercontent.com/26391392/34533015-54ffb7d4-f086-11e7-945a-5708f6739d5d.png)
I suppose these should be added, considering JavaScript does have `Math.max` and `Math.min`. Meanwhile, there is a workaround: Max(x, y) is equivalent to `(x+y+Abs(x-y))/2`, and Abs is supported. ``` >>> jscode((1+y+Abs(1-y)) / 2) '(1/2)*y + (1/2)*Math.abs(y - 1) + 1/2' ``` Similarly, Min(x, y) is equivalent to (x+...
2018-01-05T02:48:34Z
1.1
["test_rcode_functions"]
["test_Matrix_printing", "test_dereference_printing", "test_printmethod", "test_rcode_Assignment", "test_rcode_For", "test_rcode_ITE", "test_rcode_Integer", "test_rcode_Max", "test_rcode_Piecewise", "test_rcode_Piecewise_deep", "test_rcode_Pow", "test_rcode_Rational", "test_rcode_Relational", "test_rcode_boolean", "tes...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13852
c935e1d106743efd5bf0705fbeedbd18fadff4dc
diff --git a/sympy/functions/special/zeta_functions.py b/sympy/functions/special/zeta_functions.py --- a/sympy/functions/special/zeta_functions.py +++ b/sympy/functions/special/zeta_functions.py @@ -1,12 +1,12 @@ """ Riemann zeta and related function. """ from __future__ import print_function, division -from sympy....
diff --git a/sympy/functions/special/tests/test_zeta_functions.py b/sympy/functions/special/tests/test_zeta_functions.py --- a/sympy/functions/special/tests/test_zeta_functions.py +++ b/sympy/functions/special/tests/test_zeta_functions.py @@ -1,6 +1,6 @@ from sympy import (Symbol, zeta, nan, Rational, Float, pi, diric...
Add evaluation for polylog ``` In [1]: polylog(2, Rational(1,2)) Out[1]: polylog(2, 1/2) In [2]: polylog(2, Rational(1,2)).expand(func=True) Out[2]: polylog(2, 1/2) The answer should be -log(2)**2/2 + pi**2/12 In [11]: print(nsimplify(expand_func(polylog(2, Rational(1,2))).evalf(), [pi**2, log(2)**2])) -log(2)**2/2 ...
``` **Cc:** raou...@gmail.com ``` Original comment: http://code.google.com/p/sympy/issues/detail?id=4033#c1 Original author: https://code.google.com/u/asmeurer@gmail.com/
2018-01-06T23:54:51Z
1.1
["test_polylog_values"]
["test_dirichlet_eta_eval", "test_stieltjes", "test_stieltjes_evalf", "test_zeta_eval"]
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13878
7b127bdf71a36d85216315f80c1b54d22b060818
diff --git a/sympy/stats/crv_types.py b/sympy/stats/crv_types.py --- a/sympy/stats/crv_types.py +++ b/sympy/stats/crv_types.py @@ -47,7 +47,7 @@ from sympy import (log, sqrt, pi, S, Dummy, Interval, sympify, gamma, Piecewise, And, Eq, binomial, factorial, Sum, floor, Abs, - Lamb...
diff --git a/sympy/stats/tests/test_continuous_rv.py b/sympy/stats/tests/test_continuous_rv.py --- a/sympy/stats/tests/test_continuous_rv.py +++ b/sympy/stats/tests/test_continuous_rv.py @@ -1,4 +1,5 @@ from __future__ import division +from sympy.utilities.randtest import verify_numerically as tn from sympy.stats imp...
Precompute the CDF of several distributions where integration doesn't work well The way [continuous distributions](http://docs.sympy.org/dev/modules/stats.html#continuous-types) are implemented is that the density function (PDF) is defined, and then the cumulative distribution function (CDF) is meant to be obtained by ...
I am working on it !
2018-01-10T07:00:58Z
1.1
["test_arcsin"]
["test_ContinuousDomain", "test_benini", "test_characteristic_function", "test_chi", "test_chi_noncentral", "test_chi_squared", "test_conjugate_priors", "test_density_unevaluated", "test_gompertz", "test_input_value_assertions", "test_issue_10003", "test_prefab_sampling", "test_probability_unevaluated", "test_quadratic...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13915
5c1644ff85e15752f9f8721bc142bfbf975e7805
diff --git a/sympy/core/mul.py b/sympy/core/mul.py --- a/sympy/core/mul.py +++ b/sympy/core/mul.py @@ -423,6 +423,11 @@ def _gather(c_powers): changed = False for b, e in c_powers: if e.is_zero: + # canceling out infinities yields NaN + if...
diff --git a/sympy/core/tests/test_arit.py b/sympy/core/tests/test_arit.py --- a/sympy/core/tests/test_arit.py +++ b/sympy/core/tests/test_arit.py @@ -1,7 +1,7 @@ from __future__ import division from sympy import (Basic, Symbol, sin, cos, exp, sqrt, Rational, Float, re, pi, - sympify, Add, Mul, Pow, Mod, I, ...
Issue with a substitution that leads to an undefined expression ``` Python 3.6.4 |Anaconda custom (64-bit)| (default, Dec 21 2017, 15:39:08) Type 'copyright', 'credits' or 'license' for more information IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. In [1]: from sympy import * In [2]: a,b = symb...
In this regard, don't you think that `r.simplify()` is wrong? It returns `-a/b` which is not correct if b=a. `simplify` works for the generic case. SymPy would be hard to use if getting a+b from `simplify((a**2-b**2)/(a-b))` required an explicit declaration that a is not equal to b. (Besides, there is currently no way ...
2018-01-13T20:41:07Z
1.1
["test_Mul_does_not_cancel_infinities"]
["test_Add_Mul_is_finite", "test_Add_Mul_is_integer", "test_Add_as_coeff_mul", "test_Add_as_content_primitive", "test_Add_is_comparable", "test_Add_is_even_odd", "test_Add_is_irrational", "test_Add_is_positive_2", "test_Add_is_rational", "test_Mod_is_integer", "test_Mul_as_content_primitive", "test_Mul_doesnt_expand_ex...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3
sympy/sympy
sympy__sympy-13962
84c125972ad535b2dfb245f8d311d347b45e5b8a
diff --git a/sympy/printing/str.py b/sympy/printing/str.py --- a/sympy/printing/str.py +++ b/sympy/printing/str.py @@ -21,6 +21,7 @@ class StrPrinter(Printer): "order": None, "full_prec": "auto", "sympy_integers": False, + "abbrev": False, } _relationals = dict() @@ -706,6 ...
diff --git a/sympy/printing/tests/test_str.py b/sympy/printing/tests/test_str.py --- a/sympy/printing/tests/test_str.py +++ b/sympy/printing/tests/test_str.py @@ -593,6 +593,8 @@ def test_Quaternion_str_printer(): def test_Quantity_str(): + assert sstr(second, abbrev=True) == "s" + assert sstr(joule, abbrev=...
Printing should use short representation of quantities. There is a test that explicitly expects that printing does not use `abbrev` but `name`: https://github.com/sympy/sympy/blob/8e962a301d7cc2d6fc3fa83deedd82697a809fd6/sympy/physics/units/tests/test_quantities.py#L87 Is there a reason behind this? I find it quite use...
We could add a flag for it. Also I think the pretty printer should be using the shorter form always. Thanks! I created a PR: https://github.com/sympy/sympy/pull/13310 I don't even see a point of adding a flag for it, as one should not provide `abbrev` to a `Quantity` if one does not want it to be used. OK, there is lo...
2018-01-19T14:03:54Z
1.1
["test_Quantity_str"]
["test_Abs", "test_AccumBounds", "test_CRootOf", "test_Catalan", "test_Complement", "test_ComplexInfinity", "test_Derivative", "test_Dict", "test_Dummy", "test_Equivalent", "test_EulerGamma", "test_Exp", "test_FiniteSet", "test_Float", "test_FracElement", "test_FracField", "test_Function", "test_Geometry", "test_Golden...
ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3