repo stringclasses 11
values | instance_id stringlengths 18 32 | base_commit stringlengths 40 40 | patch stringlengths 314 3.81k | test_patch stringlengths 394 11.9k | problem_statement stringlengths 143 10.2k | hints_text stringlengths 0 8.86k | created_at stringdate 2013-01-25 05:19:16 2023-07-17 20:28:41 | version stringlengths 3 7 | FAIL_TO_PASS stringlengths 13 32.6k | PASS_TO_PASS stringlengths 2 271k | environment_setup_commit stringlengths 40 40 | difficulty stringclasses 1
value | target_file stringlengths 194 332k | patch_range listlengths 1 6 | file_path stringlengths 15 50 | image_name stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
matplotlib/matplotlib | matplotlib__matplotlib-25122 | 5ec2bd279729ff534719b8bf238dbbca907b93c5 | diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py
--- a/lib/matplotlib/mlab.py
+++ b/lib/matplotlib/mlab.py
@@ -395,12 +395,12 @@ def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None,
elif mode == 'psd':
result = np.conj(result) * result
elif mode == 'magnitude':
- ... | diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py
--- a/lib/matplotlib/tests/test_mlab.py
+++ b/lib/matplotlib/tests/test_mlab.py
@@ -615,7 +615,7 @@ def test_psd_window_hanning(self):
noverlap=0,
sides=self.sides,
... | [Bug]: Windows correction is not correct in `mlab._spectral_helper`
### Bug summary
Windows correction is not correct in `mlab._spectral_helper`:
https://github.com/matplotlib/matplotlib/blob/3418bada1c1f44da1f73916c5603e3ae79fe58c1/lib/matplotlib/mlab.py#L423-L430
The `np.abs` is not needed, and give wrong resu... | This is fixed by https://github.com/matplotlib/matplotlib/pull/22828 (?) although a test is required to get it merged.
I'm not sure that your code for reproduction actually shows the right thing though as Matplotlib is not involved.
> This is fixed by #22828 (?) although a test is required to get it merged.
#228... | 2023-02-01T03:41:00Z | 3.6 | ["lib/matplotlib/tests/test_mlab.py::TestSpectral::test_psd_window_flattop[Fs4-twosided-complex]", "lib/matplotlib/tests/test_mlab.py::TestSpectral::test_psd_window_flattop[Fs4-twosided-real]", "lib/matplotlib/tests/test_mlab.py::TestSpectral::test_psd_window_flattop[Fs4-onesided-complex]", "lib/matplotlib/tests/test_m... | ["lib/matplotlib/tests/test_mlab.py::TestStride::test_stride_windows_invalid_input_shape[0D]", "lib/matplotlib/tests/test_mlab.py::TestStride::test_stride_windows_invalid_input_shape[2D]", "lib/matplotlib/tests/test_mlab.py::TestStride::test_stride_windows_invalid_params[n", "lib/matplotlib/tests/test_mlab.py::TestStri... | 73909bcb408886a22e2b84581d6b9e6d9907c813 | <15 min fix | """
Numerical Python functions written for compatibility with MATLAB
commands with the same names. Most numerical Python functions can be found in
the `NumPy`_ and `SciPy`_ libraries. What remains here is code for performing
spectral computations and kernel density estimations.
.. _NumPy: https://numpy.org
.. _SciPy: ... | [
[
395,
406
],
[
424,
433
]
] | lib/matplotlib/mlab.py | python:3.11 |
matplotlib/matplotlib | matplotlib__matplotlib-25287 | f8ffce6d44127d4ea7d6491262ab30046b03294b | diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py
--- a/lib/matplotlib/axis.py
+++ b/lib/matplotlib/axis.py
@@ -2253,13 +2253,18 @@ def _init(self):
)
self.label_position = 'bottom'
+ if mpl.rcParams['xtick.labelcolor'] == 'inherit':
+ tick_color = mpl.rcParams['xtick.co... | diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -7811,6 +7811,28 @@ def test_ytickcolor_is_not_yticklabelcolor():
assert tick.label1.get_color() == 'blue'
+def test_xaxis_offsetText_color()... | [Bug]: offsetText is colored based on tick.color instead of tick.labelcolor
### Bug summary
In version 3.6.3, when setting ytick.labelcolor / xtick.labelcolor in styles / rcParams, it does not change the color of the exponent label as well. It will be colored based on xtick.color / ytick.color.
### Code for reproduct... | Seems reasonable. @gronniger did you want to try a PR for this?
Sorry, I think, right now I can not spend the time to write and test a proper PR
Hi, can I work on this bug?
@devRD Please do. We do not typically assign PRs, but it seems like no one else is working on it. Make sure that you add a test for it. | 2023-02-22T18:19:27Z | 3.7 | ["lib/matplotlib/tests/test_axes.py::test_xaxis_offsetText_color", "lib/matplotlib/tests/test_axes.py::test_yaxis_offsetText_color"] | ["lib/matplotlib/tests/test_axes.py::test_invisible_axes[png]", "lib/matplotlib/tests/test_axes.py::test_get_labels", "lib/matplotlib/tests/test_axes.py::test_repr", "lib/matplotlib/tests/test_axes.py::test_label_loc_vertical[png]", "lib/matplotlib/tests/test_axes.py::test_label_loc_vertical[pdf]", "lib/matplotlib/test... | 0849036fd992a2dd133a0cffc3f84f58ccf1840f | <15 min fix | """
Classes for the ticks and x- and y-axis.
"""
import datetime
import functools
import logging
from numbers import Real
import numpy as np
import matplotlib as mpl
from matplotlib import _api, cbook
import matplotlib.artist as martist
import matplotlib.colors as mcolors
import matplotlib.lines as mlines
import mat... | [
[
2253,
2270
],
[
2517,
2528
],
[
2530,
2536
]
] | lib/matplotlib/axis.py | python:3.11 |
matplotlib/matplotlib | matplotlib__matplotlib-25311 | 430fb1db88843300fb4baae3edc499bbfe073b0c | diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py
--- a/lib/matplotlib/offsetbox.py
+++ b/lib/matplotlib/offsetbox.py
@@ -1505,7 +1505,6 @@ def __init__(self, ref_artist, use_blit=False):
if not ref_artist.pickable():
ref_artist.set_picker(True)
self.got_artist = Fals... | diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py
--- a/lib/matplotlib/tests/test_pickle.py
+++ b/lib/matplotlib/tests/test_pickle.py
@@ -1,6 +1,7 @@
from io import BytesIO
import ast
import pickle
+import pickletools
import numpy as np
import pytest
@@ -88,6 +89,7 @@ def _ge... | [Bug]: Unable to pickle figure with draggable legend
### Bug summary
I am unable to pickle figure with draggable legend. Same error comes for draggable annotations.
### Code for reproduction
```python
import matplotlib.pyplot as plt
import pickle
fig = plt.figure()
ax = fig.add_subplot(111)
ti... | 2023-02-23T21:04:12Z | 3.7 | ["lib/matplotlib/tests/test_pickle.py::test_complete[png]"] | ["lib/matplotlib/tests/test_pickle.py::test_simple", "lib/matplotlib/tests/test_pickle.py::test_gcf", "lib/matplotlib/tests/test_pickle.py::test_no_pyplot", "lib/matplotlib/tests/test_pickle.py::test_renderer", "lib/matplotlib/tests/test_pickle.py::test_image", "lib/matplotlib/tests/test_pickle.py::test_polar", "lib/ma... | 0849036fd992a2dd133a0cffc3f84f58ccf1840f | <15 min fix | r"""
Container classes for `.Artist`\s.
`OffsetBox`
The base of all container artists defined in this module.
`AnchoredOffsetbox`, `AnchoredText`
Anchor and align an arbitrary `.Artist` or a text relative to the parent
axes or a specific anchor point.
`DrawingArea`
A container with fixed width and he... | [
[
1505,
1510
],
[
1513,
1521
]
] | lib/matplotlib/offsetbox.py | python:3.11 | |
matplotlib/matplotlib | matplotlib__matplotlib-25332 | 66ba515e671638971bd11a34cff12c107a437e0b | diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py
--- a/lib/matplotlib/cbook.py
+++ b/lib/matplotlib/cbook.py
@@ -788,6 +788,19 @@ class Grouper:
def __init__(self, init=()):
self._mapping = {weakref.ref(x): [weakref.ref(x)] for x in init}
+ def __getstate__(self):
+ return {
+ ... | diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py
--- a/lib/matplotlib/tests/test_pickle.py
+++ b/lib/matplotlib/tests/test_pickle.py
@@ -58,6 +58,7 @@ def _generate_complete_test_figure(fig_ref):
# Ensure lists also pickle correctly.
plt.subplot(3, 3, 1)
plt.plot(lis... | [Bug]: Unable to pickle figure with aligned labels
### Bug summary
Unable to pickle figure after calling `align_labels()`
### Code for reproduction
```python
import matplotlib.pyplot as plt
import pickle
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
time=[0,1,2,3,4]
speed=[... | As you've noted, pickling is pretty fragile. Do you _need_ to pickle? | 2023-02-26T11:18:40Z | 3.7 | ["lib/matplotlib/tests/test_pickle.py::test_complete[png]"] | ["lib/matplotlib/tests/test_pickle.py::test_simple", "lib/matplotlib/tests/test_pickle.py::test_gcf", "lib/matplotlib/tests/test_pickle.py::test_no_pyplot", "lib/matplotlib/tests/test_pickle.py::test_renderer", "lib/matplotlib/tests/test_pickle.py::test_image", "lib/matplotlib/tests/test_pickle.py::test_polar", "lib/ma... | 0849036fd992a2dd133a0cffc3f84f58ccf1840f | <15 min fix | """
A collection of utility functions and classes. Originally, many
(but not all) were from the Python Cookbook -- hence the name cbook.
"""
import collections
import collections.abc
import contextlib
import functools
import gzip
import itertools
import math
import operator
import os
from pathlib import Path
import s... | [
[
788,
806
]
] | lib/matplotlib/cbook.py | python:3.11 |
matplotlib/matplotlib | matplotlib__matplotlib-26113 | 5ca694b38d861c0e24cd8743753427dda839b90b | diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py
--- a/lib/matplotlib/axes/_axes.py
+++ b/lib/matplotlib/axes/_axes.py
@@ -5014,7 +5014,7 @@ def reduce_C_function(C: array) -> float
if mincnt is None:
mincnt = 0
accum = np.array(
- [reduc... | diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -999,6 +999,45 @@ def test_hexbin_log_clim():
assert h.get_clim() == (2, 100)
+@check_figures_equal(extensions=['png'])
+def test_hexbin_mincnt_b... | Inconsistent behavior of hexbins mincnt parameter, depending on C parameter
<!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->
<!--You can feel free to delete the sections that do not apply.-->
### Bug report
**Bug summary**
Different behavior of `hexbin... | Sorry for the slow reply; if you can submit a PR that would be great!
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If... | 2023-06-12T18:56:33Z | 3.7 | ["lib/matplotlib/tests/test_axes.py::test_hexbin_mincnt_behavior_upon_C_parameter[png]"] | ["lib/matplotlib/tests/test_axes.py::test_invisible_axes[png]", "lib/matplotlib/tests/test_axes.py::test_get_labels", "lib/matplotlib/tests/test_axes.py::test_repr", "lib/matplotlib/tests/test_axes.py::test_label_loc_vertical[png]", "lib/matplotlib/tests/test_axes.py::test_label_loc_vertical[pdf]", "lib/matplotlib/test... | 0849036fd992a2dd133a0cffc3f84f58ccf1840f | <15 min fix | import functools
import itertools
import logging
import math
from numbers import Integral, Number, Real
import numpy as np
from numpy import ma
import matplotlib as mpl
import matplotlib.category # Register category unit converter as side effect.
import matplotlib.cbook as cbook
import matplotlib.collections as mcol... | [
[
5014,
5020
]
] | lib/matplotlib/axes/_axes.py | python:3.11 |
matplotlib/matplotlib | matplotlib__matplotlib-26208 | f0f133943d3e4f1e2e665291fe1c8f658a84cc09 | diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py
--- a/lib/matplotlib/axes/_base.py
+++ b/lib/matplotlib/axes/_base.py
@@ -4441,6 +4441,7 @@ def twinx(self):
self.yaxis.tick_left()
ax2.xaxis.set_visible(False)
ax2.patch.set_visible(False)
+ ax2.xaxis.units = sel... | diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -376,6 +376,23 @@ def test_twinx_cla():
assert ax.yaxis.get_visible()
+@pytest.mark.parametrize('twin', ('x', 'y'))
+def test_twin_units(twin):
+... | [Bug]: dataLims get replaced by inf for charts with twinx if ax1 is a stackplot
### Bug summary
Bringing this over from Discourse https://discourse.matplotlib.org/t/datalims-get-replaced-by-inf-for-charts-with-twinx-if-ax1-is-a-stackplot/23887.
In Matplotlib 3.4.0 and later versions, when using twin x-axis (two-... | It also works if you:
- do not use the unit machinery (due to using strings to get catarogicals)
- using `plot` in the first axes
- creating the twin before you plot to either
This is an edge case in the unit handling code, PR incoming. | 2023-06-28T21:31:50Z | 3.7 | ["lib/matplotlib/tests/test_axes.py::test_twin_units[x]", "lib/matplotlib/tests/test_axes.py::test_twin_units[y]"] | ["lib/matplotlib/tests/test_axes.py::test_invisible_axes[png]", "lib/matplotlib/tests/test_axes.py::test_get_labels", "lib/matplotlib/tests/test_axes.py::test_repr", "lib/matplotlib/tests/test_axes.py::test_label_loc_vertical[png]", "lib/matplotlib/tests/test_axes.py::test_label_loc_vertical[pdf]", "lib/matplotlib/test... | 0849036fd992a2dd133a0cffc3f84f58ccf1840f | <15 min fix | from collections.abc import Iterable, Sequence
from contextlib import ExitStack
import functools
import inspect
import itertools
import logging
from numbers import Real
from operator import attrgetter
import types
import numpy as np
import matplotlib as mpl
from matplotlib import _api, cbook, _docstring, offsetbox
im... | [
[
4441,
4447
],
[
4471,
4477
]
] | lib/matplotlib/axes/_base.py | python:3.11 |
pallets/flask | pallets__flask-5014 | 7ee9ceb71e868944a46e1ff00b506772a53a4f1d | diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py
--- a/src/flask/blueprints.py
+++ b/src/flask/blueprints.py
@@ -190,6 +190,9 @@ def __init__(
root_path=root_path,
)
+ if not name:
+ raise ValueError("'name' may not be empty.")
+
if "." in name:
... | diff --git a/tests/test_blueprints.py b/tests/test_blueprints.py
--- a/tests/test_blueprints.py
+++ b/tests/test_blueprints.py
@@ -256,6 +256,11 @@ def test_dotted_name_not_allowed(app, client):
flask.Blueprint("app.ui", __name__)
+def test_empty_name_not_allowed(app, client):
+ with pytest.raises(Value... | Require a non-empty name for Blueprints
Things do not work correctly if a Blueprint is given an empty name (e.g. #4944).
It would be helpful if a `ValueError` was raised when trying to do that.
| 2023-03-04T18:36:21Z | 2.3 | ["tests/test_blueprints.py::test_empty_name_not_allowed"] | ["tests/test_blueprints.py::test_blueprint_specific_error_handling", "tests/test_blueprints.py::test_blueprint_specific_user_error_handling", "tests/test_blueprints.py::test_blueprint_app_error_handling", "tests/test_blueprints.py::test_blueprint_prefix_slash[-/-/]", "tests/test_blueprints.py::test_blueprint_prefix_sla... | 182ce3dd15dfa3537391c3efaf9c3ff407d134d4 | <15 min fix | import os
import typing as t
from collections import defaultdict
from functools import update_wrapper
from . import typing as ft
from .scaffold import _endpoint_from_view_func
from .scaffold import _sentinel
from .scaffold import Scaffold
from .scaffold import setupmethod
if t.TYPE_CHECKING: # pragma: no cover
f... | [
[
190,
198
]
] | src/flask/blueprints.py | python:3.11 | |
psf/requests | psf__requests-1142 | 22623bd8c265b78b161542663ee980738441c307 | diff --git a/requests/models.py b/requests/models.py
--- a/requests/models.py
+++ b/requests/models.py
@@ -386,13 +386,14 @@ def prepare_body(self, data, files):
self.body = body
def prepare_content_length(self, body):
- self.headers['Content-Length'] = '0'
if hasattr(body, 'seek') and h... | diff --git a/test_requests.py b/test_requests.py
--- a/test_requests.py
+++ b/test_requests.py
@@ -58,6 +58,13 @@ def test_basic_building(self):
assert pr.body == 'life=42'
+ def test_no_content_length(self):
+ get_req = requests.Request('GET', httpbin('get')).prepare()
+ self.assertTrue('... | requests.get is ALWAYS sending content length
Hi,
It seems like that request.get always adds 'content-length' header to the request.
I think that the right behavior is not to add this header automatically in GET requests or add the possibility to not send it.
For example http://amazon.com returns 503 for every get re... | This was done in issue #957 - Attach Content-Length to everything.
OK, I don't think it's the right solution.
imho GET requests shouldn't contain by default 'content-length' header.
Related: geemus/excon/pull/113
There's nothing stopping you from sending data in a GET request.
At the moment the following code:
requ... | 2013-01-25T05:19:16Z | 1.1 | ["test_requests.py::RequestsTestCase::test_no_content_length"] | ["test_requests.py::RequestsTestCase::test_basic_building", "test_requests.py::RequestsTestCase::test_entry_points", "test_requests.py::RequestsTestCase::test_invalid_url", "test_requests.py::RequestsTestCase::test_params_are_added_before_fragment", "test_requests.py::RequestsTestCase::test_path_is_not_double_encoded"] | ba25184ed5f0bf9b876dea3cf4312fa35b539a7c | <15 min fix | # -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import collections
import logging
from io import BytesIO
from .hooks import default_hooks
from .structures import CaseInsensitiveDict
from .status_codes import codes
from .auth import HTTPB... | [
[
386,
399
]
] | requests/models.py | python:3.11 |
psf/requests | psf__requests-1724 | 1ba83c47ce7b177efe90d5f51f7760680f72eda0 | diff --git a/requests/sessions.py b/requests/sessions.py
--- a/requests/sessions.py
+++ b/requests/sessions.py
@@ -12,7 +12,7 @@
from collections import Mapping
from datetime import datetime
-from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse
+from .compat import cookielib, OrderedDict, urljo... | diff --git a/test_requests.py b/test_requests.py
--- a/test_requests.py
+++ b/test_requests.py
@@ -433,6 +433,11 @@ def test_unicode_multipart_post_fieldnames(self):
prep = r.prepare()
assert b'name="stuff"' in prep.body
assert b'name="b\'stuff\'"' not in prep.body
+
+ def test_unicode... | Unicode method names cause UnicodeDecodeError for some requests in Python 2.7.2
The following example works fine:
```
files = {u'file': open(u'/usr/bin/diff', u'rb')}
response = requests.request(method='POST', url=u'http://httpbin.org/post', files=files)
```
But the following example (using `method=u'POST'` instead o... | 2013-11-04T09:37:00Z | 2.0 | ["test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_different_encodings_dont_break_post", "test_requests.py::RequestsTestCase::test_generic_cookiejar_works", "test_requests.py::RequestsTestCa... | ["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::RequestsTestCase::test_DIGEST_STREAM", "test_requests.py::RequestsTestCas... | 4bceb312f1b99d36a25f2985b5606e98b6f0d8cd | <15 min fix | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from collections import Mapping
from datetime import datetime
from .compat import cookielib, OrderedDict, urljoin, urlparse, urlu... | [
[
12,
18
],
[
309,
317
]
] | requests/sessions.py | python:3.11 | |
psf/requests | psf__requests-1766 | 847735553aeda6e6633f2b32e14ba14ba86887a4 | diff --git a/requests/auth.py b/requests/auth.py
--- a/requests/auth.py
+++ b/requests/auth.py
@@ -105,7 +105,7 @@ def sha_utf8(x):
A1 = '%s:%s:%s' % (self.username, realm, self.password)
A2 = '%s:%s' % (method, path)
-
+
HA1 = hash_utf8(A1)
HA2 = hash_utf8(A2)
@@ -144,7 ... | diff --git a/test_requests.py b/test_requests.py
--- a/test_requests.py
+++ b/test_requests.py
@@ -320,6 +320,14 @@ def test_DIGESTAUTH_WRONG_HTTP_401_GET(self):
r = s.get(url)
assert r.status_code == 401
+ def test_DIGESTAUTH_QUOTES_QOP_VALUE(self):
+
+ auth = HTTPDigestAuth('user', 'pass... | quote qop options in Digest Auth
Based on RFC2617 (http://tools.ietf.org/html/rfc2617), the value of
'qop-options' directive should be quoted with double quotes:
```
qop-options
This directive is optional, but is made so only for backward
compatibility with RFC 2069 [6]; it SHOULD be used by all
impleme... | 2013-11-29T08:38:09Z | 2.0 | ["test_requests.py::RequestsTestCase::test_DIGESTAUTH_QUOTES_QOP_VALUE", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_ALTERNATIVE", "test_requests.py::RequestsTestCase::test_cookie_sent_on_redirect", "test_requests.py::RequestsTestCase::test_custom_content_type", "test_requests.py::RequestsTestCase::test_p... | ["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::Re... | 4bceb312f1b99d36a25f2985b5606e98b6f0d8cd | <15 min fix | # -*- coding: utf-8 -*-
"""
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import os
import re
import time
import hashlib
import logging
from base64 import b64encode
from .compat import urlparse, str
from .utils import parse_dict_header
log = logging.getLogger(__nam... | [
[
105,
111
],
[
144,
150
]
] | requests/auth.py | python:3.11 | |
psf/requests | psf__requests-1921 | 3c88e520da24ae6f736929a750876e7654accc3d | diff --git a/requests/sessions.py b/requests/sessions.py
--- a/requests/sessions.py
+++ b/requests/sessions.py
@@ -59,6 +59,8 @@ def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
if v is None:
del merged_setting[k]
+ merged_setting = dict((k, v) for (k, v) in merged... | diff --git a/test_requests.py b/test_requests.py
--- a/test_requests.py
+++ b/test_requests.py
@@ -211,6 +211,14 @@ def test_requests_in_history_are_not_overridden(self):
req_urls = [r.request.url for r in resp.history]
assert urls == req_urls
+ def test_headers_on_session_with_None_are_not_sent(... | Removing a default header of a session
[The docs](http://docs.python-requests.org/en/latest/user/advanced/#session-objects) say that you can prevent sending a session header by setting the headers value to None in the method's arguments. You would expect (as [discussed on IRC](https://botbot.me/freenode/python-requests... | We _could_ do this, but I'm actually increasingly believing that the default headers dict is the right call here.
> We could do this, but I'm actually increasingly believing that the default headers dict is the right call here.
I'm not sure what you're talking about.
@sigmavirus24 Sorry, I had the context for this ... | 2014-02-14T22:15:56Z | 2.3 | ["test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_POSTBIN_GET_POST_FILES", "test_requests.py::RequestsTestCase::test_basicauth_with_netrc", "test_requests.py::RequestsTestCase::test_cookie_persists_via_api", "test_requests.py::RequestsTestCase::test_hea... | ["test_requests.py::RequestsTestCase::test_DIGESTAUTH_QUOTES_QOP_VALUE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_STREAM", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_WITH_MIXED_PARAMS", "test_requests.py::RequestsTestCase::tes... | 3eb69be879063de4803f7f0152b83738a1c95ca4 | <15 min fix | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from collections import Mapping
from datetime import datetime
from .compat import cookielib, OrderedDict, urljoin, urlparse, buil... | [
[
59,
66
]
] | requests/sessions.py | python:3.11 |
psf/requests | psf__requests-2317 | 091991be0da19de9108dbe5e3752917fea3d7fdc | diff --git a/requests/sessions.py b/requests/sessions.py
--- a/requests/sessions.py
+++ b/requests/sessions.py
@@ -13,7 +13,7 @@
from datetime import datetime
from .auth import _basic_auth_str
-from .compat import cookielib, OrderedDict, urljoin, urlparse, builtin_str
+from .compat import cookielib, OrderedDict, ur... | diff --git a/test_requests.py b/test_requests.py
--- a/test_requests.py
+++ b/test_requests.py
@@ -1389,6 +1389,11 @@ def test_total_timeout_connect(self):
except ConnectTimeout:
pass
+ def test_encoded_methods(self):
+ """See: https://github.com/kennethreitz/requests/issues/2316"""
+ ... | method = builtin_str(method) problem
In requests/sessions.py is a command:
method = builtin_str(method)
Converts method from
b’GET’
to
"b'GET’"
Which is the literal string, no longer a binary string. When requests tries to use the method "b'GET’”, it gets a 404 Not Found response.
I am using python3.4 and python-ne... | Ugh. This should have been caught and replaced with `to_native_str`. This is definitely a requests bug.
| 2014-11-01T02:20:16Z | 2.4 | ["test_requests.py::RequestsTestCase::test_HTTP_302_ALLOW_REDIRECT_GET", "test_requests.py::RequestsTestCase::test_POSTBIN_GET_POST_FILES", "test_requests.py::RequestsTestCase::test_POSTBIN_GET_POST_FILES_WITH_DATA", "test_requests.py::RequestsTestCase::test_basicauth_with_netrc", "test_requests.py::RequestsTestCase::t... | ["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_QUOTES_QOP_VALUE", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::Request... | 091991be0da19de9108dbe5e3752917fea3d7fdc | <15 min fix | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from collections import Mapping
from datetime import datetime
from .auth import _basic_auth_str
from .compat import cookielib, Or... | [
[
13,
19
],
[
425,
431
]
] | requests/sessions.py | python:3.11 |
psf/requests | psf__requests-5414 | 39d0fdd9096f7dceccbc8f82e1eda7dd64717a8e | diff --git a/requests/models.py b/requests/models.py
--- a/requests/models.py
+++ b/requests/models.py
@@ -403,7 +403,7 @@ def prepare_url(self, url, params):
host = self._get_idna_encoded_host(host)
except UnicodeError:
raise InvalidURL('URL has an invalid label.')
- ... | diff --git a/tests/test_requests.py b/tests/test_requests.py
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -81,6 +81,8 @@ def test_entry_points(self):
(InvalidSchema, 'localhost.localdomain:3128/'),
(InvalidSchema, '10.122.1.1:3128/'),
(InvalidURL, 'http://'),
+ ... | Getting http://.example.com raises UnicodeError
Attempting to get e.g. `http://.example.com` results in a `UnicodeError`. It seems like the intention so far has been to raise `InvalidUrl` instead (see e.g. [this line](https://github.com/psf/requests/blob/ca6f9af5dba09591007b15a7368bc0f006b7cc50/requests/models.py#L401)... | 2020-04-05T16:52:04Z | 2.26 | ["tests/test_requests.py::TestRequests::test_invalid_url[InvalidURL-http://.example.com]"] | ["tests/test_requests.py::TestRequests::test_entry_points", "tests/test_requests.py::TestRequests::test_invalid_url[MissingSchema-hiwpefhipowhefopw]", "tests/test_requests.py::TestRequests::test_invalid_url[InvalidSchema-localhost:3128]", "tests/test_requests.py::TestRequests::test_invalid_url[InvalidSchema-localhost.l... | a1a6a549a0143d9b32717dbe3d75cd543ae5a4f6 | <15 min fix | # -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import datetime
import sys
# Import encoding now, to avoid implicit import later.
# Implicit import within threads may cause LookupError when standard library is in a ZIP,
# such as in Embed... | [
[
403,
409
]
] | requests/models.py | python:3.11 | |
pydata/xarray | pydata__xarray-4075 | 19b088636eb7d3f65ab7a1046ac672e0689371d8 | diff --git a/xarray/core/weighted.py b/xarray/core/weighted.py
--- a/xarray/core/weighted.py
+++ b/xarray/core/weighted.py
@@ -142,7 +142,14 @@ def _sum_of_weights(
# we need to mask data values that are nan; else the weights are wrong
mask = da.notnull()
- sum_of_weights = self._reduce(mask,... | diff --git a/xarray/tests/test_weighted.py b/xarray/tests/test_weighted.py
--- a/xarray/tests/test_weighted.py
+++ b/xarray/tests/test_weighted.py
@@ -59,6 +59,18 @@ def test_weighted_sum_of_weights_nan(weights, expected):
assert_equal(expected, result)
+def test_weighted_sum_of_weights_bool():
+ # https://... | [bug] when passing boolean weights to weighted mean
<!-- A short summary of the issue, if appropriate -->
#### MCVE Code Sample
<!-- In order for the maintainers to efficiently understand and prioritize issues, we ask you post a "Minimal, Complete and Verifiable Example" (MCVE): http://matthewrocklin.com/blog/wor... | 2020-05-18T18:42:05Z | 0.12 | ["xarray/tests/test_weighted.py::test_weighted_sum_of_weights_bool", "xarray/tests/test_weighted.py::test_weighted_mean_bool"] | ["xarray/tests/test_weighted.py::test_weighted_non_DataArray_weights[True]", "xarray/tests/test_weighted.py::test_weighted_non_DataArray_weights[False]", "xarray/tests/test_weighted.py::test_weighted_weights_nan_raises[weights0-True]", "xarray/tests/test_weighted.py::test_weighted_weights_nan_raises[weights0-False]", "... | 1c198a191127c601d091213c4b3292a8bb3054e1 | <15 min fix | from typing import TYPE_CHECKING, Hashable, Iterable, Optional, Union, overload
from .computation import dot
from .options import _get_keep_attrs
if TYPE_CHECKING:
from .dataarray import DataArray, Dataset
_WEIGHTED_REDUCE_DOCSTRING_TEMPLATE = """
Reduce this {cls}'s data by a weighted ``{fcn}`` along some d... | [
[
142,
155
]
] | xarray/core/weighted.py | python:3.11 | |
pydata/xarray | pydata__xarray-4094 | a64cf2d5476e7bbda099b34c40b7be1880dbd39a | diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py
--- a/xarray/core/dataarray.py
+++ b/xarray/core/dataarray.py
@@ -1961,7 +1961,7 @@ def to_unstacked_dataset(self, dim, level=0):
# pull variables out of datarray
data_dict = {}
for k in variables:
- data_dict[k] = se... | diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py
--- a/xarray/tests/test_dataset.py
+++ b/xarray/tests/test_dataset.py
@@ -3031,6 +3031,14 @@ def test_to_stacked_array_dtype_dims(self):
assert y.dims == ("x", "features")
def test_to_stacked_array_to_unstacked_dataset(self):
+
+ ... | to_unstacked_dataset broken for single-dim variables
<!-- A short summary of the issue, if appropriate -->
#### MCVE Code Sample
```python
arr = xr.DataArray(
np.arange(3),
coords=[("x", [0, 1, 2])],
)
data = xr.Dataset({"a": arr, "b": arr})
stacked = data.to_stacked_array('y', sample_dims=['x'... | 2020-05-26T00:36:02Z | 0.12 | ["xarray/tests/test_dataset.py::TestDataset::test_to_stacked_array_to_unstacked_dataset"] | ["xarray/tests/test_dataset.py::TestDataset::test_repr", "xarray/tests/test_dataset.py::TestDataset::test_repr_multiindex", "xarray/tests/test_dataset.py::TestDataset::test_repr_period_index", "xarray/tests/test_dataset.py::TestDataset::test_unicode_data", "xarray/tests/test_dataset.py::TestDataset::test_repr_nep18", "... | 1c198a191127c601d091213c4b3292a8bb3054e1 | <15 min fix | import datetime
import functools
from numbers import Number
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Hashable,
Iterable,
List,
Mapping,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
cast,
)
import numpy as np
import pandas as pd
from ..plot.plot imp... | [
[
1961,
1967
]
] | xarray/core/dataarray.py | python:3.11 | |
pydata/xarray | pydata__xarray-4356 | e05fddea852d08fc0845f954b79deb9e9f9ff883 | diff --git a/xarray/core/nanops.py b/xarray/core/nanops.py
--- a/xarray/core/nanops.py
+++ b/xarray/core/nanops.py
@@ -26,13 +26,9 @@ def _maybe_null_out(result, axis, mask, min_count=1):
"""
xarray version of pandas.core.nanops._maybe_null_out
"""
- if hasattr(axis, "__len__"): # if tuple or list
- ... | diff --git a/xarray/tests/test_duck_array_ops.py b/xarray/tests/test_duck_array_ops.py
--- a/xarray/tests/test_duck_array_ops.py
+++ b/xarray/tests/test_duck_array_ops.py
@@ -595,6 +595,24 @@ def test_min_count(dim_num, dtype, dask, func, aggdim):
assert_dask_array(actual, dask)
+@pytest.mark.parametrize("dtyp... | sum: min_count is not available for reduction with more than one dimensions
**Is your feature request related to a problem? Please describe.**
`sum` with `min_count` errors when passing more than one dim:
```python
import xarray as xr
da = xr.DataArray([[1., 2, 3], [4, 5, 6]])
da.sum(["dim_0", "dim_1"], min_co... | 2020-08-19T23:48:49Z | 0.12 | ["xarray/tests/test_duck_array_ops.py::test_min_count_nd[sum-False-float]", "xarray/tests/test_duck_array_ops.py::test_min_count_nd[sum-False-int]", "xarray/tests/test_duck_array_ops.py::test_min_count_nd[sum-False-float32]", "xarray/tests/test_duck_array_ops.py::test_min_count_nd[sum-False-bool_]", "xarray/tests/test_... | ["xarray/tests/test_duck_array_ops.py::TestOps::test_first", "xarray/tests/test_duck_array_ops.py::TestOps::test_last", "xarray/tests/test_duck_array_ops.py::TestOps::test_count", "xarray/tests/test_duck_array_ops.py::TestOps::test_where_type_promotion", "xarray/tests/test_duck_array_ops.py::TestOps::test_stack_type_pr... | 1c198a191127c601d091213c4b3292a8bb3054e1 | <15 min fix | import numpy as np
from . import dtypes, nputils, utils
from .duck_array_ops import _dask_or_eager_func, count, fillna, isnull, where_method
from .pycompat import dask_array_type
try:
import dask.array as dask_array
from . import dask_array_compat
except ImportError:
dask_array = None
dask_array_comp... | [
[
26,
34
]
] | xarray/core/nanops.py | python:3.11 | |
pydata/xarray | pydata__xarray-4629 | a41edc7bf5302f2ea327943c0c48c532b12009bc | diff --git a/xarray/core/merge.py b/xarray/core/merge.py
--- a/xarray/core/merge.py
+++ b/xarray/core/merge.py
@@ -501,7 +501,7 @@ def merge_attrs(variable_attrs, combine_attrs):
if combine_attrs == "drop":
return {}
elif combine_attrs == "override":
- return variable_attrs[0]
+ return ... | diff --git a/xarray/tests/test_merge.py b/xarray/tests/test_merge.py
--- a/xarray/tests/test_merge.py
+++ b/xarray/tests/test_merge.py
@@ -109,6 +109,13 @@ def test_merge_arrays_attrs(
expected.attrs = expected_attrs
assert actual.identical(expected)
+ def test_merge_attrs_override_copy(s... | merge(combine_attrs='override') does not copy attrs but instead references attrs from the first object
<!-- Please include a self-contained copy-pastable example that generates the issue if possible.
Please be concise with code posted. See guidelines below on how to provide a good bug report:
- Craft Minimal Bug ... | 2020-11-30T23:06:17Z | 0.12 | ["xarray/tests/test_merge.py::TestMergeFunction::test_merge_attrs_override_copy"] | ["xarray/tests/test_merge.py::TestMergeInternals::test_broadcast_dimension_size", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_arrays", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_datasets", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_dataarray_unnamed", "xarray/tests/test_me... | 1c198a191127c601d091213c4b3292a8bb3054e1 | <15 min fix | from typing import (
TYPE_CHECKING,
AbstractSet,
Any,
Dict,
Hashable,
Iterable,
List,
Mapping,
NamedTuple,
Optional,
Sequence,
Set,
Tuple,
Union,
)
import pandas as pd
from . import dtypes, pdcompat
from .alignment import deep_align
from .duck_array_ops import l... | [
[
501,
507
]
] | xarray/core/merge.py | python:3.11 | |
pydata/xarray | pydata__xarray-6461 | 851dadeb0338403e5021c3fbe80cbc9127ee672d | diff --git a/xarray/core/computation.py b/xarray/core/computation.py
--- a/xarray/core/computation.py
+++ b/xarray/core/computation.py
@@ -1825,11 +1825,10 @@ def where(cond, x, y, keep_attrs=None):
"""
if keep_attrs is None:
keep_attrs = _get_keep_attrs(default=False)
-
if keep_attrs is True:
... | diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py
--- a/xarray/tests/test_computation.py
+++ b/xarray/tests/test_computation.py
@@ -1928,6 +1928,10 @@ def test_where_attrs() -> None:
expected = xr.DataArray([1, 0], dims="x", attrs={"attr": "x"})
assert_identical(expected, actual... | xr.where with scalar as second argument fails with keep_attrs=True
### What happened?
``` python
import xarray as xr
xr.where(xr.DataArray([1, 2, 3]) > 0, 1, 0)
```
fails with
```
1809 if keep_attrs is True:
1810 # keep the attributes of x, the second parameter, by default to
1811 # be c... | 2022-04-09T03:02:40Z | 2022.03 | ["xarray/tests/test_computation.py::test_where_attrs"] | ["xarray/tests/test_computation.py::test_signature_properties", "xarray/tests/test_computation.py::test_result_name", "xarray/tests/test_computation.py::test_ordered_set_union", "xarray/tests/test_computation.py::test_ordered_set_intersection", "xarray/tests/test_computation.py::test_join_dict_keys", "xarray/tests/test... | d7931f9014a26e712ff5f30c4082cf0261f045d3 | <15 min fix | """
Functions for applying functions that act on arrays to xarray's labeled data.
"""
from __future__ import annotations
import functools
import itertools
import operator
import warnings
from collections import Counter
from typing import (
TYPE_CHECKING,
AbstractSet,
Any,
Callable,
Hashable,
It... | [
[
1825,
1834
]
] | xarray/core/computation.py | python:3.11 | |
pylint-dev/pylint | pylint-dev__pylint-4970 | 40cc2ffd7887959157aaf469e09585ec2be7f528 | diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py
--- a/pylint/checkers/similar.py
+++ b/pylint/checkers/similar.py
@@ -390,6 +390,8 @@ def append_stream(self, streamid: str, stream: TextIO, encoding=None) -> None:
def run(self) -> None:
"""start looking for similarities and display r... | diff --git a/tests/checkers/unittest_similar.py b/tests/checkers/unittest_similar.py
--- a/tests/checkers/unittest_similar.py
+++ b/tests/checkers/unittest_similar.py
@@ -502,3 +502,11 @@ def test_get_map_data() -> None:
# There doesn't seem to be a faster way of doing this, yet.
lines = (linespec.tex... | Setting `min-similarity-lines` to `0` should stop pylint from checking duplicate code
### Current problem
Setting `min-similarity-lines` to `0` in the rcfile doesn't disable checking for duplicate code, it instead treats every line of code as duplicate and raises many errors.
### Desired solution
Setting `min-simila... | It's a nice enhancement, thank you for opening the issue. The way to disable duplicate code is by using:
```ini
[MASTER]
disable=duplicate-code
```
As you saw in issue 214, it's currently impossible to disable duplicate-code **in some part of the code and not the other** but this is another issue entirely. | 2021-09-05T19:44:07Z | 2.10 | ["tests/checkers/unittest_similar.py::test_set_duplicate_lines_to_zero"] | ["tests/checkers/unittest_similar.py::test_ignore_comments", "tests/checkers/unittest_similar.py::test_ignore_docstrings", "tests/checkers/unittest_similar.py::test_ignore_imports", "tests/checkers/unittest_similar.py::test_multiline_imports", "tests/checkers/unittest_similar.py::test_ignore_multiline_imports", "tests/... | bc95cd34071ec2e71de5bca8ff95cc9b88e23814 | <15 min fix | # Copyright (c) 2006, 2008-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2012 Ry4an Brase <ry4an-hg@ry4an.org>
# Copyright (c) 2012 Google, Inc.
# Copyright (c) 2012 Anthony VEREZ <anthony.verez.external@cassidian.com>
# Copyright (c) 2014-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (... | [
[
390,
397
]
] | pylint/checkers/similar.py | python:3.11 |
pylint-dev/pylint | pylint-dev__pylint-6903 | ca80f03a43bc39e4cc2c67dc99817b3c9f13b8a6 | diff --git a/pylint/lint/run.py b/pylint/lint/run.py
--- a/pylint/lint/run.py
+++ b/pylint/lint/run.py
@@ -58,6 +58,13 @@ def _query_cpu() -> int | None:
cpu_shares = int(file.read().rstrip())
# For AWS, gives correct value * 1024.
avail_cpu = int(cpu_shares / 1024)
+
+ # In K8s Pods a... | diff --git a/tests/test_pylint_runners.py b/tests/test_pylint_runners.py
--- a/tests/test_pylint_runners.py
+++ b/tests/test_pylint_runners.py
@@ -6,14 +6,17 @@
from __future__ import annotations
import os
+import pathlib
import sys
from collections.abc import Callable
-from unittest.mock import patch
+from unitt... | Running pylint in Kubernetes Pod with --jobs=0 fails
### Bug description
I run pylint in multiple parallel stages with Jenkins at a Kubernets agent with `--jobs=0`.
The newly introduced function [pylint.run._query_cpu()](https://github.com/PyCQA/pylint/blob/main/pylint/lint/run.py#L34) is called to determine the n... | Thanks for the analysis. Would you be willing to contribute a patch?
Yeah thank you @d1gl3, you did all the work, you might as well get the fix under your name 😉 (Also we implemented that in #6098, based on https://bugs.python.org/issue36054 so you can probably also add a comment there if you want)
Sure, I'll patch ... | 2022-06-09T19:43:36Z | 2.15 | ["tests/test_pylint_runners.py::test_pylint_run_jobs_equal_zero_dont_crash_with_cpu_fraction"] | ["tests/test_pylint_runners.py::test_runner[run_epylint]", "tests/test_pylint_runners.py::test_runner[run_pylint]", "tests/test_pylint_runners.py::test_runner[run_pyreverse]", "tests/test_pylint_runners.py::test_runner[run_symilar]", "tests/test_pylint_runners.py::test_runner_with_arguments[run_epylint]", "tests/test_p... | e90702074e68e20dc8e5df5013ee3ecf22139c3e | <15 min fix | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
import os
import sys
import warnings
from collections.abc impo... | [
[
58,
70
]
] | pylint/lint/run.py | python:3.11 |
pylint-dev/pylint | pylint-dev__pylint-7277 | 684a1d6aa0a6791e20078bc524f97c8906332390 | diff --git a/pylint/__init__.py b/pylint/__init__.py
--- a/pylint/__init__.py
+++ b/pylint/__init__.py
@@ -96,9 +96,10 @@ def modify_sys_path() -> None:
if pylint is installed in an editable configuration (as the last item).
https://github.com/PyCQA/pylint/issues/4161
"""
- sys.path.pop(0)
- en... | diff --git a/tests/test_self.py b/tests/test_self.py
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -759,6 +759,24 @@ def test_modify_sys_path() -> None:
modify_sys_path()
assert sys.path == paths[1:]
+ paths = ["", *default_paths]
+ sys.path = copy(paths)
+ ... | `pylint` removes first item from `sys.path` when running from `runpy`.
### Bug description
This is the line where the first item from sys.path is removed.
https://github.com/PyCQA/pylint/blob/ce7cccf96454fb6e286e4a8f38919733a0f28f44/pylint/__init__.py#L99
I think there should be a check to ensure that the first it... | This is a touchy part of the code (very hard to test). It probably make sense to do what you suggest but I don't understand this part of the code very well so I think some investigation/specification is required.
I think it makes sense to take this suggestion as it makes the implementation agree with the docstring. @ka... | 2022-08-08T23:07:49Z | 2.15 | ["tests/test_self.py::TestRunTC::test_modify_sys_path"] | ["tests/test_self.py::TestRunTC::test_pkginfo", "tests/test_self.py::TestRunTC::test_all", "tests/test_self.py::TestRunTC::test_no_ext_file", "tests/test_self.py::TestRunTC::test_w0704_ignored", "tests/test_self.py::TestRunTC::test_exit_zero", "tests/test_self.py::TestRunTC::test_nonexistent_config_file", "tests/test_s... | e90702074e68e20dc8e5df5013ee3ecf22139c3e | <15 min fix | # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
__all__ = [
"__version__",
"version",
"modify_sys_... | [
[
96,
105
]
] | pylint/__init__.py | python:3.11 |
pytest-dev/pytest | pytest-dev__pytest-10081 | da9a2b584eb7a6c7e924b2621ed0ddaeca0a7bea | diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -316,7 +316,10 @@ def runtest(self) -> None:
# Arguably we could always postpone tearDown(), but this changes the moment where the
# TestCase instance interacts with th... | diff --git a/testing/test_unittest.py b/testing/test_unittest.py
--- a/testing/test_unittest.py
+++ b/testing/test_unittest.py
@@ -1241,12 +1241,15 @@ def test_2(self):
@pytest.mark.parametrize("mark", ["@unittest.skip", "@pytest.mark.skip"])
-def test_pdb_teardown_skipped(
+def test_pdb_teardown_skipped_for_funct... | unittest.TestCase.tearDown executed for classes marked with `unittest.skip` when running --pdb
<!--
Thanks for submitting an issue!
Quick check-list while reporting bugs:
-->
- [x] a detailed description of the bug or problem you are having
- [x] output of `pip list` from the virtual environment you are using
... | 2022-06-26T13:53:24Z | 7.2 | ["testing/test_unittest.py::test_pdb_teardown_skipped_for_classes[@unittest.skip]"] | ["testing/test_unittest.py::test_simple_unittest", "testing/test_unittest.py::test_runTest_method", "testing/test_unittest.py::test_isclasscheck_issue53", "testing/test_unittest.py::test_setup", "testing/test_unittest.py::test_setUpModule", "testing/test_unittest.py::test_setUpModule_failing_no_teardown", "testing/test... | 572b5657d7ca557593418ce0319fabff88800c73 | <15 min fix | """Discover and run std-library "unittest" style tests."""
import sys
import traceback
import types
from typing import Any
from typing import Callable
from typing import Generator
from typing import Iterable
from typing import List
from typing import Optional
from typing import Tuple
from typing import Type
from typing... | [
[
316,
325
]
] | src/_pytest/unittest.py | python:3.11 | |
pytest-dev/pytest | pytest-dev__pytest-5262 | 58e6a09db49f34886ff13f3b7520dd0bcd7063cd | diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py
--- a/src/_pytest/capture.py
+++ b/src/_pytest/capture.py
@@ -447,6 +447,10 @@ def name(self):
"""Ensure that file.name is a string."""
return repr(self.buffer)
+ @property
+ def mode(self):
+ return self.buffer.mode.replace("... | diff --git a/testing/test_capture.py b/testing/test_capture.py
--- a/testing/test_capture.py
+++ b/testing/test_capture.py
@@ -1051,6 +1051,9 @@ def test_simple_resume_suspend(self, tmpfile):
cap.done()
pytest.raises(AttributeError, cap.suspend)
+ def test_capfd_sys_stdout_mode(self, capf... | _pytest.capture.EncodedFile mode should not include `b` (binary)
<!--
Thanks for submitting an issue!
Here's a quick checklist for what to provide:
-->
- [x] a detailed description of the bug or suggestion
Exception when youtube-dl logs to pytest captured output. Youtube-dl looks for `b` in `out.mode` to dec... | here's where this comes from: https://github.com/pytest-dev/pytest/blob/6a43c8cd9405c68e223f4c6270bd1e1ac4bc8c5f/src/_pytest/capture.py#L450-L451
Probably an easy fix to
```python
@property
def mode(self):
return self.buffer.mode.replace('b', '')
```
Want to supply a PR with a quick test demonstrating ... | 2019-05-14T21:54:55Z | 4.5 | ["testing/test_capture.py::TestFDCapture::test_capfd_sys_stdout_mode"] | ["[100%]", "testing/test_capture.py::TestCaptureManager::test_getmethod_default_no_fd", "testing/test_capture.py::TestCaptureManager::test_capturing_basic_api[no]", "testing/test_capture.py::TestCaptureManager::test_capturing_basic_api[sys]", "testing/test_capture.py::TestCaptureManager::test_capturing_basic_api[fd]", ... | 693c3b7f61d4d32f8927a74f34ce8ac56d63958e | <15 min fix | """
per-test stdout/stderr capturing mechanism.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import io
import os
import sys
from io import UnsupportedOperation
from tempfile import TemporaryFile
import six
impor... | [
[
447,
456
]
] | src/_pytest/capture.py | python:3.11 |
pytest-dev/pytest | pytest-dev__pytest-5809 | 8aba863a634f40560e25055d179220f0eefabe9a | diff --git a/src/_pytest/pastebin.py b/src/_pytest/pastebin.py
--- a/src/_pytest/pastebin.py
+++ b/src/_pytest/pastebin.py
@@ -77,11 +77,7 @@ def create_new_paste(contents):
from urllib.request import urlopen
from urllib.parse import urlencode
- params = {
- "code": contents,
- "lex... | diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py
--- a/testing/test_pastebin.py
+++ b/testing/test_pastebin.py
@@ -126,7 +126,7 @@ def test_create_new_paste(self, pastebin, mocked_urlopen):
assert len(mocked_urlopen) == 1
url, data = mocked_urlopen[0]
assert type(data) is byte... | Lexer "python3" in --pastebin feature causes HTTP errors
The `--pastebin` option currently submits the output of `pytest` to `bpaste.net` using `lexer=python3`: https://github.com/pytest-dev/pytest/blob/d47b9d04d4cf824150caef46c9c888779c1b3f58/src/_pytest/pastebin.py#L68-L73
For some `contents`, this will raise a "H... | 2019-09-01T04:40:09Z | 4.6 | ["testing/test_pastebin.py::TestPaste::test_create_new_paste"] | ["testing/test_pastebin.py::TestPasteCapture::test_failed", "testing/test_pastebin.py::TestPasteCapture::test_all", "testing/test_pastebin.py::TestPasteCapture::test_non_ascii_paste_text"] | d5843f89d3c008ddcb431adbc335b080a79e617e | <15 min fix | # -*- coding: utf-8 -*-
""" submit failure or test session information to a pastebin service. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import tempfile
import six
import pytest
def pytest_addoption(parser):
group = parser.getgrou... | [
[
77,
83
]
] | src/_pytest/pastebin.py | python:3.11 | |
pytest-dev/pytest | pytest-dev__pytest-6202 | 3a668ea6ff24b0c8f00498c3144c63bac561d925 | diff --git a/src/_pytest/python.py b/src/_pytest/python.py
--- a/src/_pytest/python.py
+++ b/src/_pytest/python.py
@@ -285,8 +285,7 @@ def getmodpath(self, stopatmodule=True, includemodule=False):
break
parts.append(name)
parts.reverse()
- s = ".".join(parts)
- r... | diff --git a/testing/test_collection.py b/testing/test_collection.py
--- a/testing/test_collection.py
+++ b/testing/test_collection.py
@@ -685,6 +685,8 @@ def test_2():
def test_example_items1(self, testdir):
p = testdir.makepyfile(
"""
+ import pytest
+
def testone():... | '.[' replaced with '[' in the headline shown of the test report
```
bug.py F [100%]
=================================== FAILURES ===================================
_________________________________ test_boo[.[] _________________________________
a... | Thanks for the fantastic report @linw1995, this is really helpful :smile:
I find out the purpose of replacing '.[' with '['. The older version of pytest, support to generate test by using the generator function.
[https://github.com/pytest-dev/pytest/blob/9eb1d55380ae7c25ffc600b65e348dca85f99221/py/test/testing/test... | 2019-11-16T07:45:21Z | 5.2 | ["testing/test_collection.py::Test_genitems::test_example_items1"] | ["testing/test_collection.py::TestCollector::test_collect_versus_item", "testing/test_collection.py::TestCollector::test_check_equality", "testing/test_collection.py::TestCollector::test_getparent", "testing/test_collection.py::TestCollector::test_getcustomfile_roundtrip", "testing/test_collection.py::TestCollector::te... | f36ea240fe3579f945bf5d6cc41b5e45a572249d | <15 min fix | """ Python test discovery, setup and run of test functions. """
import enum
import fnmatch
import inspect
import os
import sys
import warnings
from collections import Counter
from collections.abc import Sequence
from functools import partial
from textwrap import dedent
import py
import _pytest
from _pytest import fix... | [
[
285,
291
]
] | src/_pytest/python.py | python:3.11 |
pytest-dev/pytest | pytest-dev__pytest-7205 | 5e7f1ab4bf58e473e5d7f878eb2b499d7deabd29 | diff --git a/src/_pytest/setuponly.py b/src/_pytest/setuponly.py
--- a/src/_pytest/setuponly.py
+++ b/src/_pytest/setuponly.py
@@ -1,4 +1,5 @@
import pytest
+from _pytest._io.saferepr import saferepr
def pytest_addoption(parser):
@@ -66,7 +67,7 @@ def _show_fixture_action(fixturedef, msg):
tw.write("... | diff --git a/testing/test_setuponly.py b/testing/test_setuponly.py
--- a/testing/test_setuponly.py
+++ b/testing/test_setuponly.py
@@ -1,3 +1,5 @@
+import sys
+
import pytest
from _pytest.config import ExitCode
@@ -146,10 +148,10 @@ def test_arg1(arg_other):
result.stdout.fnmatch_lines(
[
- ... | BytesWarning when using --setup-show with bytes parameter
With Python 3.8.2, pytest 5.4.1 (or latest master; stacktraces are from there) and this file:
```python
import pytest
@pytest.mark.parametrize('data', [b'Hello World'])
def test_data(data):
pass
```
when running `python3 -bb -m pytest --setup-sh... | Makes sense to me to use `saferepr` for this, as it displays the raw `param` of the fixture. Probably with a shorter `maxsize` than the default as well, 240 is too long. | 2020-05-09T11:25:58Z | 5.4 | ["testing/test_setuponly.py::test_show_fixtures_with_parameters[--setup-only]", "testing/test_setuponly.py::test_show_fixtures_with_parameter_ids[--setup-only]", "testing/test_setuponly.py::test_show_fixtures_with_parameter_ids_function[--setup-only]", "testing/test_setuponly.py::test_show_fixtures_with_parameters[--se... | ["testing/test_setuponly.py::test_show_only_active_fixtures[--setup-only]", "testing/test_setuponly.py::test_show_different_scopes[--setup-only]", "testing/test_setuponly.py::test_show_nested_fixtures[--setup-only]", "testing/test_setuponly.py::test_show_fixtures_with_autouse[--setup-only]", "testing/test_setuponly.py:... | 678c1a0745f1cf175c442c719906a1f13e496910 | <15 min fix | import pytest
def pytest_addoption(parser):
group = parser.getgroup("debugconfig")
group.addoption(
"--setuponly",
"--setup-only",
action="store_true",
help="only setup fixtures, do not execute tests.",
)
group.addoption(
"--setupshow",
"--setup-show",
... | [
[
1,
5
],
[
67,
73
]
] | src/_pytest/setuponly.py | python:3.11 |
pytest-dev/pytest | pytest-dev__pytest-7432 | e6e300e729dd33956e5448d8be9a0b1540b4e53a | diff --git a/src/_pytest/skipping.py b/src/_pytest/skipping.py
--- a/src/_pytest/skipping.py
+++ b/src/_pytest/skipping.py
@@ -291,7 +291,8 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]):
else:
rep.outcome = "passed"
rep.wasxfail = xfailed.reason
- e... | diff --git a/testing/test_skipping.py b/testing/test_skipping.py
--- a/testing/test_skipping.py
+++ b/testing/test_skipping.py
@@ -235,6 +235,31 @@ def test_func2():
["*def test_func():*", "*assert 0*", "*1 failed*1 pass*"]
)
+ @pytest.mark.parametrize(
+ "test_input,expected",
+ ... | skipping: --runxfail breaks pytest.mark.skip location reporting
pytest versions: 5.4.x, current master
When `@pytest.mark.skip`/`skipif` marks are used to skip a test, for example
```py
import pytest
@pytest.mark.skip
def test_skip_location() -> None:
assert 0
```
the expected skip location reported s... | Can I look into this one?
@debugduck Sure!
Awesome! I'll get started on it and open up a PR when I find it. I'm a bit new, so I'm still learning about the code base. | 2020-06-29T21:51:15Z | 5.4 | ["testing/test_skipping.py::TestXFail::test_xfail_run_with_skip_mark[test_input1-expected1]"] | ["testing/test_skipping.py::test_importorskip", "testing/test_skipping.py::TestEvaluation::test_no_marker", "testing/test_skipping.py::TestEvaluation::test_marked_xfail_no_args", "testing/test_skipping.py::TestEvaluation::test_marked_skipif_no_args", "testing/test_skipping.py::TestEvaluation::test_marked_one_arg", "tes... | 678c1a0745f1cf175c442c719906a1f13e496910 | <15 min fix | """ support for skip/xfail functions and markers. """
import os
import platform
import sys
import traceback
from typing import Generator
from typing import Optional
from typing import Tuple
import attr
import _pytest._code
from _pytest.compat import TYPE_CHECKING
from _pytest.config import Config
from _pytest.config ... | [
[
291,
298
]
] | src/_pytest/skipping.py | python:3.11 |
pytest-dev/pytest | pytest-dev__pytest-7521 | 41d211c24a6781843b174379d6d6538f5c17adb9 | diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py
--- a/src/_pytest/capture.py
+++ b/src/_pytest/capture.py
@@ -388,6 +388,7 @@ def __init__(self, targetfd: int) -> None:
TemporaryFile(buffering=0), # type: ignore[arg-type]
encoding="utf-8",
errors="replace... | diff --git a/testing/test_capture.py b/testing/test_capture.py
--- a/testing/test_capture.py
+++ b/testing/test_capture.py
@@ -514,6 +514,12 @@ def test_hello(capfd):
)
reprec.assertoutcome(passed=1)
+ @pytest.mark.parametrize("nl", ("\n", "\r\n", "\r"))
+ def test_cafd_preserves_newlines(self... | pytest 6.0.0rc1: capfd.readouterr() converts \r to \n
I am testing pytest 6.0.0rc1 with Fedora packages. This is the first failure I get, from borgbackup 1.1.13.
```
______________________ test_progress_percentage_sameline _______________________
capfd = <_pytest.capture.CaptureFixture object at 0x7f9bd55e4d00>
... | Bisected to 29e4cb5d45f44379aba948c2cd791b3b97210e31 (#6899 / "Remove safe_text_dupfile() and simplify EncodedFile") - cc @bluetech
Thanks for trying the rc @hroncok and @The-Compiler for the bisection (which is very helpful). It does look like a regression to me, i.e. the previous behavior seems better. I'll take a l... | 2020-07-20T15:55:11Z | 6.0 | ["testing/test_capture.py::TestCaptureFixture::test_cafd_preserves_newlines[\\r\\n]", "testing/test_capture.py::TestCaptureFixture::test_cafd_preserves_newlines[\\r]"] | ["test_capsysbinary.py::test_hello", "[100%]", "testing/test_capture.py::TestCaptureManager::test_capturing_basic_api[no]", "testing/test_capture.py::TestCaptureManager::test_capturing_basic_api[sys]", "testing/test_capture.py::TestCaptureManager::test_capturing_basic_api[fd]", "testing/test_capture.py::TestCaptureMana... | 634cde9506eb1f48dec3ec77974ee8dc952207c6 | <15 min fix | """
per-test stdout/stderr capturing mechanism.
"""
import collections
import contextlib
import io
import os
import sys
from io import UnsupportedOperation
from tempfile import TemporaryFile
from typing import Generator
from typing import Optional
from typing import TextIO
from typing import Tuple
from typing import U... | [
[
388,
394
]
] | src/_pytest/capture.py | python:3.11 |
pytest-dev/pytest | pytest-dev__pytest-7982 | a7e38c5c61928033a2dc1915cbee8caa8544a4d0 | diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py
--- a/src/_pytest/pathlib.py
+++ b/src/_pytest/pathlib.py
@@ -558,7 +558,7 @@ def visit(
entries = sorted(os.scandir(path), key=lambda entry: entry.name)
yield from entries
for entry in entries:
- if entry.is_dir(follow_symlinks=False) a... | diff --git a/testing/test_collection.py b/testing/test_collection.py
--- a/testing/test_collection.py
+++ b/testing/test_collection.py
@@ -9,6 +9,7 @@
from _pytest.main import _in_venv
from _pytest.main import Session
from _pytest.pathlib import symlink_or_skip
+from _pytest.pytester import Pytester
from _pytest.py... | Symlinked directories not collected since pytest 6.1.0
When there is a symlink to a directory in a test directory, is is just skipped over, but it should be followed and collected as usual.
This regressed in b473e515bc57ff1133fe650f1e7e6d7e22e5d841 (included in 6.1.0). For some reason I added a `follow_symlinks=Fals... | 2020-10-31T12:27:03Z | 6.2 | ["testing/test_collection.py::test_collect_symlink_dir"] | ["testing/test_collection.py::TestCollector::test_collect_versus_item", "testing/test_collection.py::test_fscollector_from_parent", "testing/test_collection.py::TestCollector::test_check_equality", "testing/test_collection.py::TestCollector::test_getparent", "testing/test_collection.py::TestCollector::test_getcustomfil... | 902739cfc3bbc3379e6ef99c8e250de35f52ecde | <15 min fix | import atexit
import contextlib
import fnmatch
import importlib.util
import itertools
import os
import shutil
import sys
import uuid
import warnings
from enum import Enum
from functools import partial
from os.path import expanduser
from os.path import expandvars
from os.path import isabs
from os.path import sep
from pa... | [
[
558,
564
]
] | src/_pytest/pathlib.py | python:3.11 | |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-11310 | 553b5fb8f84ba05c8397f26dd079deece2b05029 | diff --git a/sklearn/model_selection/_search.py b/sklearn/model_selection/_search.py
--- a/sklearn/model_selection/_search.py
+++ b/sklearn/model_selection/_search.py
@@ -17,6 +17,7 @@
from functools import partial, reduce
from itertools import product
import operator
+import time
import warnings
import numpy as... | diff --git a/sklearn/model_selection/tests/test_search.py b/sklearn/model_selection/tests/test_search.py
--- a/sklearn/model_selection/tests/test_search.py
+++ b/sklearn/model_selection/tests/test_search.py
@@ -26,6 +26,7 @@
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert... | Retrieving time to refit the estimator in BaseSearchCV
Basically, I'm trying to figure out how much time it takes to refit the best model on the full data after doing grid/random search. What I can so far do is retrieve the time it takes to fit and score each model:
```
import sklearn.datasets
import sklearn.model_s... | I'm fine with storing this. | 2018-06-18T12:10:19Z | 0.20 | ["sklearn/model_selection/tests/test_search.py::test_search_cv_timing"] | ["sklearn/model_selection/tests/test_search.py::test_parameter_grid", "sklearn/model_selection/tests/test_search.py::test_grid_search", "sklearn/model_selection/tests/test_search.py::test_grid_search_with_fit_params", "sklearn/model_selection/tests/test_search.py::test_random_search_with_fit_params", "sklearn/model_sel... | 55bf5d93e5674f13a1134d93a11fd0cd11aabcd1 | <15 min fix | """
The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the
parameters of an estimator.
"""
from __future__ import print_function
from __future__ import division
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas... | [
[
17,
23
],
[
767,
779
],
[
1080,
1090
],
[
1396,
1406
]
] | sklearn/model_selection/_search.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-12585 | bfc4a566423e036fbdc9fb02765fd893e4860c85 | diff --git a/sklearn/base.py b/sklearn/base.py
--- a/sklearn/base.py
+++ b/sklearn/base.py
@@ -48,7 +48,7 @@ def clone(estimator, safe=True):
# XXX: not handling dictionaries
if estimator_type in (list, tuple, set, frozenset):
return estimator_type([clone(e, safe=safe) for e in estimator])
- elif ... | diff --git a/sklearn/tests/test_base.py b/sklearn/tests/test_base.py
--- a/sklearn/tests/test_base.py
+++ b/sklearn/tests/test_base.py
@@ -167,6 +167,15 @@ def test_clone_sparse_matrices():
assert_array_equal(clf.empty.toarray(), clf_cloned.empty.toarray())
+def test_clone_estimator_types():
+ # Check t... | clone fails for parameters that are estimator types
#### Description
`clone` fails when one or more instance parameters are estimator types (i.e. not instances, but classes).
I know this is a somewhat unusual use case, but I'm working on a project that provides wrappers for sklearn estimators (https://github.com... | I'm not certain that we want to support this case: why do you want it to be
a class? Why do you want it to be a parameter? Why is this better as a
wrapper than a mixin?
The idea is the following: Suppose we have some
Estimator(param1=None, param2=None)
that implements `fit` and `predict` and has a fitted att... | 2018-11-14T13:20:30Z | 0.21 | ["sklearn/tests/test_base.py::test_clone_estimator_types"] | ["sklearn/tests/test_base.py::test_clone", "sklearn/tests/test_base.py::test_clone_2", "sklearn/tests/test_base.py::test_clone_buggy", "sklearn/tests/test_base.py::test_clone_empty_array", "sklearn/tests/test_base.py::test_clone_nan", "sklearn/tests/test_base.py::test_clone_sparse_matrices", "sklearn/tests/test_base.py... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix | """Base classes for all estimators."""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
from collections import defaultdict
import numpy as np
from scipy import sparse
from .externals import six
from .utils.fixes import signature
from . import __version__
... | [
[
48,
54
]
] | sklearn/base.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13135 | a061ada48efccf0845acae17009553e01764452b | diff --git a/sklearn/preprocessing/_discretization.py b/sklearn/preprocessing/_discretization.py
--- a/sklearn/preprocessing/_discretization.py
+++ b/sklearn/preprocessing/_discretization.py
@@ -172,6 +172,8 @@ def fit(self, X, y=None):
# 1D k-means procedure
km = KMeans(n_clusters=n_b... | diff --git a/sklearn/preprocessing/tests/test_discretization.py b/sklearn/preprocessing/tests/test_discretization.py
--- a/sklearn/preprocessing/tests/test_discretization.py
+++ b/sklearn/preprocessing/tests/test_discretization.py
@@ -185,11 +185,12 @@ def test_invalid_strategy_option():
@pytest.mark.parametrize(
... | KBinsDiscretizer: kmeans fails due to unsorted bin_edges
#### Description
`KBinsDiscretizer` with `strategy='kmeans` fails in certain situations, due to centers and consequently bin_edges being unsorted, which is fatal for np.digitize.
#### Steps/Code to Reproduce
A very simple way to reproduce this is to set n_b... | 2019-02-11T21:34:25Z | 0.21 | ["sklearn/preprocessing/tests/test_discretization.py::test_nonuniform_strategies[kmeans-expected_2bins1-expected_3bins1-expected_5bins1]"] | ["sklearn/preprocessing/tests/test_discretization.py::test_fit_transform[uniform-expected0]", "sklearn/preprocessing/tests/test_discretization.py::test_fit_transform[kmeans-expected1]", "sklearn/preprocessing/tests/test_discretization.py::test_fit_transform[quantile-expected2]", "sklearn/preprocessing/tests/test_discre... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix | # -*- coding: utf-8 -*-
# Author: Henry Lin <hlin117@gmail.com>
# Tom Dupré la Tour
# License: BSD
import numbers
import numpy as np
import warnings
from . import OneHotEncoder
from ..base import BaseEstimator, TransformerMixin
from ..utils.validation import check_array
from ..utils.validation import chec... | [
[
172,
179
]
] | sklearn/preprocessing/_discretization.py | python:3.11 | |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13142 | 1c8668b0a021832386470ddf740d834e02c66f69 | diff --git a/sklearn/mixture/base.py b/sklearn/mixture/base.py
--- a/sklearn/mixture/base.py
+++ b/sklearn/mixture/base.py
@@ -257,11 +257,6 @@ def fit_predict(self, X, y=None):
best_params = self._get_parameters()
best_n_iter = n_iter
- # Always do a final e-step to guarantee... | diff --git a/sklearn/mixture/tests/test_bayesian_mixture.py b/sklearn/mixture/tests/test_bayesian_mixture.py
--- a/sklearn/mixture/tests/test_bayesian_mixture.py
+++ b/sklearn/mixture/tests/test_bayesian_mixture.py
@@ -451,6 +451,15 @@ def test_bayesian_mixture_fit_predict(seed, max_iter, tol):
assert_array_eq... | GaussianMixture predict and fit_predict disagree when n_init>1
#### Description
When `n_init` is specified in GaussianMixture, the results of fit_predict(X) and predict(X) are often different. The `test_gaussian_mixture_fit_predict` unit test doesn't catch this because it does not set `n_init`.
#### Steps/Code to ... | Indeed the code in fit_predict and the one in predict are not exactly consistent. This should be fixed but we would need to check the math to choose the correct variant, add a test and remove the other one.
I don't think the math is wrong or inconsistent. I think it's a matter of `fit_predict` returning the fit from t... | 2019-02-12T14:32:37Z | 0.21 | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_fit_predict_n_init", "sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_fit_predict_n_init"] | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_log_dirichlet_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_log_wishart_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_covariance_type", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_weight_conc... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix | """Base class for mixture models."""
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import warnings
from abc import ABCMeta, abstractmethod
from time import time
import numpy as np
from .. import cluster
from ..base import BaseEstima... | [
[
257,
262
],
[
268,
278
]
] | sklearn/mixture/base.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13328 | 37b0e66c871e8fb032a9c7086b2a1d5419838154 | diff --git a/sklearn/linear_model/huber.py b/sklearn/linear_model/huber.py
--- a/sklearn/linear_model/huber.py
+++ b/sklearn/linear_model/huber.py
@@ -251,7 +251,8 @@ def fit(self, X, y, sample_weight=None):
self : object
"""
X, y = check_X_y(
- X, y, copy=False, accept_sparse=['cs... | diff --git a/sklearn/linear_model/tests/test_huber.py b/sklearn/linear_model/tests/test_huber.py
--- a/sklearn/linear_model/tests/test_huber.py
+++ b/sklearn/linear_model/tests/test_huber.py
@@ -53,8 +53,12 @@ def test_huber_gradient():
rng = np.random.RandomState(1)
X, y = make_regression_with_outliers()
... | TypeError when supplying a boolean X to HuberRegressor fit
#### Description
`TypeError` when fitting `HuberRegressor` with boolean predictors.
#### Steps/Code to Reproduce
```python
import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import HuberRegressor
# Random data... | 2019-02-28T12:47:52Z | 0.21 | ["sklearn/linear_model/tests/test_huber.py::test_huber_bool"] | ["sklearn/linear_model/tests/test_huber.py::test_huber_equals_lr_for_high_epsilon", "sklearn/linear_model/tests/test_huber.py::test_huber_max_iter", "sklearn/linear_model/tests/test_huber.py::test_huber_gradient", "sklearn/linear_model/tests/test_huber.py::test_huber_sample_weights", "sklearn/linear_model/tests/test_hu... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix | # Authors: Manoj Kumar mks542@nyu.edu
# License: BSD 3 clause
import numpy as np
from scipy import optimize
from ..base import BaseEstimator, RegressorMixin
from .base import LinearModel
from ..utils import check_X_y
from ..utils import check_consistent_length
from ..utils import axis0_safe_slice
from ..utils.extmat... | [
[
251,
258
]
] | sklearn/linear_model/huber.py | python:3.11 | |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13439 | a62775e99f2a5ea3d51db7160fad783f6cd8a4c5 | diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py
--- a/sklearn/pipeline.py
+++ b/sklearn/pipeline.py
@@ -199,6 +199,12 @@ def _iter(self, with_final=True):
if trans is not None and trans != 'passthrough':
yield idx, name, trans
+ def __len__(self):
+ """
+ Returns ... | 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
@@ -1069,5 +1069,6 @@ def test_make_pipeline_memory():
assert pipeline.memory is memory
pipeline = make_pipeline(DummyTransf(), SVC())
assert pipeline.mem... | Pipeline should implement __len__
#### Description
With the new indexing support `pipe[:len(pipe)]` raises an error.
#### Steps/Code to Reproduce
```python
from sklearn import svm
from sklearn.datasets import samples_generator
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection... | None should work just as well, but perhaps you're right that len should be
implemented. I don't think we should implement other things from sequences
such as iter, however.
I think len would be good to have but I would also try to add as little as possible.
+1
>
I am looking at it. | 2019-03-12T20:32:50Z | 0.21 | ["sklearn/tests/test_pipeline.py::test_make_pipeline_memory"] | ["sklearn/tests/test_pipeline.py::test_pipeline_init", "sklearn/tests/test_pipeline.py::test_pipeline_init_tuple", "sklearn/tests/test_pipeline.py::test_pipeline_methods_anova", "sklearn/tests/test_pipeline.py::test_pipeline_fit_params", "sklearn/tests/test_pipeline.py::test_pipeline_sample_weight_supported", "sklearn/... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix | """
The :mod:`sklearn.pipeline` module implements utilities to build a composite
estimator, as a chain of transforms and estimators.
"""
# Author: Edouard Duchesnay
# Gael Varoquaux
# Virgile Fritsch
# Alexandre Gramfort
# Lars Buitinck
# License: BSD
from collections import defaultdict... | [
[
199,
210
]
] | sklearn/pipeline.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13496 | 3aefc834dce72e850bff48689bea3c7dff5f3fad | diff --git a/sklearn/ensemble/iforest.py b/sklearn/ensemble/iforest.py
--- a/sklearn/ensemble/iforest.py
+++ b/sklearn/ensemble/iforest.py
@@ -120,6 +120,12 @@ class IsolationForest(BaseBagging, OutlierMixin):
verbose : int, optional (default=0)
Controls the verbosity of the tree building process.
+ ... | diff --git a/sklearn/ensemble/tests/test_iforest.py b/sklearn/ensemble/tests/test_iforest.py
--- a/sklearn/ensemble/tests/test_iforest.py
+++ b/sklearn/ensemble/tests/test_iforest.py
@@ -295,6 +295,28 @@ def test_score_samples():
clf2.score_samples([[2., 2.]]))
+@pytest.mark.filterwarnings('... | Expose warm_start in Isolation forest
It seems to me that `sklearn.ensemble.IsolationForest` supports incremental addition of new trees with the `warm_start` parameter of its parent class, `sklearn.ensemble.BaseBagging`.
Even though this parameter is not exposed in `__init__()` , it gets inherited from `BaseBagging`... | +1 to expose `warm_start` in `IsolationForest`, unless there was a good reason for not doing so in the first place. I could not find any related discussion in the IsolationForest PR #4163. ping @ngoix @agramfort?
no objection
>
PR welcome @petibear. Feel
free to ping me when it’s ready for reviews :).
OK, I'm workin... | 2019-03-23T09:46:59Z | 0.21 | ["sklearn/ensemble/tests/test_iforest.py::test_iforest_warm_start"] | ["sklearn/ensemble/tests/test_iforest.py::test_iforest", "sklearn/ensemble/tests/test_iforest.py::test_iforest_sparse", "sklearn/ensemble/tests/test_iforest.py::test_iforest_error", "sklearn/ensemble/tests/test_iforest.py::test_recalculate_max_depth", "sklearn/ensemble/tests/test_iforest.py::test_max_samples_attribute"... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix | # Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import numbers
import numpy as np
from scipy.sparse import issparse
from warnings import warn
from ..tree import ExtraTreeRegressor
from ..utils import (
che... | [
[
120,
131
],
[
179,
186
],
[
192,
198
]
] | sklearn/ensemble/iforest.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13779 | b34751b7ed02b2cfcc36037fb729d4360480a299 | diff --git a/sklearn/ensemble/voting.py b/sklearn/ensemble/voting.py
--- a/sklearn/ensemble/voting.py
+++ b/sklearn/ensemble/voting.py
@@ -78,6 +78,8 @@ def fit(self, X, y, sample_weight=None):
if sample_weight is not None:
for name, step in self.estimators:
+ if step is None:
+ ... | 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
@@ -8,9 +8,11 @@
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raise_message
from sklearn.except... | Voting estimator will fail at fit if weights are passed and an estimator is None
Because we don't check for an estimator to be `None` in `sample_weight` support, `fit` is failing`.
```python
X, y = load_iris(return_X_y=True)
voter = VotingClassifier(
estimators=[('lr', LogisticRegression()),
... | 2019-05-03T13:24:57Z | 0.22 | ["sklearn/ensemble/tests/test_voting.py::test_none_estimator_with_weights[X0-y0-voter0]", "sklearn/ensemble/tests/test_voting.py::test_none_estimator_with_weights[X1-y1-voter1]"] | ["sklearn/ensemble/tests/test_voting.py::test_estimator_init", "sklearn/ensemble/tests/test_voting.py::test_predictproba_hardvoting", "sklearn/ensemble/tests/test_voting.py::test_notfitted", "sklearn/ensemble/tests/test_voting.py::test_majority_label_iris", "sklearn/ensemble/tests/test_voting.py::test_tie_situation", "... | 7e85a6d1f038bbb932b36f18d75df6be937ed00d | <15 min fix | """
Soft Voting/Majority Rule classifier and Voting regressor.
This module contains:
- A Soft Voting/Majority Rule classifier for classification estimators.
- A Voting regressor for regression estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>,
# ... | [
[
78,
85
]
] | sklearn/ensemble/voting.py | python:3.11 | |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-14141 | 3d997697fdd166eff428ea9fd35734b6a8ba113e | diff --git a/sklearn/utils/_show_versions.py b/sklearn/utils/_show_versions.py
--- a/sklearn/utils/_show_versions.py
+++ b/sklearn/utils/_show_versions.py
@@ -48,6 +48,7 @@ def _get_deps_info():
"Cython",
"pandas",
"matplotlib",
+ "joblib",
]
def get_version(module):
| diff --git a/sklearn/utils/tests/test_show_versions.py b/sklearn/utils/tests/test_show_versions.py
--- a/sklearn/utils/tests/test_show_versions.py
+++ b/sklearn/utils/tests/test_show_versions.py
@@ -23,6 +23,7 @@ def test_get_deps_info():
assert 'Cython' in deps_info
assert 'pandas' in deps_info
assert '... | Add joblib in show_versions
joblib should be added to the dependencies listed in show_versions or added to the issue template when sklearn version is > 0.20.
| 2019-06-21T20:53:37Z | 0.22 | ["sklearn/utils/tests/test_show_versions.py::test_get_deps_info"] | ["sklearn/utils/tests/test_show_versions.py::test_get_sys_info", "sklearn/utils/tests/test_show_versions.py::test_show_versions_with_blas"] | 7e85a6d1f038bbb932b36f18d75df6be937ed00d | <15 min fix | """
Utility methods to print system info for debugging
adapted from :func:`pandas.show_versions`
"""
# License: BSD 3 clause
import platform
import sys
import importlib
def _get_sys_info():
"""System information
Return
------
sys_info : dict
system and Python version information
"""
... | [
[
48,
54
]
] | sklearn/utils/_show_versions.py | python:3.11 | |
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 & 4... | 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... | 2019-07-28T13:47:05Z | 0.22 | ["sklearn/cluster/tests/test_optics.py::test_extract_xi"] | ["sklearn/cluster/tests/test_optics.py::test_extend_downward[r_plot0-3]", "sklearn/cluster/tests/test_optics.py::test_extend_downward[r_plot1-0]", "sklearn/cluster/tests/test_optics.py::test_extend_downward[r_plot2-4]", "sklearn/cluster/tests/test_optics.py::test_extend_downward[r_plot3-4]", "sklearn/cluster/tests/test... | 7e85a6d1f038bbb932b36f18d75df6be937ed00d | <15 min fix | # -*- coding: utf-8 -*-
"""Ordering Points To Identify the Clustering Structure (OPTICS)
These routines execute the OPTICS algorithm, and implement various
cluster extraction methods of the ordered list.
Authors: Shane Grigsby <refuge@rocktalus.com>
Adrin Jalali <adrinjalali@gmail.com>
Erich Schuber... | [
[
44,
50
],
[
341,
347
],
[
437,
443
],
[
582,
588
],
[
619,
630
],
[
753,
764
]
] | sklearn/cluster/optics_.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-14983 | 06632c0d185128a53c57ccc73b25b6408e90bb89 | diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py
--- a/sklearn/model_selection/_split.py
+++ b/sklearn/model_selection/_split.py
@@ -1163,6 +1163,9 @@ def get_n_splits(self, X=None, y=None, groups=None):
**self.cvargs)
return cv.get_n_splits(X, y, groups)... | diff --git a/sklearn/model_selection/tests/test_split.py b/sklearn/model_selection/tests/test_split.py
--- a/sklearn/model_selection/tests/test_split.py
+++ b/sklearn/model_selection/tests/test_split.py
@@ -980,6 +980,17 @@ def test_repeated_cv_value_errors():
assert_raises(ValueError, cv, n_repeats=1.5)
+... | RepeatedKFold and RepeatedStratifiedKFold do not show correct __repr__ string
#### Description
`RepeatedKFold` and `RepeatedStratifiedKFold` do not show correct \_\_repr\_\_ string.
#### Steps/Code to Reproduce
```python
>>> from sklearn.model_selection import RepeatedKFold, RepeatedStratifiedKFold
>>> repr(... | The `__repr__` is not defined in the `_RepeatedSplit` class from which these cross-validation are inheriting. A possible fix should be:
```diff
diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py
index ab681e89c..8a16f68bc 100644
--- a/sklearn/model_selection/_split.py
+++ b/sklear... | 2019-09-14T15:31:18Z | 0.22 | ["sklearn/model_selection/tests/test_split.py::test_repeated_cv_repr[RepeatedKFold]", "sklearn/model_selection/tests/test_split.py::test_repeated_cv_repr[RepeatedStratifiedKFold]"] | ["sklearn/model_selection/tests/test_split.py::test_cross_validator_with_default_params", "sklearn/model_selection/tests/test_split.py::test_2d_y", "sklearn/model_selection/tests/test_split.py::test_kfold_valueerrors", "sklearn/model_selection/tests/test_split.py::test_kfold_indices", "sklearn/model_selection/tests/tes... | 7e85a6d1f038bbb932b36f18d75df6be937ed00d | <15 min fix | """
The :mod:`sklearn.model_selection._split` module includes classes and
functions to split the data based on a preset strategy.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>,
# Olivier Grisel <olivier.grisel@ensta.org>
# Ragha... | [
[
1163,
1171
],
[
2161,
2168
]
] | sklearn/model_selection/_split.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-25232 | f7eea978097085a6781a0e92fc14ba7712a52d75 | diff --git a/sklearn/impute/_iterative.py b/sklearn/impute/_iterative.py
--- a/sklearn/impute/_iterative.py
+++ b/sklearn/impute/_iterative.py
@@ -117,6 +117,15 @@ class IterativeImputer(_BaseImputer):
Which strategy to use to initialize the missing values. Same as the
`strategy` parameter in :class:`... | diff --git a/sklearn/impute/tests/test_impute.py b/sklearn/impute/tests/test_impute.py
--- a/sklearn/impute/tests/test_impute.py
+++ b/sklearn/impute/tests/test_impute.py
@@ -1524,6 +1524,21 @@ def test_iterative_imputer_keep_empty_features(initial_strategy):
assert_allclose(X_imputed[:, 1], 0)
+def test_itera... | IterativeImputer has no parameter "fill_value"
### Describe the workflow you want to enable
In the first imputation round of `IterativeImputer`, an initial value needs to be set for the missing values. From its [docs](https://scikit-learn.org/stable/modules/generated/sklearn.impute.IterativeImputer.html):
> **ini... | I think that we could consider that as a bug. We will have to add this parameter. Nowadays, I would find it easier just to pass a `SimpleImputer` instance.
@glemaitre
Thanks for your suggestion:
> pass a SimpleImputer instance.
Here is what I tried:
`from sklearn.experimental import enable_iterative_imputer # ... | 2022-12-24T15:32:44Z | 1.3 | ["sklearn/impute/tests/test_impute.py::test_iterative_imputer_constant_fill_value"] | ["sklearn/impute/tests/test_impute.py::test_imputation_shape[mean]", "sklearn/impute/tests/test_impute.py::test_imputation_shape[median]", "sklearn/impute/tests/test_impute.py::test_imputation_shape[most_frequent]", "sklearn/impute/tests/test_impute.py::test_imputation_shape[constant]", "sklearn/impute/tests/test_imput... | 1e8a5b833d1b58f3ab84099c4582239af854b23a | <15 min fix | from time import time
from collections import namedtuple
from numbers import Integral, Real
import warnings
from scipy import stats
import numpy as np
from ..base import clone
from ..exceptions import ConvergenceWarning
from ..preprocessing import normalize
from ..utils import (
check_array,
check_random_stat... | [
[
117,
131
],
[
290,
296
],
[
311,
317
],
[
333,
339
],
[
625,
631
]
] | sklearn/impute/_iterative.py | python:3.11 |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-25973 | 10dbc142bd17ccf7bd38eec2ac04b52ce0d1009e | diff --git a/sklearn/feature_selection/_sequential.py b/sklearn/feature_selection/_sequential.py
--- a/sklearn/feature_selection/_sequential.py
+++ b/sklearn/feature_selection/_sequential.py
@@ -8,12 +8,12 @@
import warnings
from ._base import SelectorMixin
-from ..base import BaseEstimator, MetaEstimatorMixin, clo... | diff --git a/sklearn/feature_selection/tests/test_sequential.py b/sklearn/feature_selection/tests/test_sequential.py
--- a/sklearn/feature_selection/tests/test_sequential.py
+++ b/sklearn/feature_selection/tests/test_sequential.py
@@ -6,11 +6,12 @@
from sklearn.preprocessing import StandardScaler
from sklearn.pipelin... | Unable to pass splits to SequentialFeatureSelector
### Describe the bug
This runs fine with e.g. `cv=5`, but according to the documentation, it should also be able to take an iterable of splits.
However, passing splits from the cross validator fails
Im fairly certain I have done similar things in the past to other... | The internal algorithm will use the `cv` parameter in a `for` loop. If `cv` is a generator, it will be consumed at the first iteration only. Later it trigger the error because we did not complete the other iteration of the `for` loop.
Passing a list (e.g. `cv=list(splits)`) will solve the problem because we can reus... | 2023-03-25T13:27:07Z | 1.3 | ["sklearn/feature_selection/tests/test_sequential.py::test_cv_generator_support"] | ["sklearn/feature_selection/tests/test_sequential.py::test_bad_n_features_to_select", "sklearn/feature_selection/tests/test_sequential.py::test_n_features_to_select[1-forward]", "sklearn/feature_selection/tests/test_sequential.py::test_n_features_to_select[1-backward]", "sklearn/feature_selection/tests/test_sequential.... | 1e8a5b833d1b58f3ab84099c4582239af854b23a | <15 min fix | """
Sequential feature selection
"""
from numbers import Integral, Real
import numpy as np
import warnings
from ._base import SelectorMixin
from ..base import BaseEstimator, MetaEstimatorMixin, clone
from ..utils._param_validation import HasMethods, Hidden, Interval, StrOptions
from ..utils._param_validation import ... | [
[
8,
19
],
[
259,
266
],
[
277,
283
],
[
293,
299
],
[
311,
317
]
] | sklearn/feature_selection/_sequential.py | python:3.11 |
sphinx-doc/sphinx | sphinx-doc__sphinx-10323 | 31eba1a76dd485dc633cae48227b46879eda5df4 | diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -224,9 +224,9 @@ def read(self, location: Tuple[str, int] = None) -> Tuple[str, int]:
self.start_filter,
self.end_filter,
... | diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py
--- a/tests/test_directive_code.py
+++ b/tests/test_directive_code.py
@@ -251,6 +251,19 @@ def test_LiteralIncludeReader_dedent(literal_inc_path):
"\n")
+@pytest.mark.xfail(os.name != 'posix', reason="Not working on win... | Use of literalinclude prepend results in incorrect indent formatting for code eamples
### Describe the bug
Cannot determine a mechanism to use literalinclude directive with `prepend` or `append` to match code example indentation, as leading whitespace is removed.
### How to Reproduce
Example of including xml s... | Docutils; the reST parser library ignores the leading whitespaces of directive options. So it's difficult to handle it from directive implementation.
>Use of dedent could be a good solution, if dedent was applied only to the literalinclude and not to the prepend and append content.
Sounds good. The combination of... | 2022-04-02T14:42:24Z | 5.0 | ["tests/test_directive_code.py::test_LiteralIncludeReader_dedent_and_append_and_prepend"] | ["tests/test_directive_code.py::test_LiteralIncludeReader", "tests/test_directive_code.py::test_LiteralIncludeReader_lineno_start", "tests/test_directive_code.py::test_LiteralIncludeReader_pyobject1", "tests/test_directive_code.py::test_LiteralIncludeReader_pyobject2", "tests/test_directive_code.py::test_LiteralInclude... | 60775ec4c4ea08509eee4b564cbf90f316021aff | <15 min fix | import sys
import textwrap
from difflib import unified_diff
from typing import TYPE_CHECKING, Any, Dict, List, Tuple
from docutils import nodes
from docutils.nodes import Element, Node
from docutils.parsers.rst import directives
from docutils.statemachine import StringList
from sphinx import addnodes
from sphinx.conf... | [
[
224,
232
]
] | sphinx/directives/code.py | python:3.11 |
sphinx-doc/sphinx | sphinx-doc__sphinx-10435 | f1061c012e214f16fd8790dec3c283d787e3daa8 | diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -1710,11 +1710,11 @@ def visit_literal(self, node: Element) -> None:
# TODO: Use nowrap option once LaTeX formatter supports it
# https://github.com/pygments/pygments/pull/1343... | 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
@@ -1623,7 +1623,7 @@ def test_latex_code_role(app):
r'\PYG{p}{)}'
r'\PYG{p}{:} '
r'\PYG{k}{pass}')
- assert (r'Inline \sphinxcode{\sphinxupquote{' + '\n' +
- ... | LaTeX: new Inline code highlighting from #10251 adds whitespace at start and end in pdf output
### Describe the bug
The #10251 enhancement activates syntax highlighting for the Docutiles `code` role. For LaTeX output, a space character is inserted at start and end of the inline code.
Example
```
Inline \sphinxc... | 2022-05-08T09:37:06Z | 5.0 | ["tests/test_build_latex.py::test_latex_code_role"] | ["tests/test_build_latex.py::test_writer", "tests/test_build_latex.py::test_latex_warnings", "tests/test_build_latex.py::test_latex_basic", "tests/test_build_latex.py::test_latex_basic_manual", "tests/test_build_latex.py::test_latex_basic_howto", "tests/test_build_latex.py::test_latex_basic_manual_ja", "tests/test_buil... | 60775ec4c4ea08509eee4b564cbf90f316021aff | <15 min fix | """Custom docutils writer for LaTeX.
Much of this code is adapted from Dave Kuhlman's "docpy" writer from his
docutils sandbox.
"""
import re
import warnings
from collections import defaultdict
from os import path
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Set, Tuple, cast
from docutils import node... | [
[
1710,
1720
]
] | sphinx/writers/latex.py | python:3.11 | |
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... | 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_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_init", "tests/test_ext_autodoc_configs.py::test_autodoc_class_signature_mixed", "tests/test_ext_autodoc_configs.py::test_autodoc_class_signature_separated_init", "tests/test_ext_autodoc_configs... | 571b55328d401a6e1d50e37407df56586065a7be | <15 min fix | """Generating content for autodoc using typehints"""
import re
from collections import OrderedDict
from typing import Any, Dict, Iterable, Set, cast
from docutils import nodes
from docutils.nodes import Element
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.util import inspect, typing
... | [
[
59,
68
],
[
86,
93
],
[
128,
137
]
] | sphinx/ext/autodoc/typehints.py | python:3.11 |
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/f7cc38367... | Sorry for the inconvenience. Indeed, this must be a bug. I'll take a look this later. | 2020-04-08T13:46:43Z | 3.0 | ["tests/test_domain_std.py::test_glossary"] | ["tests/test_domain_std.py::test_process_doc_handle_figure_caption", "tests/test_domain_std.py::test_process_doc_handle_table_title", "tests/test_domain_std.py::test_get_full_qualified_name", "tests/test_domain_std.py::test_glossary_warning", "tests/test_domain_std.py::test_glossary_comment", "tests/test_domain_std.py:... | 50d2d289e150cb429de15770bdd48a723de8c45d | <15 min fix | """
sphinx.domains.std
~~~~~~~~~~~~~~~~~~
The standard domain.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import unicodedata
import warnings
from copy import copy
from typing import Any, Callable, Dict, Iterable, Iterator... | [
[
305,
311
],
[
565,
571
]
] | sphinx/domains/std.py | python:3.11 |
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 signat... | 2020-04-09T17:08:30Z | 3.0 | ["tests/test_domain_py.py::test_parse_annotation"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_get_full_qualified_nam... | 50d2d289e150cb429de15770bdd48a723de8c45d | <15 min fix | """
sphinx.domains.python
~~~~~~~~~~~~~~~~~~~~~
The Python domain.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import builtins
import inspect
import re
import typing
import warnings
from inspect import Parameter
from typing import A... | [
[
71,
83
]
] | sphinx/domains/python.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-7889 | ec9af606c6cfa515f946d74da9b51574f2f9b16f | diff --git a/sphinx/ext/autodoc/mock.py b/sphinx/ext/autodoc/mock.py
--- a/sphinx/ext/autodoc/mock.py
+++ b/sphinx/ext/autodoc/mock.py
@@ -52,8 +52,8 @@ def __iter__(self) -> Iterator:
def __mro_entries__(self, bases: Tuple) -> Tuple:
return (self.__class__,)
- def __getitem__(self, key: str) -> "_Mo... | diff --git a/tests/test_ext_autodoc_mock.py b/tests/test_ext_autodoc_mock.py
--- a/tests/test_ext_autodoc_mock.py
+++ b/tests/test_ext_autodoc_mock.py
@@ -11,6 +11,7 @@
import abc
import sys
from importlib import import_module
+from typing import TypeVar
import pytest
@@ -39,6 +40,7 @@ def test_MockObject():
... | Autodoc extension's mock file throws TypeError for generic-typed classes.
**Describe the bug**
When building the docs for a generically-typed class, a TypeError is thrown as Autodoc's `mock._make_subclass` attempts to concatenate a `str` to a `TypeVar`. See the attached log: [sphinx-err-325ndteh.log](https://github.co... | 2020-06-29T16:20:55Z | 3.2 | ["tests/test_ext_autodoc_mock.py::test_MockObject"] | ["tests/test_ext_autodoc_mock.py::test_MockModule", "tests/test_ext_autodoc_mock.py::test_mock", "tests/test_ext_autodoc_mock.py::test_mock_does_not_follow_upper_modules", "tests/test_ext_autodoc_mock.py::test_abc_MockObject", "tests/test_ext_autodoc_mock.py::test_mock_decorator"] | f92fa6443fe6f457ab0c26d41eb229e825fda5e1 | <15 min fix | """
sphinx.ext.autodoc.mock
~~~~~~~~~~~~~~~~~~~~~~~
mock for autodoc
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import contextlib
import os
import sys
from importlib.abc import Loader, MetaPathFinder
from importlib.machinery import... | [
[
52,
59
]
] | sphinx/ext/autodoc/mock.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-7910 | 27ac10de04697e2372d31db5548e56a7c6d9265d | 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
@@ -13,6 +13,7 @@
from sphinx import __display_version__ as __version__
from sphinx.application import Sphinx
from sphinx.ext.napoleon.docstring import GoogleDocs... | diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py
--- a/sphinx/testing/util.py
+++ b/sphinx/testing/util.py
@@ -7,6 +7,7 @@
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+import functools
import os
import re
import sys
@@ -195,3 +19... | Decorated __init__ doesn't show up in docs
Subject: Decorated __init__ won't be documented. I'm working on [tensorpack](github.com/ppwwyyxx/tensorpack)
### Problem
- I have `napoleon_include_init_with_doc = True`, so `__init__` will be documented. But if I decorate the `__init__` method, it will not show up in docs... | I've found the same issue if you decorate the class as well.
Environment info
* OS: <Unix/Linux/Mac/Win/other with version>: Win
* Python version: 3.6
* Sphinx version: 1.7.5
Two years have passed.
I can try to submit a PR, will it be considered?
Yes, it must be helpful! | 2020-07-04T01:08:20Z | 3.2 | ["tests/test_ext_napoleon.py::SkipMemberTest::test_class_decorated_doc"] | ["tests/test_ext_napoleon.py::ProcessDocstringTest::test_modify_in_place", "tests/test_ext_napoleon.py::SetupTest::test_add_config_values", "tests/test_ext_napoleon.py::SetupTest::test_unknown_app_type", "tests/test_ext_napoleon.py::SkipMemberTest::test_class_private_doc", "tests/test_ext_napoleon.py::SkipMemberTest::t... | f92fa6443fe6f457ab0c26d41eb229e825fda5e1 | <15 min fix | """
sphinx.ext.napoleon
~~~~~~~~~~~~~~~~~~~
Support for NumPy and Google style docstrings.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from typing import Any, Dict, List
from sphinx import __display_version__ as __version__
from sp... | [
[
13,
19
],
[
439,
445
]
] | sphinx/ext/napoleon/__init__.py | python:3.11 |
sphinx-doc/sphinx | sphinx-doc__sphinx-8269 | 1e2ccd8f0eca0870cf6f8fce6934e2da8eba9b72 | diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -166,6 +166,7 @@ def check_uri() -> Tuple[str, str, int]:
# Read the whole document and see if #anchor exists
response = requests.ge... | diff --git a/tests/roots/test-linkcheck-localserver/conf.py b/tests/roots/test-linkcheck-localserver/conf.py
new file mode 100644
--- /dev/null
+++ b/tests/roots/test-linkcheck-localserver/conf.py
@@ -0,0 +1,2 @@
+exclude_patterns = ['_build']
+linkcheck_anchors = True
diff --git a/tests/roots/test-linkcheck-localserve... | Linkcheck should report HTTP errors instead of Anchor not found
**Describe the bug**
The `linkcheck` command always reports that it was unable to find the anchor when [`linkcheck_anchors`](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-linkcheck_workers) is `True`, even when the server replied w... | 2020-10-03T11:08:37Z | 3.3 | ["tests/test_build_linkcheck.py::test_raises_for_invalid_status"] | ["tests/test_build_linkcheck.py::test_defaults", "tests/test_build_linkcheck.py::test_defaults_json", "tests/test_build_linkcheck.py::test_anchors_ignored", "tests/test_build_linkcheck.py::test_auth", "tests/test_build_linkcheck.py::test_linkcheck_request_headers"] | 3b85187ffa3401e88582073c23188c147857a8a3 | <15 min fix | """
sphinx.builders.linkcheck
~~~~~~~~~~~~~~~~~~~~~~~~~
The CheckExternalLinksBuilder class.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import json
import queue
import re
import socket
import threading
from html.parser import HTMLP... | [
[
166,
172
]
] | sphinx/builders/linkcheck.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-8459 | 68aa4fb29e7dfe521749e1e14f750d7afabb3481 | 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
@@ -27,7 +27,7 @@ def record_typehints(app: Sphinx, objtype: str, name: str, obj: Any,
if callable(obj):
annotations = app.env.temp_data.setdef... | 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
@@ -777,6 +777,28 @@ def test_autodoc_type_aliases(app):
]
+@pytest.mark.skipif(sys.version_info < (3, 7), reason='python 3.7+ is required.')
+@pyte... | autodoc_type_aliases doesn't work when autodoc_typehints is set to "description"
**Describe the bug**
autodoc_type_aliases doesn't work when autodoc_typehints is set to "description".
**To Reproduce**
types.py
```python
from __future__ import annotations
from typing import Any, Dict
JSONObject = Dict[str... | 2020-11-20T16:44:10Z | 3.4 | ["tests/test_ext_autodoc_configs.py::test_autodoc_typehints_description_and_type_aliases"] | ["tests/test_ext_autodoc_configs.py::test_autoclass_content_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_init", "tests/test_ext_autodoc_configs.py::test_autoclass_content_both", "tests/test_ext_autodoc_configs.py::test_autodoc_inherit_docstrings", "tests/test_ext_autodoc_configs.py::test_autodoc_d... | 3f560cd67239f75840cc7a439ab54d8509c855f6 | <15 min fix | """
sphinx.ext.autodoc.typehints
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Generating content for autodoc using typehints
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from collections import OrderedDict
from typing import Any, Dict, Ite... | [
[
27,
33
]
] | sphinx/ext/autodoc/typehints.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-8475 | 3ea1ec84cc610f7a9f4f6b354e264565254923ff | diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -20,7 +20,7 @@
from docutils import nodes
from docutils.nodes import Node
-from requests.exceptions import HTTPError
+from requests.exceptions import HTTPError, TooManyRe... | diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py
--- a/tests/test_build_linkcheck.py
+++ b/tests/test_build_linkcheck.py
@@ -382,3 +382,31 @@ def test_connect_to_selfsigned_nonexistent_cert_file(app):
"uri": "https://localhost:7777/",
"info": "Could not find a suitable TLS CA... | Extend linkchecker GET fallback logic to handle Too Many Redirects
Subject: linkcheck - fallback to GET requests when HEAD requests returns Too Many Redirects
### Feature or Bugfix
- Bugfix
### Purpose
Some websites will enter infinite redirect loops with HEAD requests. In this case, the GET fallback is ign... | 2020-11-22T16:54:19Z | 3.4 | ["tests/test_build_linkcheck.py::test_TooManyRedirects_on_HEAD"] | ["tests/test_build_linkcheck.py::test_defaults", "tests/test_build_linkcheck.py::test_defaults_json", "tests/test_build_linkcheck.py::test_anchors_ignored", "tests/test_build_linkcheck.py::test_raises_for_invalid_status", "tests/test_build_linkcheck.py::test_auth_header_uses_first_match", "tests/test_build_linkcheck.py... | 3f560cd67239f75840cc7a439ab54d8509c855f6 | <15 min fix | """
sphinx.builders.linkcheck
~~~~~~~~~~~~~~~~~~~~~~~~~
The CheckExternalLinksBuilder class.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import json
import queue
import re
import socket
import threading
from html.parser import HTMLP... | [
[
20,
26
],
[
172,
178
]
] | sphinx/builders/linkcheck.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-8595 | b19bce971e82f2497d67fdacdeca8db08ae0ba56 | 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
@@ -1074,7 +1074,7 @@ def get_module_members(self) -> Dict[str, ObjectMember]:
def get_object_members(self, want_all: bool) -> Tuple[bool, ObjectMembers]:
... | diff --git a/tests/roots/test-ext-autodoc/target/empty_all.py b/tests/roots/test-ext-autodoc/target/empty_all.py
new file mode 100644
--- /dev/null
+++ b/tests/roots/test-ext-autodoc/target/empty_all.py
@@ -0,0 +1,16 @@
+"""
+docsting of empty_all module.
+"""
+__all__ = []
+
+
+def foo():
+ """docstring"""
+
+
+def... | autodoc: empty __all__ attribute is ignored
**Describe the bug**
autodoc: empty `__all__` attribute is ignored
**To Reproduce**
```
# example.py
__all__ = []
def foo():
"docstring"
def bar():
"docstring"
def baz():
"docstring"
```
```
# index.rst
.. automodule:: example
:mem... | 2020-12-27T03:07:50Z | 3.5 | ["tests/test_ext_autodoc_automodule.py::test_empty_all"] | [] | 4f8cb861e3b29186b38248fe81e4944fd987fcce | <15 min fix | """
sphinx.ext.autodoc
~~~~~~~~~~~~~~~~~~
Automatically insert docstrings for functions, classes or whole modules into
the doctree, thus avoiding duplication between docstrings and documentation
for those who like elaborate docstrings.
:copyright: Copyright 2007-2020 by the Sphinx team, see AU... | [
[
1074,
1080
]
] | sphinx/ext/autodoc/__init__.py | python:3.11 | |
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 k... | 2020-12-30T12:13:09Z | 3.5 | ["tests/test_markup.py::test_inline[verify-:kbd:`Alt+^`-<p><kbd", "tests/test_markup.py::test_inline[verify-:kbd:`-`-<p><kbd"] | ["tests/test_markup.py::test_inline[verify-:rfc:`2324`-<p><span", "tests/test_markup.py::test_inline[verify-:rfc:`2324#id1`-<p><span", "tests/test_markup.py::test_inline[verify_re-``code", "tests/test_markup.py::test_inline[verify-:menuselection:`a", "tests/test_markup.py::test_inline[verify-:menuselection:`&Foo", "tes... | 4f8cb861e3b29186b38248fe81e4944fd987fcce | <15 min fix | """
sphinx.builders.html.transforms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Transforms for HTML builder.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from typing import Any, Dict
from docutils import nodes
from sphinx.application... | [
[
37,
43
]
] | sphinx/builders/html/transforms.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-8721 | 82ef497a8c88f0f6e50d84520e7276bfbf65025d | diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py
--- a/sphinx/ext/viewcode.py
+++ b/sphinx/ext/viewcode.py
@@ -182,6 +182,10 @@ def collect_pages(app: Sphinx) -> Generator[Tuple[str, Dict[str, Any], str], Non
env = app.builder.env
if not hasattr(env, '_viewcode_modules'):
return
+ if a... | diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py
--- a/tests/test_ext_viewcode.py
+++ b/tests/test_ext_viewcode.py
@@ -49,6 +49,21 @@ def test_viewcode(app, status, warning):
'<span> """</span></div>\n') in result
+@pytest.mark.sphinx('epub', testroot='ext-viewcode... | viewcode creates pages for epub even if `viewcode_enable_epub=False` on `make html epub`
**Describe the bug**
viewcode creates pages for epub even if `viewcode_enable_epub=False` on `make html epub`
**To Reproduce**
```
$ make html epub
```
**Expected behavior**
module pages should not be created for epub by... | 2021-01-21T15:36:24Z | 3.5 | ["tests/test_ext_viewcode.py::test_viewcode_epub_default"] | ["tests/test_ext_viewcode.py::test_viewcode_epub_enabled", "tests/test_ext_viewcode.py::test_linkcode", "tests/test_ext_viewcode.py::test_local_source_files"] | 4f8cb861e3b29186b38248fe81e4944fd987fcce | <15 min fix | """
sphinx.ext.viewcode
~~~~~~~~~~~~~~~~~~~
Add links to module code in Python object descriptions.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import posixpath
import traceback
from os import path
from typing import Any, Dict, Gene... | [
[
182,
191
]
] | sphinx/ext/viewcode.py | python:3.11 | |
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**
C... | 2021-05-15T11:33:05Z | 4.1 | ["tests/test_domain_py.py::test_info_field_list"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_xrefs_abbreviations", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_f... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | <15 min fix | """
sphinx.util.docfields
~~~~~~~~~~~~~~~~~~~~~
"Doc fields" are reST field lists in object descriptions that will
be domain-specifically transformed to a more appealing presentation.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
... | [
[
298,
304
]
] | sphinx/util/docfields.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-9258 | 06107f838c28ab6ca6bfc2cc208e15997fcb2146 | diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -304,7 +304,7 @@ def make_xref(self, rolename: str, domain: str, target: str,
def make_xrefs(self, rolename: str, domain: str, target: str,
innernode: Type[TextlikeN... | 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
@@ -1009,6 +1009,40 @@ def test_info_field_list(app):
**{"py:module": "example", "py:class": "Class"})
+def test_info_field_list_piped_type(app):
+ text = (".. py:module:: e... | [RFE] Support union types specification using | (vertical bar/pipe)
Please add a support for specifying multiple types acceptable for a parameter/attribute/variable.
Use case:
Imagine that there is a function that accepts both `bytes` and `str`. The docstring would look like:
``` restructuredtext
def foo(text):
""... | From [the docs](http://www.sphinx-doc.org/en/stable/domains.html#info-field-lists):
> Multiple types in a type field will be linked automatically if separated by the word “or”:
So this feature is already available using this syntax:
```python
def foo(foo):
"""
Bla blu
:type foo: str or int or N... | 2021-05-21T16:56:41Z | 4.1 | ["tests/test_domain_py.py::test_info_field_list_piped_type"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_xrefs_abbreviations", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_f... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | <15 min fix | """
sphinx.domains.python
~~~~~~~~~~~~~~~~~~~~~
The Python domain.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import builtins
import inspect
import re
import sys
import typing
import warnings
from inspect import Parameter
from typi... | [
[
304,
310
]
] | sphinx/domains/python.py | python:3.11 |
sphinx-doc/sphinx | sphinx-doc__sphinx-9281 | 8ec06e9a1bd862cd713b9db748e039ccc7b3e15b | diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -442,14 +442,14 @@ def object_description(object: Any) -> str:
(object_description(key), object_description(object[key]))
for key in sorted_keys)
... | 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
@@ -10,6 +10,7 @@
import ast
import datetime
+import enum
import functools
import sys
import types
@@ -516,6 +517,14 @@ def __repr__(self):
assert "<CustomType(2)>: 2" in de... | Python Enum values (used to show default values in function signatures) are rendered ugly.
Python Enum values (used to show default values in function signatures) are rendered ugly.
**To Reproduce**
I made a minimal example to show the issue:
https://github.com/sidneycadot/sphinx_issue_ugly_enum
```
$ git ... | Probably the repr() representation of default arguments is used, and it should be; that is supposed to give a string that, when evaluated, yields the value.
Unfortunately, the enum.Enum implementation in Python does not honor this convention; their repr() includes the Enum value and the "<>" brackets.
In an ideal... | 2021-05-29T17:16:30Z | 4.1 | ["tests/test_util_inspect.py::test_object_description_enum"] | ["tests/test_util_inspect.py::test_TypeAliasNamespace", "tests/test_util_inspect.py::test_signature", "tests/test_util_inspect.py::test_signature_partial", "tests/test_util_inspect.py::test_signature_methods", "tests/test_util_inspect.py::test_signature_partialmethod", "tests/test_util_inspect.py::test_signature_annota... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | <15 min fix | """
sphinx.util.inspect
~~~~~~~~~~~~~~~~~~~
Helpers for inspecting Python modules.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import builtins
import contextlib
import enum
import inspect
import re
import sys
import types
import typ... | [
[
442,
455
],
[
457,
465
]
] | sphinx/util/inspect.py | python:3.11 |
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 Ente... | 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_do_prompt", "tests/test_quickstart.py::test_do_prompt_inputstrip", "tests/test_quickstart.py::test_do_prompt_with_nonascii", "tests/test_quickstart.py::test_quickstart_defaults", "tests/test_quickstart.py::test_quickstart_all_answers", "tests/test_quickstart.py::test_generated_files_eol... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | <15 min fix | """
sphinx.cmd.quickstart
~~~~~~~~~~~~~~~~~~~~~
Quickly setup documentation source to work with Sphinx.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import argparse
import locale
import os
import sys
import time
from collections impo... | [
[
95,
106
],
[
229,
235
]
] | sphinx/cmd/quickstart.py | python:3.11 |
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
```
("(... | 2021-06-20T17:49:40Z | 4.1 | ["tests/test_pycode_ast.py::test_unparse[(1,)-(1,)]"] | ["tests/test_pycode_ast.py::test_unparse[a", "tests/test_pycode_ast.py::test_unparse[os.path-os.path]", "tests/test_pycode_ast.py::test_unparse[1", "tests/test_pycode_ast.py::test_unparse[b'bytes'-b'bytes']", "tests/test_pycode_ast.py::test_unparse[object()-object()]", "tests/test_pycode_ast.py::test_unparse[1234-1234_... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | <15 min fix | """
sphinx.pycode.ast
~~~~~~~~~~~~~~~~~
Helpers for AST (Abstract Syntax Tree).
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
from typing import Dict, List, Optional, Type, overload
if sys.version_info > (3, 8):
import... | [
[
213,
224
]
] | sphinx/pycode/ast.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-9591 | 9ed054279aeffd5b1d0642e2d24a8800389de29f | diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -861,7 +861,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
@@ -833,13 +833,15 @@ def test_pyproperty(app):
entries=[('single', 'prop1 (Class property)', 'Class.prop1', '', None)])
assert_node(doctree[1][1][1], ([desc_signature, ([desc... | Cross-references don't work in property's type annotations
### Describe the bug
A documented type in property's type annotation does not get cross-referenced:
```py
from typing import Optional
class Point:
"""
A class representing a point.
Attributes:
x: Position X.
y: Posit... | 2021-08-29T15:26:24Z | 4.2 | ["tests/test_domain_py.py::test_pyproperty"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_xrefs_abbreviations", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_f... | 336605b8e4b14c5da9f4d872fb730dc6894edb77 | <15 min fix | """
sphinx.domains.python
~~~~~~~~~~~~~~~~~~~~~
The Python domain.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import builtins
import inspect
import re
import sys
import typing
import warnings
from inspect import Parameter
from typi... | [
[
861,
868
]
] | sphinx/domains/python.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-9698 | f050a7775dfc9000f55d023d36d925a8d02ccfa8 | diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -796,7 +796,7 @@ def get_index_text(self, modname: str, name_cls: Tuple[str, str]) -> str:
if 'classmethod' in self.options:
return _('%s() (%s class method)') % (methn... | 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
@@ -756,7 +756,7 @@ def test_pymethod_options(app):
# :property:
assert_node(doctree[1][1][8], addnodes.index,
- entries=[('single', 'meth5() (Class property)', 'Class.me... | An index entry with parens was registered for `py:method` directive with `:property:` option
### Describe the bug
An index entry with parens was registered for `py:method` directive with `:property:` option. It should not have parens.
### How to Reproduce
```
# index.rst
.. py:method:: Foo.bar
:property:
... | 2021-10-03T04:04:04Z | 4.3 | ["tests/test_domain_py.py::test_pymethod_options"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_xrefs_abbreviations", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_f... | 6c6cc8a6f50b18331cb818160d168d7bb9c03e55 | <15 min fix | """
sphinx.domains.python
~~~~~~~~~~~~~~~~~~~~~
The Python domain.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import builtins
import inspect
import re
import sys
import typing
import warnings
from inspect import Parameter
from typi... | [
[
796,
802
]
] | sphinx/domains/python.py | python:3.11 | |
sphinx-doc/sphinx | sphinx-doc__sphinx-9711 | 81a4fd973d4cfcb25d01a7b0be62cdb28f82406d | diff --git a/sphinx/extension.py b/sphinx/extension.py
--- a/sphinx/extension.py
+++ b/sphinx/extension.py
@@ -10,6 +10,8 @@
from typing import TYPE_CHECKING, Any, Dict
+from packaging.version import InvalidVersion, Version
+
from sphinx.config import Config
from sphinx.errors import VersionRequirementError
fro... | diff --git a/tests/test_extension.py b/tests/test_extension.py
new file mode 100644
--- /dev/null
+++ b/tests/test_extension.py
@@ -0,0 +1,31 @@
+"""
+ test_extension
+ ~~~~~~~~~~~~~~
+
+ Test sphinx.extesion module.
+
+ :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
+ :license: BSD, se... | needs_extensions checks versions using strings
### Describe the bug
The `needs_extensions` check is handy for verifying minimum extension versions, but it only checks versions in a 'string-like' manner. This means any version >9 is not allowed for any check of something >1. That is, treated as string '0.6' > '0.10',... | 2021-10-06T15:08:03Z | 4.3 | ["tests/test_extension.py::test_needs_extensions"] | [] | 6c6cc8a6f50b18331cb818160d168d7bb9c03e55 | <15 min fix | """
sphinx.extension
~~~~~~~~~~~~~~~~
Utilities for Sphinx extensions.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from typing import TYPE_CHECKING, Any, Dict
from sphinx.config import Config
from sphinx.errors import VersionRequir... | [
[
10,
17
],
[
53,
70
]
] | sphinx/extension.py | python:3.11 | |
sympy/sympy | sympy__sympy-12096 | d7c3045115693e887bcd03599b7ca4650ac5f2cb | diff --git a/sympy/core/function.py b/sympy/core/function.py
--- a/sympy/core/function.py
+++ b/sympy/core/function.py
@@ -507,7 +507,7 @@ def _eval_evalf(self, prec):
func = getattr(mpmath, fname)
except (AttributeError, KeyError):
try:
- return Float(self._imp_(*self.... | diff --git a/sympy/utilities/tests/test_lambdify.py b/sympy/utilities/tests/test_lambdify.py
--- a/sympy/utilities/tests/test_lambdify.py
+++ b/sympy/utilities/tests/test_lambdify.py
@@ -751,6 +751,9 @@ def test_issue_2790():
assert lambdify((x, (y, (w, z))), w + x + y + z)(1, (2, (3, 4))) == 10
assert lambdi... | evalf does not call _imp_ recursively
Example from https://stackoverflow.com/questions/41818842/why-cant-i-evaluate-a-composition-of-implemented-functions-in-sympy-at-a-point:
```
>>> from sympy.utilities.lambdify import implemented_function
>>> f = implemented_function('f', lambda x: x ** 2)
>>> g = implemented_... | If this issue is still open then I would like to work on it
@mohit3011 it looks like https://github.com/sympy/sympy/issues/12096 fixes this.
@asmeurer But I see that it has failed in the Travis test
The Travis failure is an unrelated failure, which has been fixed in master. Once @parsoyaarihant pushes up a fix to... | 2017-01-25T13:40:24Z | 1.0 | ["test_issue_12092"] | ["test_no_args", "test_single_arg", "test_list_args", "test_str_args", "test_own_namespace", "test_own_module", "test_bad_args", "test_atoms", "test_sympy_lambda", "test_math_lambda", "test_mpmath_lambda", "test_number_precision", "test_mpmath_precision", "test_math_transl", "test_mpmath_transl", "test_exponentiation",... | 50b81f9f6be151014501ffac44e5dc6b2416938f | <15 min fix | """
There are three types of functions implemented in SymPy:
1) defined functions (in the sense that they can be evaluated) like
exp or sin; they have a name and a body:
f = exp
2) undefined function which have a name but no body. Undefined
functions can be defined using a Function cla... | [
[
507,
513
]
] | sympy/core/function.py | python:3.11 |
sympy/sympy | sympy__sympy-12481 | c807dfe7569692cad24f02a08477b70c1679a4dd | diff --git a/sympy/combinatorics/permutations.py b/sympy/combinatorics/permutations.py
--- a/sympy/combinatorics/permutations.py
+++ b/sympy/combinatorics/permutations.py
@@ -895,12 +895,8 @@ def __new__(cls, *args, **kwargs):
# counting starts from 1.
temp = flatten(args)
- if has_dups(temp)... | diff --git a/sympy/combinatorics/tests/test_permutations.py b/sympy/combinatorics/tests/test_permutations.py
--- a/sympy/combinatorics/tests/test_permutations.py
+++ b/sympy/combinatorics/tests/test_permutations.py
@@ -339,6 +339,7 @@ def test_args():
assert Permutation([[1], [4, 2]], size=1) == Permutation([0, 1,... | `Permutation` constructor fails with non-disjoint cycles
Calling `Permutation([[0,1],[0,1]])` raises a `ValueError` instead of constructing the identity permutation. If the cycles passed in are non-disjoint, they should be applied in left-to-right order and the resulting permutation should be returned.
This should ... | 2017-04-03T01:52:33Z | 1.0 | ["test_args"] | ["test_Permutation", "test_josephus", "test_ranking", "test_mul", "test_Cycle", "test_from_sequence", "test_printing_cyclic"] | 50b81f9f6be151014501ffac44e5dc6b2416938f | <15 min fix | from __future__ import print_function, division
import random
from collections import defaultdict
from sympy.core import Basic
from sympy.core.compatibility import is_sequence, reduce, range, as_int
from sympy.utilities.iterables import (flatten, has_variety, minlex,
has_dups, runs)
from sympy.polys.polytools imp... | [
[
895,
902
]
] | sympy/combinatorics/permutations.py | python:3.11 | |
sympy/sympy | sympy__sympy-13372 | 30379ea6e225e37833a764ac2da7b7fadf5fe374 | diff --git a/sympy/core/evalf.py b/sympy/core/evalf.py
--- a/sympy/core/evalf.py
+++ b/sympy/core/evalf.py
@@ -1301,12 +1301,16 @@ def evalf(x, prec, options):
elif re.is_number:
re = re._to_mpmath(prec, allow_ints=False)._mpf_
reprec = prec
+ else:
+ ... | diff --git a/sympy/core/tests/test_evalf.py b/sympy/core/tests/test_evalf.py
--- a/sympy/core/tests/test_evalf.py
+++ b/sympy/core/tests/test_evalf.py
@@ -230,6 +230,8 @@ def test_evalf_bugs():
#issue 11518
assert NS(2*x**2.5, 5) == '2.0000*x**2.5000'
+ #issue 13076
+ assert NS(Mul(Max(0, y), x, evalu... | UnboundLocalError in evalf
```
>>> Mul(x, Max(0, y), evaluate=False).evalf()
x*Max(0, y)
>>> Mul(Max(0, y), x, evaluate=False).evalf()
Traceback (most recent call last):
File "./sympy/core/evalf.py", line 1285, in evalf
rf = evalf_table[x.func]
KeyError: Max
During handling of the above exception, anoth... | An else for re and I'm needs to be added in which prec is set to None just before line 1308 where the error arises:
```
if re == 0:..
elif re.is_number:..
else:
reprec = None
```
Is the correct fix to set the prec to None or to raise NotImplementedError? I thought prec=None meant the number was an exact zer... | 2017-09-30T16:05:48Z | 1.1 | ["test_evalf_bugs"] | ["test_evalf_helpers", "test_evalf_basic", "test_cancellation", "test_evalf_powers", "test_evalf_rump", "test_evalf_complex", "test_evalf_complex_powers", "test_evalf_exponentiation", "test_evalf_complex_cancellation", "test_evalf_logs", "test_evalf_trig", "test_evalf_near_integers", "test_evalf_ramanujan", "test_evalf... | ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3 | <15 min fix | """
Adaptive numerical evaluation of SymPy expressions, using mpmath
for mathematical functions.
"""
from __future__ import print_function, division
import math
import mpmath.libmp as libmp
from mpmath import (
make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec)
from mpmath import inf as mpmath_inf... | [
[
1301,
1316
]
] | sympy/core/evalf.py | python:3.11 |
sympy/sympy | sympy__sympy-13480 | f57fe3f4b3f2cab225749e1b3b38ae1bf80b62f0 | diff --git a/sympy/functions/elementary/hyperbolic.py b/sympy/functions/elementary/hyperbolic.py
--- a/sympy/functions/elementary/hyperbolic.py
+++ b/sympy/functions/elementary/hyperbolic.py
@@ -587,7 +587,7 @@ def eval(cls, arg):
x, m = _peeloff_ipi(arg)
if m:
cot... | diff --git a/sympy/functions/elementary/tests/test_hyperbolic.py b/sympy/functions/elementary/tests/test_hyperbolic.py
--- a/sympy/functions/elementary/tests/test_hyperbolic.py
+++ b/sympy/functions/elementary/tests/test_hyperbolic.py
@@ -272,6 +272,8 @@ def test_coth():
assert coth(k*pi*I) == -cot(k*pi)*I
+ ... | .subs on coth(log(tan(x))) errors for certain integral values
>>> from sympy import *
>>> x = Symbol('x')
>>> e = coth(log(tan(x)))
>>> print(e.subs(x, 2))
...
File "C:\Users\E\Desktop\sympy-master\sympy\functions\elementary\hyperbolic.py", line 590, in eval
if cotm is S.ComplexInf... | There is a typo on [line 590](https://github.com/sympy/sympy/blob/master/sympy/functions/elementary/hyperbolic.py#L590): `cotm` should be `cothm`. | 2017-10-18T17:27:03Z | 1.1 | ["test_coth"] | ["test_sinh", "test_sinh_series", "test_cosh", "test_cosh_series", "test_tanh", "test_tanh_series", "test_coth_series", "test_csch", "test_csch_series", "test_sech", "test_sech_series", "test_asinh", "test_asinh_rewrite", "test_asinh_series", "test_acosh", "test_acosh_rewrite", "test_acosh_series", "test_asech", "test_... | ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3 | <15 min fix | from __future__ import print_function, division
from sympy.core import S, sympify, cacheit
from sympy.core.add import Add
from sympy.core.function import Function, ArgumentIndexError, _coeff_isneg
from sympy.functions.elementary.miscellaneous import sqrt
from sympy.functions.elementary.exponential import exp, log
fr... | [
[
587,
593
]
] | sympy/functions/elementary/hyperbolic.py | python:3.11 |
sympy/sympy | sympy__sympy-14711 | c6753448b5c34f95e250105d76709fe4d349ca1f | diff --git a/sympy/physics/vector/vector.py b/sympy/physics/vector/vector.py
--- a/sympy/physics/vector/vector.py
+++ b/sympy/physics/vector/vector.py
@@ -57,6 +57,8 @@ def __hash__(self):
def __add__(self, other):
"""The add operator for Vector. """
+ if other == 0:
+ return self
... | diff --git a/sympy/physics/vector/tests/test_vector.py b/sympy/physics/vector/tests/test_vector.py
--- a/sympy/physics/vector/tests/test_vector.py
+++ b/sympy/physics/vector/tests/test_vector.py
@@ -13,6 +13,8 @@ def test_Vector():
assert A.y != A.z
assert A.z != A.x
+ assert A.x + 0 == A.x
+
v1 = x... | vector add 0 error
```python
from sympy.physics.vector import ReferenceFrame, Vector
from sympy import symbols
sum([N.x, (0 * N.x)])
```
gives
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-inp... | 2018-05-12T17:00:20Z | 1.1 | ["test_Vector"] | ["test_Vector_diffs", "test_vector_var_in_dcm"] | ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3 | <15 min fix | from sympy.core.backend import (S, sympify, expand, sqrt, Add, zeros,
ImmutableMatrix as Matrix)
from sympy import trigsimp
from sympy.core.compatibility import unicode
from sympy.utilities.misc import filldedent
__all__ = ['Vector']
class Vector(object):
"""The class used to define vectors.
It along wi... | [
[
57,
64
]
] | sympy/physics/vector/vector.py | python:3.11 | |
sympy/sympy | sympy__sympy-15017 | 6810dee426943c1a2fe85b5002dd0d4cf2246a05 | diff --git a/sympy/tensor/array/dense_ndim_array.py b/sympy/tensor/array/dense_ndim_array.py
--- a/sympy/tensor/array/dense_ndim_array.py
+++ b/sympy/tensor/array/dense_ndim_array.py
@@ -149,7 +149,7 @@ def _new(cls, iterable, shape, **kwargs):
self._shape = shape
self._array = list(flat_list)
... | diff --git a/sympy/tensor/array/tests/test_immutable_ndim_array.py b/sympy/tensor/array/tests/test_immutable_ndim_array.py
--- a/sympy/tensor/array/tests/test_immutable_ndim_array.py
+++ b/sympy/tensor/array/tests/test_immutable_ndim_array.py
@@ -9,6 +9,10 @@
def test_ndim_array_initiation():
+ arr_with_no_elem... | `len` of rank-0 arrays returns 0
`sympy.tensor.array.NDimArray.__len__` always returns zero for rank-0 arrays (scalars). I believe the correct value should be one, which is the number of elements of the iterator and the observed behaviour in numpy.
```python
>>> import sympy
>>> a = sympy.Array(3)
>>> len(a)
0
... | 2018-08-03T03:15:04Z | 1.2 | ["test_ndim_array_initiation"] | ["test_reshape", "test_iterator", "test_sparse", "test_calculation", "test_ndim_array_converting", "test_converting_functions", "test_equality", "test_arithmetic", "test_higher_dimenions", "test_rebuild_immutable_arrays", "test_slices", "test_diff_and_applyfunc", "test_op_priority", "test_symbolic_indexing"] | e53e809176de9aa0fb62e85689f8cdb669d4cacb | <15 min fix | from __future__ import print_function, division
import functools
import itertools
from sympy.core.sympify import _sympify
from sympy import Basic, Tuple
from sympy.tensor.array.mutable_ndim_array import MutableNDimArray
from sympy.tensor.array.ndim_array import NDimArray, ImmutableNDimArray
class DenseNDimArray(ND... | [
[
149,
155
]
] | sympy/tensor/array/dense_ndim_array.py | python:3.11 | |
sympy/sympy | sympy__sympy-15345 | 9ef28fba5b4d6d0168237c9c005a550e6dc27d81 | diff --git a/sympy/printing/mathematica.py b/sympy/printing/mathematica.py
--- a/sympy/printing/mathematica.py
+++ b/sympy/printing/mathematica.py
@@ -31,7 +31,8 @@
"asech": [(lambda x: True, "ArcSech")],
"acsch": [(lambda x: True, "ArcCsch")],
"conjugate": [(lambda x: True, "Conjugate")],
-
+ "Max": ... | diff --git a/sympy/printing/tests/test_mathematica.py b/sympy/printing/tests/test_mathematica.py
--- a/sympy/printing/tests/test_mathematica.py
+++ b/sympy/printing/tests/test_mathematica.py
@@ -2,7 +2,7 @@
Rational, Integer, Tuple, Derivative)
from sympy.integrals import Integral
from sympy.... | mathematica_code gives wrong output with Max
If I run the code
```
x = symbols('x')
mathematica_code(Max(x,2))
```
then I would expect the output `'Max[x,2]'` which is valid Mathematica code but instead I get `'Max(2, x)'` which is not valid Mathematica code.
| Hi, I'm new (to the project and development in general, but I'm a long time Mathematica user) and have been looking into this problem.
The `mathematica.py` file goes thru a table of known functions (of which neither Mathematica `Max` or `Min` functions are in) that are specified with lowercase capitalization, so it ... | 2018-10-05T06:00:31Z | 1.4 | ["test_Function"] | ["test_Integer", "test_Rational", "test_Pow", "test_Mul", "test_constants", "test_containers", "test_Integral", "test_Derivative"] | 73b3f90093754c5ed1561bd885242330e3583004 | <15 min fix | """
Mathematica code printer
"""
from __future__ import print_function, division
from sympy.printing.codeprinter import CodePrinter
from sympy.printing.str import StrPrinter
from sympy.printing.precedence import precedence
# Used in MCodePrinter._print_Function(self)
known_functions = {
"exp": [(lambda x: True, "... | [
[
31,
38
],
[
102,
109
]
] | sympy/printing/mathematica.py | python:3.11 |
sympy/sympy | sympy__sympy-15809 | 28d913d3cead6c5646307ffa6540b21d65059dfd | diff --git a/sympy/functions/elementary/miscellaneous.py b/sympy/functions/elementary/miscellaneous.py
--- a/sympy/functions/elementary/miscellaneous.py
+++ b/sympy/functions/elementary/miscellaneous.py
@@ -339,8 +339,6 @@ def real_root(arg, n=None, evaluate=None):
class MinMaxBase(Expr, LatticeOp):
def __new__... | diff --git a/sympy/functions/elementary/tests/test_miscellaneous.py b/sympy/functions/elementary/tests/test_miscellaneous.py
--- a/sympy/functions/elementary/tests/test_miscellaneous.py
+++ b/sympy/functions/elementary/tests/test_miscellaneous.py
@@ -86,7 +86,8 @@ def test_Min():
assert Min(p, p_).func is Min
... | Zero-argument Min() and Max()
Right now `Min()` and `Max()` with no arguments raise `ValueError: The Max/Min functions must have arguments.`. It might be mathematically more convenient to have them return `oo` and `-oo`, respectively. See https://en.wikipedia.org/wiki/Empty_set#Extended_real_numbers for why these are v... | Okk I will fix this issue. | 2019-01-20T06:08:26Z | 1.4 | ["test_Min", "test_Max"] | ["test_minmax_assumptions", "test_issue_8413", "test_root", "test_real_root", "test_rewrite_MaxMin_as_Heaviside", "test_rewrite_MaxMin_as_Piecewise", "test_issue_11099", "test_issue_12638", "test_instantiation_evaluation", "test_rewrite_as_Abs"] | 73b3f90093754c5ed1561bd885242330e3583004 | <15 min fix | from __future__ import print_function, division
from sympy.core import S, sympify
from sympy.core.add import Add
from sympy.core.containers import Tuple
from sympy.core.operations import LatticeOp, ShortCircuit
from sympy.core.function import (Application, Lambda,
ArgumentIndexError)
from sympy.core.expr import Ex... | [
[
339,
344
]
] | sympy/functions/elementary/miscellaneous.py | python:3.11 |
sympy/sympy | sympy__sympy-15875 | b506169ad727ee39cb3d60c8b3ff5e315d443d8e | diff --git a/sympy/core/add.py b/sympy/core/add.py
--- a/sympy/core/add.py
+++ b/sympy/core/add.py
@@ -554,7 +554,7 @@ def _eval_is_zero(self):
return
if z == len(self.args):
return True
- if len(nz) == len(self.args):
+ if len(nz) == 0 or len(nz) == len(self.args):
... | 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
@@ -1986,10 +1986,15 @@ def test_Add_is_zero():
x, y = symbols('x y', zero=True)
assert (x + y).is_zero
+ # Issue 15873
+ e = -2*I + (1 + I)**2
+ assert... | is_zero is incorrect on complex integer
`is_zero` should return `None` if it cannot decide, but should never give the wrong answer. However:
```
>>> e = -2*I + (1 + I)**2
>>> e.is_zero
False
>>> simplify(e).is_zero
True
```
This is causing errors in determining the rank of a matrix. See issue #15872
Fixing... | I think the assumption handler was added in #10298
https://github.com/sympy/sympy/blob/b506169ad727ee39cb3d60c8b3ff5e315d443d8e/sympy/core/add.py#L532-L566
And it had returned none before 58e96d08c404375e813dafa7f974c529630f6957
Would this be a regression?
| 2019-01-29T03:18:51Z | 1.4 | ["test_Add_is_zero"] | ["test_bug1", "test_Symbol", "test_arit0", "test_div", "test_pow", "test_pow2", "test_pow3", "test_mod_pow", "test_pow_E", "test_pow_issue_3516", "test_pow_im", "test_real_mul", "test_ncmul", "test_ncpow", "test_powerbug", "test_Mul_doesnt_expand_exp", "test_Add_Mul_is_integer", "test_Add_Mul_is_finite", "test_Mul_is_e... | 73b3f90093754c5ed1561bd885242330e3583004 | <15 min fix | from __future__ import print_function, division
from collections import defaultdict
from functools import cmp_to_key
from .basic import Basic
from .compatibility import reduce, is_sequence, range
from .logic import _fuzzy_group, fuzzy_or, fuzzy_not
from .singleton import S
from .operations import AssocOp
from .cache ... | [
[
554,
560
]
] | sympy/core/add.py | python:3.11 |
sympy/sympy | sympy__sympy-16450 | aefdd023dc4f73c441953ed51f5f05a076f0862f | diff --git a/sympy/simplify/simplify.py b/sympy/simplify/simplify.py
--- a/sympy/simplify/simplify.py
+++ b/sympy/simplify/simplify.py
@@ -251,7 +251,7 @@ def posify(eq):
eq[i] = e.subs(reps)
return f(eq), {r: s for s, r in reps.items()}
- reps = {s: Dummy(s.name, positive=True)
+ reps = {... | 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
@@ -505,6 +505,13 @@ def test_posify():
assert str(Sum(posify(1/x**n)[0], (n,1,3)).expand()) == \
'Sum(_x**(-n), (n, 1, 3))'
... | Posify ignores is_finite assmptions
Posify removes a finite assumption from a symbol:
```julia
In [1]: x = Symbol('x', finite=True)
In [2]: x._assumptions ... | @oscarbenjamin since the functionality of `posify` is to only add a new assumption `positive=True` when `positive` is not defined, the other assumptions should be retained. | 2019-03-26T18:00:02Z | 1.5 | ["test_posify"] | ["test_issue_7263", "test_issue_3557", "test_simplify_other", "test_simplify_complex", "test_simplify_ratio", "test_simplify_measure", "test_simplify_rational", "test_simplify_issue_1308", "test_issue_5652", "test_simplify_fail1", "test_nthroot", "test_nthroot1", "test_separatevars", "test_separatevars_advanced_factor"... | 70381f282f2d9d039da860e391fe51649df2779d | <15 min fix | from __future__ import print_function, division
from collections import defaultdict
from sympy.core import (Basic, S, Add, Mul, Pow, Symbol, sympify, expand_mul,
expand_func, Function, Dummy, Expr, factor_terms,
expand_power_exp)
from sympy.core.compatibility import ite... | [
[
251,
257
]
] | sympy/simplify/simplify.py | python:3.11 |
sympy/sympy | sympy__sympy-16766 | b8fe457a02cc24b3470ff678d0099c350b7fef43 | diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py
--- a/sympy/printing/pycode.py
+++ b/sympy/printing/pycode.py
@@ -357,6 +357,11 @@ def _print_Not(self, expr):
PREC = precedence(expr)
return self._operators['not'] + self.parenthesize(expr.args[0], PREC)
+ def _print_Indexed(self, ... | diff --git a/sympy/printing/tests/test_pycode.py b/sympy/printing/tests/test_pycode.py
--- a/sympy/printing/tests/test_pycode.py
+++ b/sympy/printing/tests/test_pycode.py
@@ -12,9 +12,10 @@
MpmathPrinter, NumPyPrinter, PythonCodePrinter, pycode, SciPyPrinter
)
from sympy.utilities.pytest import raises
+from symp... | PythonCodePrinter doesn't support Indexed
I use `lambdify()` to generate some functions and save the code for further use. But the generated code for `Indexed` operation has some warnings which can be confirmed by following code;
```
from sympy import *
p = IndexedBase("p")
pycode(p[0])
```
the output is
... | 2019-05-01T22:02:17Z | 1.5 | ["test_PythonCodePrinter"] | ["test_MpmathPrinter", "test_NumPyPrinter", "test_SciPyPrinter", "test_pycode_reserved_words", "test_printmethod", "test_codegen_ast_nodes", "test_issue_14283"] | 70381f282f2d9d039da860e391fe51649df2779d | <15 min fix | """
Python code printers
This module contains python code printers for plain python as well as NumPy & SciPy enabled code.
"""
from collections import defaultdict
from itertools import chain
from sympy.core import S
from .precedence import precedence
from .codeprinter import CodePrinter
_kw_py2and3 = {
'and', '... | [
[
357,
367
]
] | sympy/printing/pycode.py | python:3.11 | |
sympy/sympy | sympy__sympy-16886 | c50643a49811e9fe2f4851adff4313ad46f7325e | diff --git a/sympy/crypto/crypto.py b/sympy/crypto/crypto.py
--- a/sympy/crypto/crypto.py
+++ b/sympy/crypto/crypto.py
@@ -1520,7 +1520,7 @@ def decipher_kid_rsa(msg, key):
"..-": "U", "...-": "V",
".--": "W", "-..-": "X",
"-.--": "Y", "--..": "Z",
- "-----": "0", "----": "1",
+ "-----": "0", ".---... | diff --git a/sympy/crypto/tests/test_crypto.py b/sympy/crypto/tests/test_crypto.py
--- a/sympy/crypto/tests/test_crypto.py
+++ b/sympy/crypto/tests/test_crypto.py
@@ -247,6 +247,8 @@ def test_encode_morse():
assert encode_morse(' ', sep='`') == '``'
assert encode_morse(' ', sep='``') == '````'
assert enc... | Morse encoding for "1" is not correct
The current Morse mapping in simpy.crypto.crypto contains an incorrect mapping of
`"----": "1"`
The correct mapping is `".----": "1"`.
| 2019-05-25T05:55:25Z | 1.5 | ["test_encode_morse"] | ["test_cycle_list", "test_encipher_shift", "test_encipher_rot13", "test_encipher_affine", "test_encipher_atbash", "test_encipher_substitution", "test_check_and_join", "test_encipher_vigenere", "test_decipher_vigenere", "test_encipher_hill", "test_decipher_hill", "test_encipher_bifid5", "test_bifid5_square", "test_decip... | 70381f282f2d9d039da860e391fe51649df2779d | <15 min fix | # -*- coding: utf-8 -*-
"""
This file contains some classical ciphers and routines
implementing a linear-feedback shift register (LFSR)
and the Diffie-Hellman key exchange.
.. warning::
This module is intended for educational purposes only. Do not use the
functions in this module for real cryptographic applica... | [
[
1520,
1526
]
] | sympy/crypto/crypto.py | python:3.11 | |
sympy/sympy | sympy__sympy-17139 | 1d3327b8e90a186df6972991963a5ae87053259d | diff --git a/sympy/simplify/fu.py b/sympy/simplify/fu.py
--- a/sympy/simplify/fu.py
+++ b/sympy/simplify/fu.py
@@ -500,6 +500,8 @@ def _f(rv):
# change is not going to allow a simplification as far as I can tell.
if not (rv.is_Pow and rv.base.func == f):
return rv
+ if not rv.exp.i... | diff --git a/sympy/simplify/tests/test_fu.py b/sympy/simplify/tests/test_fu.py
--- a/sympy/simplify/tests/test_fu.py
+++ b/sympy/simplify/tests/test_fu.py
@@ -76,6 +76,10 @@ def test__TR56():
assert T(sin(x)**6, sin, cos, h, 6, True) == sin(x)**6
assert T(sin(x)**8, sin, cos, h, 10, True) == (-cos(x)**2 + 1)*... | simplify(cos(x)**I): Invalid comparison of complex I (fu.py)
```
>>> from sympy import *
>>> x = Symbol('x')
>>> print(simplify(cos(x)**I))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/e/se/sympy/simplify/simplify.py", line 587, in simplify
expr = trigsimp(expr, deep... | 2019-07-01T19:17:18Z | 1.5 | ["test__TR56", "test_issue_17137"] | ["test_TR1", "test_TR2", "test_TR2i", "test_TR3", "test_TR5", "test_TR6", "test_TR7", "test_TR8", "test_TR9", "test_TR10", "test_TR10i", "test_TR11", "test_TR12", "test_TR13", "test_L", "test_fu", "test_objective", "test_process_common_addends", "test_trig_split", "test_TRmorrie", "test_TRpower", "test_hyper_as_trig", ... | 70381f282f2d9d039da860e391fe51649df2779d | <15 min fix | """
Implementation of the trigsimp algorithm by Fu et al.
The idea behind the ``fu`` algorithm is to use a sequence of rules, applied
in what is heuristically known to be a smart order, to select a simpler
expression that is equivalent to the input.
There are transform rules in which a single rule is applied to the
e... | [
[
500,
507
]
] | sympy/simplify/fu.py | python:3.11 | |
sympy/sympy | sympy__sympy-17655 | f5e965947af2410ded92cfad987aaf45262ea434 | diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py
--- a/sympy/geometry/point.py
+++ b/sympy/geometry/point.py
@@ -278,6 +278,10 @@ def __mul__(self, factor):
coords = [simplify(x*factor) for x in self.args]
return Point(coords, evaluate=False)
+ def __rmul__(self, factor):
+ "... | 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
@@ -26,7 +26,6 @@ def test_point():
assert p2.y == y2
assert (p3 + p4) == p4
assert (p2 - p1) == Point(y1 - x1, y2 - x2)
- assert p4*5 ... | Unexpected exception when multiplying geometry.Point and number
```python
from sympy import geometry as ge
import sympy
point1 = ge.Point(0,0)
point2 = ge.Point(1,1)
```
This line works fine
```python
point1 + point2 * sympy.sympify(2.0)
```
But when I write the same this way it raises an exception
```... | You can multiply a Point on the right by a scalar but not on the left. I think this would be a matter of defining `__rmul__` for Point. | 2019-09-25T17:04:26Z | 1.5 | ["test_point", "test_point3D"] | ["test_Point2D", "test_issue_9214", "test_issue_11617", "test_transform", "test_concyclic_doctest_bug", "test_arguments", "test_unit", "test_dot", "test__normalize_dimension"] | 70381f282f2d9d039da860e391fe51649df2779d | <15 min fix | """Geometrical Points.
Contains
========
Point
Point2D
Point3D
When methods of Point require 1 or more points as arguments, they
can be passed as a sequence of coordinates or Points:
>>> from sympy.geometry.point import Point
>>> Point(1, 1).is_collinear((2, 2), (3, 4))
False
>>> Point(1, 1).is_collinear(Point(2, 2)... | [
[
278,
287
]
] | sympy/geometry/point.py | python:3.11 |
sympy/sympy | sympy__sympy-18189 | 1923822ddf8265199dbd9ef9ce09641d3fd042b9 | diff --git a/sympy/solvers/diophantine.py b/sympy/solvers/diophantine.py
--- a/sympy/solvers/diophantine.py
+++ b/sympy/solvers/diophantine.py
@@ -182,7 +182,7 @@ def diophantine(eq, param=symbols("t", integer=True), syms=None,
if syms != var:
dict_sym_index = dict(zip(syms, range(len(syms... | diff --git a/sympy/solvers/tests/test_diophantine.py b/sympy/solvers/tests/test_diophantine.py
--- a/sympy/solvers/tests/test_diophantine.py
+++ b/sympy/solvers/tests/test_diophantine.py
@@ -547,6 +547,13 @@ def test_diophantine():
assert diophantine(x**2 + y**2 +3*x- 5, permute=True) == \
set([(-1, 1), (... | diophantine: incomplete results depending on syms order with permute=True
```
In [10]: diophantine(n**4 + m**4 - 2**4 - 3**4, syms=(m,n), permute=True)
Out[10]: {(-3, -2), (-3, 2), (-2, -3), (-2, 3), (2, -3), (2, 3), (3, -2), (3, 2)}
In [11]: diophantine(n**4 + m**4 - 2**4 - 3**4, syms=(n,m), permute=True)
Out[11... | ```diff
diff --git a/sympy/solvers/diophantine.py b/sympy/solvers/diophantine.py
index 6092e35..b43f5c1 100644
--- a/sympy/solvers/diophantine.py
+++ b/sympy/solvers/diophantine.py
@@ -182,7 +182,7 @@ def diophantine(eq, param=symbols("t", integer=True), syms=None,
if syms != var:
d... | 2019-12-31T15:45:24Z | 1.6 | ["test_diophantine"] | ["test_input_format", "test_univariate", "test_classify_diop", "test_linear", "test_quadratic_simple_hyperbolic_case", "test_quadratic_elliptical_case", "test_quadratic_parabolic_case", "test_quadratic_perfect_square", "test_quadratic_non_perfect_square", "test_issue_9106", "test_issue_18138", "test_DN", "test_bf_pell"... | 28b41c73c12b70d6ad9f6e45109a80649c4456da | <15 min fix | from __future__ import print_function, division
from sympy.core.add import Add
from sympy.core.compatibility import as_int, is_sequence, range
from sympy.core.exprtools import factor_terms
from sympy.core.function import _mexpand
from sympy.core.mul import Mul
from sympy.core.numbers import Rational
from sympy.core.nu... | [
[
182,
188
]
] | sympy/solvers/diophantine.py | python:3.11 |
sympy/sympy | sympy__sympy-18763 | 70381f282f2d9d039da860e391fe51649df2779d | diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -703,7 +703,7 @@ def _print_Subs(self, subs):
latex_new = (self._print(e) for e in new)
latex_subs = r'\\ '.join(
e[0] + '=' + e[1] for e in zip(latex_old, latex_n... | diff --git a/sympy/printing/tests/test_latex.py b/sympy/printing/tests/test_latex.py
--- a/sympy/printing/tests/test_latex.py
+++ b/sympy/printing/tests/test_latex.py
@@ -674,7 +674,8 @@ def test_latex_derivatives():
def test_latex_subs():
assert latex(Subs(x*y, (
- x, y), (1, 2))) == r'\left. x y \right... | Incorrect parenthesizing of Subs
Here is an example.
```python
>>> from sympy import Subs
>>> from sympy.abc import x,y
>>> 3*Subs(-x+y, (x,),(1,))
```
LaTeX printing of this gives:
```python
'3 \\left. - x + y \\right|_{\\substack{ x=1 }}'
```
:
>>> _.subs(y, 1)
ConditionSet(y, y < 1, FiniteSet(z))
- Notes
- =====
-
If no base set is specified, the universal set ... | diff --git a/sympy/sets/tests/test_conditionset.py b/sympy/sets/tests/test_conditionset.py
--- a/sympy/sets/tests/test_conditionset.py
+++ b/sympy/sets/tests/test_conditionset.py
@@ -1,7 +1,7 @@
from sympy.sets import (ConditionSet, Intersection, FiniteSet,
- EmptySet, Union, Contains)
-from sympy import (Symbol, E... | Strange/wrong? behaviour of subs with ConditionSet / ImageSet
I'm not sure what to think of the following:
```
In [71]: solveset_real(Abs(x) - y, x)
Out[71]: {x | x ∊ {-y, y} ∧ (y ∈ [0, ∞))}
In [72]: _.subs(y, Rational(1,3))
Out[72]: {-1/3, 1/3}
In [73]: imageset(Lambda(n, 2*n*pi + asin(y)), S.Integers)
Out... | 2020-06-05T11:53:09Z | 1.7 | ["test_subs_CondSet"] | ["test_CondSet", "test_CondSet_intersect", "test_issue_9849", "test_simplified_FiniteSet_in_CondSet", "test_free_symbols", "test_subs_CondSet_tebr", "test_dummy_eq", "test_contains"] | cffd4e0f86fefd4802349a9f9b19ed70934ea354 | <15 min fix | from __future__ import print_function, division
from sympy import S
from sympy.core.basic import Basic
from sympy.core.containers import Tuple
from sympy.core.expr import Expr
from sympy.core.function import Lambda
from sympy.core.logic import fuzzy_bool
from sympy.core.relational import Eq
from sympy.core.symbol impo... | [
[
80,
85
],
[
99,
105
],
[
110,
116
],
[
238,
251
]
] | sympy/sets/conditionset.py | python:3.11 | |
sympy/sympy | sympy__sympy-19637 | 63f8f465d48559fecb4e4bf3c48b75bf15a3e0ef | diff --git a/sympy/core/sympify.py b/sympy/core/sympify.py
--- a/sympy/core/sympify.py
+++ b/sympy/core/sympify.py
@@ -513,7 +513,9 @@ def kernS(s):
while kern in s:
kern += choice(string.ascii_letters + string.digits)
s = s.replace(' ', kern)
- hit = kern in s
+ ... | diff --git a/sympy/core/tests/test_sympify.py b/sympy/core/tests/test_sympify.py
--- a/sympy/core/tests/test_sympify.py
+++ b/sympy/core/tests/test_sympify.py
@@ -512,6 +512,7 @@ def test_kernS():
assert kernS('(1-2.*(1-y)*x)') == 1 - 2.*x*(1 - y)
one = kernS('x - (x - 1)')
assert one != 1 and one.expand... | kernS: 'kern' referenced before assignment
from sympy.core.sympify import kernS
text = "(2*x)/(x-1)"
expr = kernS(text)
// hit = kern in s
// UnboundLocalError: local variable 'kern' referenced before assignment
| 2020-06-24T13:08:57Z | 1.7 | ["test_kernS"] | ["test_issue_3538", "test_sympify1", "test_sympify_Fraction", "test_sympify_gmpy", "test_sympify_mpmath", "test_sympify2", "test_sympify3", "test_sympify_keywords", "test_sympify_float", "test_sympify_bool", "test_sympyify_iterables", "test_issue_16859", "test_sympify4", "test_sympify_text", "test_sympify_function", "t... | cffd4e0f86fefd4802349a9f9b19ed70934ea354 | <15 min fix | """sympify -- convert objects SymPy internal format"""
from typing import Dict, Type, Callable, Any
from inspect import getmro
from .compatibility import iterable
from .parameters import global_parameters
class SympifyError(ValueError):
def __init__(self, expr, base_exc=None):
self.expr = expr
... | [
[
513,
521
]
] | sympy/core/sympify.py | python:3.11 | |
sympy/sympy | sympy__sympy-19954 | 6f54459aa0248bf1467ad12ee6333d8bc924a642 | diff --git a/sympy/combinatorics/perm_groups.py b/sympy/combinatorics/perm_groups.py
--- a/sympy/combinatorics/perm_groups.py
+++ b/sympy/combinatorics/perm_groups.py
@@ -2194,18 +2194,19 @@ def _number_blocks(blocks):
# check if the system is minimal with
# respect to the already disc... | diff --git a/sympy/combinatorics/tests/test_perm_groups.py b/sympy/combinatorics/tests/test_perm_groups.py
--- a/sympy/combinatorics/tests/test_perm_groups.py
+++ b/sympy/combinatorics/tests/test_perm_groups.py
@@ -905,6 +905,14 @@ def test_sylow_subgroup():
assert G.order() % S.order() == 0
assert G.order()/... | sylow_subgroup() IndexError
I use sympy 1.6.1, with numpy 1.18.5, scipy 1.4.1, under Python '3.8.5 (default, Aug 5 2020, 09:44:06) [MSC v.1916 64 bit (AMD64)]'.
The code that I run as the following gives IndexError for sylow_subgroup():
from sympy.combinatorics import DihedralGroup, PermutationGroup, Permutati... | 2020-08-12T06:07:32Z | 1.7 | ["test_sylow_subgroup"] | ["test_has", "test_generate", "test_order", "test_equality", "test_stabilizer", "test_center", "test_centralizer", "test_coset_rank", "test_coset_factor", "test_orbits", "test_is_normal", "test_eq", "test_derived_subgroup", "test_is_solvable", "test_rubik1", "test_direct_product", "test_orbit_rep", "test_schreier_vecto... | cffd4e0f86fefd4802349a9f9b19ed70934ea354 | <15 min fix | from random import randrange, choice
from math import log
from sympy.ntheory import primefactors
from sympy import multiplicity, factorint, Symbol
from sympy.combinatorics import Permutation
from sympy.combinatorics.permutations import (_af_commutes_with, _af_invert,
_af_rmul, _af_rmuln, _af_pow, Cycle)
from sympy... | [
[
2194,
2212
]
] | sympy/combinatorics/perm_groups.py | python:3.11 | |
sympy/sympy | sympy__sympy-20916 | 82298df6a51491bfaad0c6d1980e7e3ca808ae93 | diff --git a/sympy/printing/conventions.py b/sympy/printing/conventions.py
--- a/sympy/printing/conventions.py
+++ b/sympy/printing/conventions.py
@@ -7,7 +7,7 @@
from collections.abc import Iterable
from sympy import Derivative
-_name_with_digits_p = re.compile(r'^([a-zA-Z]+)([0-9]+)$')
+_name_with_digits_p = re.c... | diff --git a/sympy/printing/tests/test_conventions.py b/sympy/printing/tests/test_conventions.py
--- a/sympy/printing/tests/test_conventions.py
+++ b/sympy/printing/tests/test_conventions.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
from sympy import symbols, Derivative, Integral, exp, cos, oo, Function
from sympy.f... | pprint unicode does not format subscripts on Greek letters
Good:
[ -t₀⋅w₀ -t₁⋅w₀ -t₂⋅w₀]
Bad:
[ -t₀⋅ω0 -t₁⋅ω0 -t₂⋅ω0]
| Could you provide the code which generates this?
```
import sympy as sp
w=[sp.Symbol(f'w{i}') for i in range(4)]
ω=[sp.Symbol(f'ω{i}') for i in range(4)]
sp.pprint(w) # -> [w₀, w₁, w₂, w₃]
sp.pprint(ω) # -> [ω0, ω1, ω2, ω3]
```
Not sure what the standard syntax is for defining variables with subscripts, but if ... | 2021-02-06T05:44:34Z | 1.8 | ["test_super_sub"] | ["test_requires_partial"] | 3ac1464b8840d5f8b618a654f9fbf09c452fe969 | <15 min fix | """
A few practical conventions common to all printers.
"""
import re
from collections.abc import Iterable
from sympy import Derivative
_name_with_digits_p = re.compile(r'^([a-zA-Z]+)([0-9]+)$')
def split_super_sub(text):
"""Split a symbol name into a name, superscripts and subscripts
The first part of th... | [
[
7,
13
],
[
60,
66
]
] | sympy/printing/conventions.py | python:3.11 |
sympy/sympy | sympy__sympy-21847 | d9b18c518d64d0ebe8e35a98c2fb519938b9b151 | diff --git a/sympy/polys/monomials.py b/sympy/polys/monomials.py
--- a/sympy/polys/monomials.py
+++ b/sympy/polys/monomials.py
@@ -127,7 +127,7 @@ def itermonomials(variables, max_degrees, min_degrees=None):
for variable in item:
if variable != 1:
powers[va... | diff --git a/sympy/polys/tests/test_monomials.py b/sympy/polys/tests/test_monomials.py
--- a/sympy/polys/tests/test_monomials.py
+++ b/sympy/polys/tests/test_monomials.py
@@ -15,7 +15,6 @@
from sympy.core import S, symbols
from sympy.testing.pytest import raises
-
def test_monomials():
# total_degree tests
... | itermonomials returns incorrect monomials when using min_degrees argument
`itermonomials` returns incorrect monomials when using optional `min_degrees` argument
For example, the following code introduces three symbolic variables and generates monomials with max and min degree of 3:
```
import sympy as sp
from... | Doesn't look like the `min_degrees` argument is actually used anywhere in the codebase. Also there don't seem to be any nontrivial tests for passing `min_degrees` as an integer.
The issue would be fixed with this diff and some tests in `test_monomials.py`:
```diff
diff --git a/sympy/polys/monomials.py b/sympy/poly... | 2021-08-10T17:41:59Z | 1.9 | ["test_monomials"] | ["test_monomial_count", "test_monomial_mul", "test_monomial_div", "test_monomial_gcd", "test_monomial_lcm", "test_monomial_max", "test_monomial_pow", "test_monomial_min", "test_monomial_divides"] | f9a6f50ec0c74d935c50a6e9c9b2cb0469570d91 | <15 min fix | """Tools and arithmetics for monomials of distributed polynomials. """
from itertools import combinations_with_replacement, product
from textwrap import dedent
from sympy.core import Mul, S, Tuple, sympify
from sympy.core.compatibility import iterable
from sympy.polys.polyerrors import ExactQuotientFailed
from sympy... | [
[
127,
133
],
[
139,
145
]
] | sympy/polys/monomials.py | python:3.11 |
sympy/sympy | sympy__sympy-22714 | 3ff4717b6aef6086e78f01cdfa06f64ae23aed7e | diff --git a/sympy/geometry/point.py b/sympy/geometry/point.py
--- a/sympy/geometry/point.py
+++ b/sympy/geometry/point.py
@@ -152,7 +152,7 @@ def __new__(cls, *args, **kwargs):
'warn' or 'ignore'.'''))
if any(coords[dim:]):
raise ValueError('Nonzero coordinates cannot be ... | 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
@@ -1,5 +1,6 @@
from sympy.core.basic import Basic
from sympy.core.numbers import (I, Rational, pi)
+from sympy.core.parameters import evaluate
from s... | simpify gives `Imaginary coordinates are not permitted.` with evaluate(False)
## Issue
`with evaluate(False)` crashes unexpectedly with `Point2D`
## Code
```python
import sympy as sp
with sp.evaluate(False):
sp.S('Point2D(Integer(1),Integer(2))')
```
## Error
```
Traceback (most recent call last):
Fi... | 2021-12-19T18:54:36Z | 1.10 | ["test_issue_22684"] | ["test_point", "test_point3D", "test_Point2D", "test_issue_9214", "test_issue_11617", "test_transform", "test_concyclic_doctest_bug", "test_arguments", "test_unit", "test_dot", "test__normalize_dimension"] | fd40404e72921b9e52a5f9582246e4a6cd96c431 | <15 min fix | """Geometrical Points.
Contains
========
Point
Point2D
Point3D
When methods of Point require 1 or more points as arguments, they
can be passed as a sequence of coordinates or Points:
>>> from sympy.geometry.point import Point
>>> Point(1, 1).is_collinear((2, 2), (3, 4))
False
>>> Point(1, 1).is_collinear(Point(2, 2)... | [
[
152,
158
]
] | sympy/geometry/point.py | python:3.11 | |
sympy/sympy | sympy__sympy-23534 | 832c24fec1046eaa544a4cab4c69e3af3e651759 | diff --git a/sympy/core/symbol.py b/sympy/core/symbol.py
--- a/sympy/core/symbol.py
+++ b/sympy/core/symbol.py
@@ -791,7 +791,7 @@ def literal(s):
return tuple(result)
else:
for name in names:
- result.append(symbols(name, **args))
+ result.append(symbols(name, cls=cls, **ar... | diff --git a/sympy/core/tests/test_symbol.py b/sympy/core/tests/test_symbol.py
--- a/sympy/core/tests/test_symbol.py
+++ b/sympy/core/tests/test_symbol.py
@@ -1,3 +1,4 @@
+from sympy.core.function import Function, UndefinedFunction
from sympy.core.numbers import (I, Rational, pi)
from sympy.core.relational import (Gr... | Using symbols to create functions doesn't work if there is an extra layer of parentheses
Sympy version == 1.10.1
Using `symbols` to create symbol-like objects like instances of `Function` as shown in the [documentation](https://docs.sympy.org/latest/modules/core.html?highlight=symbols#symbols) creates objects of cla... | 2022-05-22T00:12:33Z | 1.11 | ["test_symbols"] | ["test_Str", "test_Symbol", "test_Dummy", "test_Dummy_force_dummy_index", "test_lt_gt", "test_no_len", "test_ineq_unequal", "test_Wild_properties", "test_symbols_become_functions_issue_3539", "test_unicode", "test_uniquely_named_symbol_and_Symbol"] | 9a6104eab0ea7ac191a09c24f3e2d79dcd66bda5 | <15 min fix | from __future__ import annotations
from .assumptions import StdFactKB, _assume_defined
from .basic import Basic, Atom
from .cache import cacheit
from .containers import Tuple
from .expr import Expr, AtomicExpr
from .function import AppliedUndef, FunctionClass
from .kind import NumberKind, UndefinedKind
from .logic imp... | [
[
791,
797
]
] | sympy/core/symbol.py | python:3.11 | |
sympy/sympy | sympy__sympy-24539 | 193e3825645d93c73e31cdceb6d742cc6919624d | diff --git a/sympy/polys/rings.py b/sympy/polys/rings.py
--- a/sympy/polys/rings.py
+++ b/sympy/polys/rings.py
@@ -616,10 +616,13 @@ def set_ring(self, new_ring):
return new_ring.from_dict(self, self.ring.domain)
def as_expr(self, *symbols):
- if symbols and len(symbols) != self.ring.ngens:
-... | diff --git a/sympy/polys/tests/test_rings.py b/sympy/polys/tests/test_rings.py
--- a/sympy/polys/tests/test_rings.py
+++ b/sympy/polys/tests/test_rings.py
@@ -259,11 +259,11 @@ def test_PolyElement_as_expr():
assert f != g
assert f.as_expr() == g
- X, Y, Z = symbols("x,y,z")
- g = 3*X**2*Y - X*Y*Z + 7... | `PolyElement.as_expr()` not accepting symbols
The method `PolyElement.as_expr()`
https://github.com/sympy/sympy/blob/193e3825645d93c73e31cdceb6d742cc6919624d/sympy/polys/rings.py#L618-L624
is supposed to let you set the symbols you want to use, but, as it stands, either you pass the wrong number of symbols, and g... | 2023-01-17T17:26:42Z | 1.12 | ["test_PolyElement_as_expr"] | ["test_PolyRing___init__", "test_PolyRing___hash__", "test_PolyRing___eq__", "test_PolyRing_ring_new", "test_PolyRing_drop", "test_PolyRing___getitem__", "test_PolyRing_is_", "test_PolyRing_add", "test_PolyRing_mul", "test_sring", "test_PolyElement___hash__", "test_PolyElement___eq__", "test_PolyElement__lt_le_gt_ge__"... | c6cb7c5602fa48034ab1bd43c2347a7e8488f12e | <15 min fix | """Sparse polynomial rings. """
from __future__ import annotations
from typing import Any
from operator import add, mul, lt, le, gt, ge
from functools import reduce
from types import GeneratorType
from sympy.core.expr import Expr
from sympy.core.numbers import igcd, oo
from sympy.core.symbol import Symbol, symbols a... | [
[
616,
628
]
] | sympy/polys/rings.py | python:3.11 | |
sympy/sympy | sympy__sympy-24562 | b1cb676cf92dd1a48365b731979833375b188bf2 | diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py
--- a/sympy/core/numbers.py
+++ b/sympy/core/numbers.py
@@ -1624,10 +1624,11 @@ def __new__(cls, p, q=None, gcd=None):
q = 1
gcd = 1
+ Q = 1
if not isinstance(p, SYMPY_INTS):
p = Rational(p)
- ... | diff --git a/sympy/core/tests/test_numbers.py b/sympy/core/tests/test_numbers.py
--- a/sympy/core/tests/test_numbers.py
+++ b/sympy/core/tests/test_numbers.py
@@ -366,6 +366,13 @@ def test_Rational_new():
assert n.q == 4
assert n.p == -2
+def test_issue_24543():
+ for p in ('1.5', 1.5, 2):
+ for q... | Rational calc value error
python 3.11, sympy 1.11.1
when calc Rational('0.5', '100'), the value is 1/100100; but Rational(0.5, 100) the value is 1/200, this value is the true value, and the version of sympy 1.8 is normal
| This should probably raise an error. The expected way to do this is:
```python
In [1]: Rational('0.5/100')
Out[1]: 1/200
In [2]: Rational('0.5') / Rational('100')
Out[2]: 1/200
```
Actually, this should be a flaw in the logic because string is multiplied somewhere in
https://github.com/sympy/sympy/blob/68803e... | 2023-01-21T12:06:36Z | 1.12 | ["test_issue_24543"] | ["test_seterr", "test_mod", "test_divmod", "test_igcd", "test_igcd_lehmer", "test_igcd2", "test_ilcm", "test_igcdex", "test_Integer_new", "test_Rational_new", "test_Number_new", "test_Number_cmp", "test_Rational_cmp", "test_Float", "test_zero_not_false", "test_float_mpf", "test_Float_RealElement", "test_Float_default_t... | c6cb7c5602fa48034ab1bd43c2347a7e8488f12e | <15 min fix | from __future__ import annotations
import numbers
import decimal
import fractions
import math
import re as regex
import sys
from functools import lru_cache
from .containers import Tuple
from .sympify import (SympifyError, _sympy_converter, sympify, _convert_numpy_types,
_sympify, _is_numpy_instance)
fro... | [
[
1624,
1634
],
[
1636,
1645
]
] | sympy/core/numbers.py | python:3.11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.