after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def array2string(
a,
max_line_width=None,
precision=None,
suppress_small=None,
separator=" ",
prefix="",
style=np._NoValue,
formatter=None,
threshold=None,
edgeitems=None,
sign=None,
floatmode=None,
suffix="",
**kwarg,
):
"""
Return a string representation... | def array2string(
a,
max_line_width=None,
precision=None,
suppress_small=None,
separator=" ",
prefix="",
style=np._NoValue,
formatter=None,
threshold=None,
edgeitems=None,
sign=None,
floatmode=None,
suffix="",
**kwarg,
):
"""
Return a string representation... | https://github.com/numpy/numpy/issues/10934 | import numpy as np
np.__version__
'1.14.2'
np.array2string(np.array(1.0))
'1.'
np.set_printoptions(legacy='1.13')
np.array2string(np.array(1.0))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/numpy/core/arrayprint.py", line 616, in array2string
return style(a.item())
TypeError: objec... | TypeError |
def array2string(
a,
max_line_width=None,
precision=None,
suppress_small=None,
separator=" ",
prefix="",
style=np._NoValue,
formatter=None,
threshold=None,
edgeitems=None,
sign=None,
floatmode=None,
suffix="",
**kwarg,
):
"""
Return a string representation... | def array2string(
a,
max_line_width=None,
precision=None,
suppress_small=None,
separator=" ",
prefix="",
style=np._NoValue,
formatter=None,
threshold=None,
edgeitems=None,
sign=None,
floatmode=None,
suffix="",
**kwarg,
):
"""
Return a string representation... | https://github.com/numpy/numpy/issues/10934 | import numpy as np
np.__version__
'1.14.2'
np.array2string(np.array(1.0))
'1.'
np.set_printoptions(legacy='1.13')
np.array2string(np.array(1.0))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[...]/numpy/core/arrayprint.py", line 616, in array2string
return style(a.item())
TypeError: objec... | TypeError |
def _get_format_function(data, **options):
"""
find the right formatting function for the dtype_
"""
dtype_ = data.dtype
dtypeobj = dtype_.type
formatdict = _get_formatdict(data, **options)
if issubclass(dtypeobj, _nt.bool_):
return formatdict["bool"]()
elif issubclass(dtypeobj, ... | def _get_format_function(data, **options):
"""
find the right formatting function for the dtype_
"""
dtype_ = data.dtype
if dtype_.fields is not None:
return StructureFormat.from_data(data, **options)
dtypeobj = dtype_.type
formatdict = _get_formatdict(data, **options)
if issubc... | https://github.com/numpy/numpy/issues/9821 | import numpy as np
x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))
x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in a... | TypeError |
def __init__(self, *args, **kwargs):
# NumPy 1.14, 2018-02-14
warnings.warn(
"StructureFormat has been replaced by StructuredVoidFormat",
DeprecationWarning,
stacklevel=2,
)
super(StructureFormat, self).__init__(*args, **kwargs)
| def __init__(self, format_functions):
self.format_functions = format_functions
| https://github.com/numpy/numpy/issues/9821 | import numpy as np
x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))
x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in a... | TypeError |
def _void_scalar_repr(x):
"""
Implements the repr for structured-void scalars. It is called from the
scalartypes.c.src code, and is placed here because it uses the elementwise
formatters defined above.
"""
return StructuredVoidFormat.from_data(array(x), **_format_options)(x)
| def _void_scalar_repr(x):
"""
Implements the repr for structured-void scalars. It is called from the
scalartypes.c.src code, and is placed here because it uses the elementwise
formatters defined above.
"""
return StructureFormat.from_data(array(x), **_format_options)(x)
| https://github.com/numpy/numpy/issues/9821 | import numpy as np
x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))
x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in a... | TypeError |
def from_data(cls, data, **options):
"""
This is a second way to initialize StructuredVoidFormat, using the raw data
as input. Added to avoid changing the signature of __init__.
"""
format_functions = []
for field_name in data.dtype.names:
format_function = _get_format_function(data[fiel... | def from_data(cls, data, **options):
"""
This is a second way to initialize StructureFormat, using the raw data
as input. Added to avoid changing the signature of __init__.
"""
format_functions = []
for field_name in data.dtype.names:
format_function = _get_format_function(data[field_nam... | https://github.com/numpy/numpy/issues/9821 | import numpy as np
x = np.zeros(3, dtype=('i4',[('r','u1'), ('g','u1'), ('b','u1'), ('a','u1')]))
x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/tos/py3npy/lib/python3.6/site-packages/numpy-1.14.0.dev0+1f4ed32-py3.6-macosx-10.12-x86_64.egg/numpy/core/arrayprint.py", line 955, in a... | TypeError |
def _get_bin_edges(a, bins, range, weights):
"""
Computes the bins used internally by `histogram`.
Parameters
==========
a : ndarray
Ravelled data array
bins, range
Forwarded arguments from `histogram`.
weights : ndarray, optional
Ravelled weights array, or None
... | def _get_bin_edges(a, bins, range, weights):
"""
Computes the bins used internally by `histogram`.
Parameters
==========
a : ndarray
Ravelled data array
bins, range
Forwarded arguments from `histogram`.
weights : ndarray, optional
Ravelled weights array, or None
... | https://github.com/numpy/numpy/issues/8123 | In [142]: print(sys.version)
3.5.0 (default, Nov 20 2015, 16:20:41)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
In [143]: print(numpy.__version__)
1.11.2
In [155]: histogram(array([-24.35791367], dtype=float32), range=(-24.3579135, 0))
---------------------------------------------------------------------------
ValueError... | ValueError |
def histogram(a, bins=10, range=None, normed=False, weights=None, density=None):
r"""
Compute the histogram of a set of data.
Parameters
----------
a : array_like
Input data. The histogram is computed over the flattened array.
bins : int or sequence of scalars or str, optional
I... | def histogram(a, bins=10, range=None, normed=False, weights=None, density=None):
r"""
Compute the histogram of a set of data.
Parameters
----------
a : array_like
Input data. The histogram is computed over the flattened array.
bins : int or sequence of scalars or str, optional
I... | https://github.com/numpy/numpy/issues/8123 | In [142]: print(sys.version)
3.5.0 (default, Nov 20 2015, 16:20:41)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
In [143]: print(numpy.__version__)
1.11.2
In [155]: histogram(array([-24.35791367], dtype=float32), range=(-24.3579135, 0))
---------------------------------------------------------------------------
ValueError... | ValueError |
def generate_config_py(target):
"""Generate config.py file containing system_info information
used during building the package.
Usage:
config['py_modules'].append((packagename, '__config__',generate_config_py))
"""
from numpy.distutils.system_info import system_info
from distutils.dir_u... | def generate_config_py(target):
"""Generate config.py file containing system_info information
used during building the package.
Usage:
config['py_modules'].append((packagename, '__config__',generate_config_py))
"""
from numpy.distutils.system_info import system_info
from distutils.dir_u... | https://github.com/numpy/numpy/issues/10338 | Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/... | KeyError |
def __new__(cls):
if cls.__singleton is None:
# We define the masked singleton as a float for higher precedence.
# Note that it can be tricky sometimes w/ type comparison
data = np.array(0.0)
mask = np.array(True)
# prevent any modifications
data.flags.writeable = Fa... | def __new__(self):
return self._data.view(self)
| https://github.com/numpy/numpy/issues/4595 | np.ma.masked.fill_value
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "numpy/ma/core.py", line 3353, in get_fill_value
if self._fill_value is None:
AttributeError: 'MaskedConstant' object has no attribute '_fill_value' | AttributeError |
def __array_finalize__(self, obj):
if self.__singleton is None:
# this handles the `.view` in __new__, which we want to copy across
# properties normally
return super(MaskedConstant, self).__array_finalize__(obj)
elif self is self.__singleton:
# not clear how this can happen, pla... | def __array_finalize__(self, obj):
return
| https://github.com/numpy/numpy/issues/4595 | np.ma.masked.fill_value
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "numpy/ma/core.py", line 3353, in get_fill_value
if self._fill_value is None:
AttributeError: 'MaskedConstant' object has no attribute '_fill_value' | AttributeError |
def __repr__(self):
if self is self.__singleton:
return "masked"
else:
# it's a subclass, or something is wrong, make it obvious
return object.__repr__(self)
| def __repr__(self):
return "masked"
| https://github.com/numpy/numpy/issues/4595 | np.ma.masked.fill_value
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "numpy/ma/core.py", line 3353, in get_fill_value
if self._fill_value is None:
AttributeError: 'MaskedConstant' object has no attribute '_fill_value' | AttributeError |
def svd(a, full_matrices=True, compute_uv=True):
"""
Singular Value Decomposition.
Factors the matrix `a` as ``u * np.diag(s) * v``, where `u` and `v`
are unitary and `s` is a 1-d array of `a`'s singular values.
Parameters
----------
a : (..., M, N) array_like
A real or complex mat... | def svd(a, full_matrices=1, compute_uv=1):
"""
Singular Value Decomposition.
Factors the matrix `a` as ``u * np.diag(s) * v``, where `u` and `v`
are unitary and `s` is a 1-d array of `a`'s singular values.
Parameters
----------
a : (..., M, N) array_like
A real or complex matrix of... | https://github.com/numpy/numpy/issues/8826 | a = np.stack((np.eye(3),)*4, axis=0)
ai = np.linalg.inv(a)
assert (a == ai).all()
api = np.linalg.pinv(a)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
np.linalg.pinv(a)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\linalg\linalg.py", line 1668, in pinv
if s[i] > cutoff:
ValueEr... | ValueError |
def matrix_rank(M, tol=None):
"""
Return matrix rank of array using SVD method
Rank of the array is the number of SVD singular values of the array that are
greater than `tol`.
.. versionchanged:: 1.14
Can now operate on stacks of matrices
Parameters
----------
M : {(M,), (..., ... | def matrix_rank(M, tol=None):
"""
Return matrix rank of array using SVD method
Rank of the array is the number of SVD singular values of the array that are
greater than `tol`.
Parameters
----------
M : {(M,), (..., M, N)} array_like
input vector or stack of matrices
tol : {None... | https://github.com/numpy/numpy/issues/8826 | a = np.stack((np.eye(3),)*4, axis=0)
ai = np.linalg.inv(a)
assert (a == ai).all()
api = np.linalg.pinv(a)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
np.linalg.pinv(a)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\linalg\linalg.py", line 1668, in pinv
if s[i] > cutoff:
ValueEr... | ValueError |
def pinv(a, rcond=1e-15):
"""
Compute the (Moore-Penrose) pseudo-inverse of a matrix.
Calculate the generalized inverse of a matrix using its
singular-value decomposition (SVD) and including all
*large* singular values.
.. versionchanged:: 1.14
Can now operate on stacks of matrices
... | def pinv(a, rcond=1e-15):
"""
Compute the (Moore-Penrose) pseudo-inverse of a matrix.
Calculate the generalized inverse of a matrix using its
singular-value decomposition (SVD) and including all
*large* singular values.
Parameters
----------
a : (M, N) array_like
Matrix to be pse... | https://github.com/numpy/numpy/issues/8826 | a = np.stack((np.eye(3),)*4, axis=0)
ai = np.linalg.inv(a)
assert (a == ai).all()
api = np.linalg.pinv(a)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
np.linalg.pinv(a)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\linalg\linalg.py", line 1668, in pinv
if s[i] > cutoff:
ValueEr... | ValueError |
def lstsq(a, b, rcond="warn"):
"""
Return the least-squares solution to a linear matrix equation.
Solves the equation `a x = b` by computing a vector `x` that
minimizes the Euclidean 2-norm `|| b - a x ||^2`. The equation may
be under-, well-, or over- determined (i.e., the number of
linearly ... | def lstsq(a, b, rcond="warn"):
"""
Return the least-squares solution to a linear matrix equation.
Solves the equation `a x = b` by computing a vector `x` that
minimizes the Euclidean 2-norm `|| b - a x ||^2`. The equation may
be under-, well-, or over- determined (i.e., the number of
linearly ... | https://github.com/numpy/numpy/issues/8826 | a = np.stack((np.eye(3),)*4, axis=0)
ai = np.linalg.inv(a)
assert (a == ai).all()
api = np.linalg.pinv(a)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
np.linalg.pinv(a)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\linalg\linalg.py", line 1668, in pinv
if s[i] > cutoff:
ValueEr... | ValueError |
def pinv(a, rcond=1e-15):
"""
Compute the (Moore-Penrose) pseudo-inverse of a matrix.
Calculate the generalized inverse of a matrix using its
singular-value decomposition (SVD) and including all
*large* singular values.
.. versionchanged:: 1.14
Can now operate on stacks of matrices
... | def pinv(a, rcond=1e-15):
"""
Compute the (Moore-Penrose) pseudo-inverse of a matrix.
Calculate the generalized inverse of a matrix using its
singular-value decomposition (SVD) and including all
*large* singular values.
Parameters
----------
a : (M, N) array_like
Matrix to be pse... | https://github.com/numpy/numpy/issues/8826 | a = np.stack((np.eye(3),)*4, axis=0)
ai = np.linalg.inv(a)
assert (a == ai).all()
api = np.linalg.pinv(a)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
np.linalg.pinv(a)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\linalg\linalg.py", line 1668, in pinv
if s[i] > cutoff:
ValueEr... | ValueError |
def make_mask(m, copy=False, shrink=True, dtype=MaskType):
"""
Create a boolean mask from an array.
Return `m` as a boolean mask, creating a copy if necessary or requested.
The function can accept any sequence that is convertible to integers,
or ``nomask``. Does not require that contents must be 0... | def make_mask(m, copy=False, shrink=True, dtype=MaskType):
"""
Create a boolean mask from an array.
Return `m` as a boolean mask, creating a copy if necessary or requested.
The function can accept any sequence that is convertible to integers,
or ``nomask``. Does not require that contents must be 0... | https://github.com/numpy/numpy/issues/2346 | class TestAppendFieldsObj(TestCase):
"""
Test append_fields with arrays containing objects
"""
def setUp(self):
from datetime import date
self.data = dict(obj=date(2000, 1, 1))
def test_append_to_objects(self):
"Test append_fields when the base array contains objects"
obj = self.data['obj']
x = np.array([(obj, 1.), (o... | TypeError |
def matrix_power(M, n):
"""
Raise a square matrix to the (integer) power `n`.
For positive integers `n`, the power is computed by repeated matrix
squarings and matrix multiplications. If ``n == 0``, the identity matrix
of the same shape as M is returned. If ``n < 0``, the inverse
is computed an... | def matrix_power(M, n):
"""
Raise a square matrix to the (integer) power `n`.
For positive integers `n`, the power is computed by repeated matrix
squarings and matrix multiplications. If ``n == 0``, the identity matrix
of the same shape as M is returned. If ``n < 0``, the inverse
is computed an... | https://github.com/numpy/numpy/issues/9506 | np.matrix(np.eye(3)) ** np.uint8(1)
Traceback (most recent call last):
File "<pyshell#53>", line 1, in <module>
np.matrix(np.eye(3)) ** np.uint8(1)
File "C:\Users\wiese\AppData\Roaming\Python\Python35\site-packages\numpy\matrixlib\defmatrix.py", line 356, in __pow__
return matrix_power(self, other)
File "C:\Users\wiese... | TypeError |
def default_fill_value(obj):
"""
Return the default fill value for the argument object.
The default filling value depends on the datatype of the input
array or the type of the input scalar:
======== ========
datatype default
======== ========
bool True
int ... | def default_fill_value(obj):
"""
Return the default fill value for the argument object.
The default filling value depends on the datatype of the input
array or the type of the input scalar:
======== ========
datatype default
======== ========
bool True
int ... | https://github.com/numpy/numpy/issues/8069 | In [32]: A = np.arange(100, dtype='i8').view("(4)i4,(4)i4")
In [33]: Am = np.ma.MaskedArray(A, np.zeros_like(A))
In [34]: Am.sort()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-34-9b8a457bb910> in... | TypeError |
def minimum_fill_value(obj):
"""
Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the minimum of an array with a given dtype.
Parameters
----------
obj : ndarray, dtype or scalar
An ... | def minimum_fill_value(obj):
"""
Return the maximum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the minimum of an array with a given dtype.
Parameters
----------
obj : ndarray or dtype
An object t... | https://github.com/numpy/numpy/issues/8069 | In [32]: A = np.arange(100, dtype='i8').view("(4)i4,(4)i4")
In [33]: Am = np.ma.MaskedArray(A, np.zeros_like(A))
In [34]: Am.sort()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-34-9b8a457bb910> in... | TypeError |
def maximum_fill_value(obj):
"""
Return the minimum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the maximum of an array with a given dtype.
Parameters
----------
obj : ndarray, dtype or scalar
An ... | def maximum_fill_value(obj):
"""
Return the minimum value that can be represented by the dtype of an object.
This function is useful for calculating a fill value suitable for
taking the maximum of an array with a given dtype.
Parameters
----------
obj : {ndarray, dtype}
An object t... | https://github.com/numpy/numpy/issues/8069 | In [32]: A = np.arange(100, dtype='i8').view("(4)i4,(4)i4")
In [33]: Am = np.ma.MaskedArray(A, np.zeros_like(A))
In [34]: Am.sort()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-34-9b8a457bb910> in... | TypeError |
def _check_fill_value(fill_value, ndtype):
"""
Private function validating the given `fill_value` for the given dtype.
If fill_value is None, it is set to the default corresponding to the dtype.
If fill_value is not None, its value is forced to the given dtype.
The result is always a 0d array.
... | def _check_fill_value(fill_value, ndtype):
"""
Private function validating the given `fill_value` for the given dtype.
If fill_value is None, it is set to the default corresponding to the dtype
if this latter is standard (no fields). If the datatype is flexible (named
fields), fill_value is set to ... | https://github.com/numpy/numpy/issues/8069 | In [32]: A = np.arange(100, dtype='i8').view("(4)i4,(4)i4")
In [33]: Am = np.ma.MaskedArray(A, np.zeros_like(A))
In [34]: Am.sort()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-34-9b8a457bb910> in... | TypeError |
def __init__(self, axis=0, matrix=False, ndmin=1, trans1d=-1):
self.axis = axis
self.matrix = matrix
self.trans1d = trans1d
self.ndmin = ndmin
| def __init__(self, axis=0, matrix=False, ndmin=1, trans1d=-1):
self._axis = axis
self._matrix = matrix
self.axis = axis
self.matrix = matrix
self.col = 0
self.trans1d = trans1d
self.ndmin = ndmin
| https://github.com/numpy/numpy/issues/8815 | Traceback (most recent call last):
File "test.py", line 13, in <module>
print(numpy.r_[a, b.reshape((3, 3, 1))])
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/index_tricks.py", line 338, in __getitem__
res = _nx.concatenate(tuple(objs), axis=self.axis)
ValueError: all the input array dimensions except for the ... | ValueError |
def __getitem__(self, key):
# handle matrix builder syntax
if isinstance(key, str):
frame = sys._getframe().f_back
mymat = matrixlib.bmat(key, frame.f_globals, frame.f_locals)
return mymat
if not isinstance(key, tuple):
key = (key,)
# copy attributes, since they can be ... | def __getitem__(self, key):
trans1d = self.trans1d
ndmin = self.ndmin
if isinstance(key, str):
frame = sys._getframe().f_back
mymat = matrix.bmat(key, frame.f_globals, frame.f_locals)
return mymat
if not isinstance(key, tuple):
key = (key,)
objs = []
scalars = []
... | https://github.com/numpy/numpy/issues/8815 | Traceback (most recent call last):
File "test.py", line 13, in <module>
print(numpy.r_[a, b.reshape((3, 3, 1))])
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/index_tricks.py", line 338, in __getitem__
res = _nx.concatenate(tuple(objs), axis=self.axis)
ValueError: all the input array dimensions except for the ... | ValueError |
def __getitem__(self, key):
# matrix builder syntax, like 'a, b; c, d'
if isinstance(key, str):
raise MAError("Unavailable for masked array.")
return super(MAxisConcatenator, self).__getitem__(key)
| def __getitem__(self, key):
if isinstance(key, str):
raise MAError("Unavailable for masked array.")
if not isinstance(key, tuple):
key = (key,)
objs = []
scalars = []
final_dtypedescr = None
for k in range(len(key)):
scalar = False
if isinstance(key[k], slice):
... | https://github.com/numpy/numpy/issues/8815 | Traceback (most recent call last):
File "test.py", line 13, in <module>
print(numpy.r_[a, b.reshape((3, 3, 1))])
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/index_tricks.py", line 338, in __getitem__
res = _nx.concatenate(tuple(objs), axis=self.axis)
ValueError: all the input array dimensions except for the ... | ValueError |
def __getitem__(self, key):
# handle matrix builder syntax
if isinstance(key, str):
frame = sys._getframe().f_back
mymat = matrixlib.bmat(key, frame.f_globals, frame.f_locals)
return mymat
if not isinstance(key, tuple):
key = (key,)
# copy attributes, since they can be ... | def __getitem__(self, key):
trans1d = self.trans1d
ndmin = self.ndmin
if isinstance(key, str):
frame = sys._getframe().f_back
mymat = matrix.bmat(key, frame.f_globals, frame.f_locals)
return mymat
if not isinstance(key, tuple):
key = (key,)
objs = []
scalars = []
... | https://github.com/numpy/numpy/issues/8815 | Traceback (most recent call last):
File "test.py", line 13, in <module>
print(numpy.r_[a, b.reshape((3, 3, 1))])
File "/usr/local/lib/python2.7/dist-packages/numpy/lib/index_tricks.py", line 338, in __getitem__
res = _nx.concatenate(tuple(objs), axis=self.axis)
ValueError: all the input array dimensions except for the ... | ValueError |
def __getitem__(self, indx):
"""
x.__getitem__(y) <==> x[y]
Return the item described by i, as a masked array.
"""
dout = self.data[indx]
# We could directly use ndarray.__getitem__ on self.
# But then we would have to modify __array_finalize__ to prevent the
# mask of being reshaped i... | def __getitem__(self, indx):
"""
x.__getitem__(y) <==> x[y]
Return the item described by i, as a masked array.
"""
dout = self.data[indx]
# We could directly use ndarray.__getitem__ on self.
# But then we would have to modify __array_finalize__ to prevent the
# mask of being reshaped i... | https://github.com/numpy/numpy/issues/6723 | In [332]: A = ma.masked_array(data=[([0,1,2],), ([3,4,5],)], mask=[([True, False, False],), ([False, True, False],)], dtype=[("A", ">i2", (3,))])
In [339]: A["A"][:, 0].filled()
---------------------------------------------------------------------------
ValueError Traceback (most recent ... | ValueError |
def where(condition, x=_NoValue, y=_NoValue):
"""
Return a masked array with elements from x or y, depending on condition.
Returns a masked array, shaped like condition, where the elements
are from `x` when `condition` is True, and from `y` otherwise.
If neither `x` nor `y` are given, the function ... | def where(condition, x=_NoValue, y=_NoValue):
"""
Return a masked array with elements from x or y, depending on condition.
Returns a masked array, shaped like condition, where the elements
are from `x` when `condition` is True, and from `y` otherwise.
If neither `x` nor `y` are given, the function ... | https://github.com/numpy/numpy/issues/8599 | x = np.eye(3)
y = np.eye(3)
np.where([0, 1, 0], x, y)
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])
np.ma.where([0, 1, 0], x, y)
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
np.ma.where([0, 1, 0], x, y)
File "C:\Program Files\Python 3.5\lib\site-packages\numpy\ma\core.py", li... | ValueError |
def hstack(tup):
"""
Stack arrays in sequence horizontally (column wise).
Take a sequence of arrays and stack them horizontally to make
a single array. Rebuild arrays divided by `hsplit`.
This function continues to be supported for backward compatibility, but
you should prefer ``np.concatenate... | def hstack(tup):
"""
Stack arrays in sequence horizontally (column wise).
Take a sequence of arrays and stack them horizontally to make
a single array. Rebuild arrays divided by `hsplit`.
This function continues to be supported for backward compatibility, but
you should prefer ``np.concatenate... | https://github.com/numpy/numpy/issues/8790 | import numpy as np
np.hstack([ ])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/numpy/core/shape_base.py", line 277, in hstack
if arrs[0].ndim == 1:
IndexError: list index out of range | IndexError |
def roots(self):
"""The roots of the polynomial, where self(x) == 0"""
return roots(self._coeffs)
| def roots(p):
"""
Return the roots of a polynomial with coefficients given in p.
The values in the rank-1 array `p` are coefficients of a polynomial.
If the length of `p` is n+1 then the polynomial is described by::
p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]
Parameters
------... | https://github.com/numpy/numpy/issues/8760 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/python3.5/inspect.py", line 2987, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/python3.5/inspect.py", line 2737, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/python3.5/inspect.py", li... | AttributeError |
def __init__(self, c_or_r, r=False, variable=None):
if isinstance(c_or_r, poly1d):
self._variable = c_or_r._variable
self._coeffs = c_or_r._coeffs
if set(c_or_r.__dict__) - set(self.__dict__):
msg = (
"In the future extra properties will not be copied "
... | def __init__(self, c_or_r, r=0, variable=None):
if isinstance(c_or_r, poly1d):
for key in c_or_r.__dict__.keys():
self.__dict__[key] = c_or_r.__dict__[key]
if variable is not None:
self.__dict__["variable"] = variable
return
if r:
c_or_r = poly(c_or_r)
... | https://github.com/numpy/numpy/issues/8760 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/python3.5/inspect.py", line 2987, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/python3.5/inspect.py", line 2737, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/python3.5/inspect.py", li... | AttributeError |
def __eq__(self, other):
if not isinstance(other, poly1d):
return NotImplemented
if self.coeffs.shape != other.coeffs.shape:
return False
return (self.coeffs == other.coeffs).all()
| def __eq__(self, other):
if self.coeffs.shape != other.coeffs.shape:
return False
return (self.coeffs == other.coeffs).all()
| https://github.com/numpy/numpy/issues/8760 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/python3.5/inspect.py", line 2987, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/python3.5/inspect.py", line 2737, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/python3.5/inspect.py", li... | AttributeError |
def __ne__(self, other):
if not isinstance(other, poly1d):
return NotImplemented
return not self.__eq__(other)
| def __ne__(self, other):
return not self.__eq__(other)
| https://github.com/numpy/numpy/issues/8760 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/python3.5/inspect.py", line 2987, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/python3.5/inspect.py", line 2737, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/python3.5/inspect.py", li... | AttributeError |
def __setitem__(self, key, val):
ind = self.order - key
if key < 0:
raise ValueError("Does not support negative powers.")
if key > self.order:
zr = NX.zeros(key - self.order, self.coeffs.dtype)
self._coeffs = NX.concatenate((zr, self.coeffs))
ind = 0
self._coeffs[ind] = v... | def __setitem__(self, key, val):
ind = self.order - key
if key < 0:
raise ValueError("Does not support negative powers.")
if key > self.order:
zr = NX.zeros(key - self.order, self.coeffs.dtype)
self.__dict__["coeffs"] = NX.concatenate((zr, self.coeffs))
self.__dict__["order"]... | https://github.com/numpy/numpy/issues/8760 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/python3.5/inspect.py", line 2987, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
File "/python3.5/inspect.py", line 2737, in from_callable
follow_wrapper_chains=follow_wrapped)
File "/python3.5/inspect.py", li... | AttributeError |
def gradient(f, *varargs, **kwargs):
"""
Return the gradient of an N-dimensional array.
The gradient is computed using second order accurate central differences
in the interior points and either first or second order accurate one-sides
(forward or backwards) differences at the boundaries.
The r... | def gradient(f, *varargs, **kwargs):
"""
Return the gradient of an N-dimensional array.
The gradient is computed using second order accurate central differences
in the interior points and either first or second order accurate one-sides
(forward or backwards) differences at the boundaries.
The r... | https://github.com/numpy/numpy/issues/8687 | ======================================================================
ERROR: test_warnings.test_warning_calls
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venv/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "... | SyntaxError |
def __call__(self, a, *args, **params):
if self.reversed:
args = list(args)
a, args[0] = args[0], a
marr = asanyarray(a)
method_name = self.__name__
method = getattr(type(marr), method_name, None)
if method is None:
# use the corresponding np function
method = getatt... | def __call__(self, a, *args, **params):
if self.reversed:
args = list(args)
arr = args[0]
args[0] = a
a = arr
# Get the method from the array (if possible)
method_name = self.__name__
method = getattr(a, method_name, None)
if method is not None:
return method(... | https://github.com/numpy/numpy/issues/8019 | np.ma.copy([1,2,3]) # unexpected behaviour
[1, 2, 3]
np.copy([1,2,3]) # expected behaviour
array([1, 2, 3])
np.ma.count([1,2,3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Programming\Anaconda\envs\test\lib\site-packages\numpy\ma\core.py", line 6389, in __call__
return method(*a... | TypeError |
def asanyarray(a, dtype=None):
"""
Convert the input to a masked array, conserving subclasses.
If `a` is a subclass of `MaskedArray`, its class is conserved.
No copy is performed if the input is already an `ndarray`.
Parameters
----------
a : array_like
Input data, in any form that... | def asanyarray(a, dtype=None):
"""
Convert the input to a masked array, conserving subclasses.
If `a` is a subclass of `MaskedArray`, its class is conserved.
No copy is performed if the input is already an `ndarray`.
Parameters
----------
a : array_like
Input data, in any form that... | https://github.com/numpy/numpy/issues/8019 | np.ma.copy([1,2,3]) # unexpected behaviour
[1, 2, 3]
np.copy([1,2,3]) # expected behaviour
array([1, 2, 3])
np.ma.count([1,2,3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Programming\Anaconda\envs\test\lib\site-packages\numpy\ma\core.py", line 6389, in __call__
return method(*a... | TypeError |
def apply_along_axis(func1d, axis, arr, *args, **kwargs):
"""
Apply a function to 1-D slices along the given axis.
Execute `func1d(a, *args)` where `func1d` operates on 1-D arrays and `a`
is a 1-D slice of `arr` along `axis`.
Parameters
----------
func1d : function
This function sh... | def apply_along_axis(func1d, axis, arr, *args, **kwargs):
"""
Apply a function to 1-D slices along the given axis.
Execute `func1d(a, *args)` where `func1d` operates on 1-D arrays and `a`
is a 1-D slice of `arr` along `axis`.
Parameters
----------
func1d : function
This function sh... | https://github.com/numpy/numpy/issues/6927 | In [47]: a = np.ones((0, 2))
In [48]: np.sum(a, axis=0)
Out[48]: array([ 0., 0.])
In [49]: np.sum(a, axis=1)
Out[49]: array([], dtype=float64)
In [50]: np.apply_along_axis(np.sum, axis=0, arr=a)
Out[50]: array([ 0., 0.])
In [51]: np.apply_along_axis(np.sum, axis=1, arr=a)
-----------------------------------------... | IndexError |
def mean(self, axis=None, dtype=None, out=None, keepdims=np._NoValue):
"""
Returns the average of the array elements along given axis.
Masked entries are ignored, and result elements which are not
finite will be masked.
Refer to `numpy.mean` for full documentation.
See Also
--------
n... | def mean(self, axis=None, dtype=None, out=None, keepdims=np._NoValue):
"""
Returns the average of the array elements along given axis.
Masked entries are ignored, and result elements which are not
finite will be masked.
Refer to `numpy.mean` for full documentation.
See Also
--------
n... | https://github.com/numpy/numpy/issues/5769 | In [7]: foo.mean() == bar.mean()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-3b824b0972e3> in <module>()
----> 1 foo.mean() == bar.mean()
/users/___/.local/lib/python2.7/site-packages/numpy/ma/c... | AttributeError |
def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
"""
Returns the variance of the array elements along given axis.
Masked entries are ignored, and result elements which are not
finite will be masked.
Refer to `numpy.var` for full documentation.
See Also
-------... | def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue):
"""
Returns the variance of the array elements along given axis.
Masked entries are ignored, and result elements which are not
finite will be masked.
Refer to `numpy.var` for full documentation.
See Also
-------... | https://github.com/numpy/numpy/issues/5769 | In [7]: foo.mean() == bar.mean()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-3b824b0972e3> in <module>()
----> 1 foo.mean() == bar.mean()
/users/___/.local/lib/python2.7/site-packages/numpy/ma/c... | AttributeError |
def _median(a, axis=None, out=None, overwrite_input=False):
if overwrite_input:
if axis is None:
asorted = a.ravel()
asorted.sort()
else:
a.sort(axis=axis)
asorted = a
else:
asorted = sort(a, axis=axis)
if axis is None:
axis = ... | def _median(a, axis=None, out=None, overwrite_input=False):
if overwrite_input:
if axis is None:
asorted = a.ravel()
asorted.sort()
else:
a.sort(axis=axis)
asorted = a
else:
asorted = sort(a, axis=axis)
if axis is None:
axis = 0... | https://github.com/numpy/numpy/issues/8015 | IndexError Traceback (most recent call last)
<ipython-input-26-b5117c1f3918> in <module>()
----> 1 np.ma.median(np.ma.array(np.ones((5, 5))), axis=0)
C:\-\lib\site-packages\numpy\ma\extras.py in median(a, axis, out, overwrite_input, keepdims)
693
694 r, k = _ureduce(a, func=_median, ... | IndexError |
def clean_up_temporary_directory():
if _tmpdirs is not None:
for d in _tmpdirs:
try:
shutil.rmtree(d)
except OSError:
pass
| def clean_up_temporary_directory():
for d in _tmpdirs:
try:
shutil.rmtree(d)
except OSError:
pass
| https://github.com/numpy/numpy/issues/7809 | Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 27, in clean_up_temporary_directory
for d in _tmpdirs:
TypeError: 'NoneType' object is not i... | TypeError |
def __str__(self):
"""
String representation.
"""
if masked_print_option.enabled():
f = masked_print_option
if self is masked:
return str(f)
m = self._mask
if m is nomask:
res = self._data
else:
if m.shape == ():
... | def __str__(self):
"""
String representation.
"""
if masked_print_option.enabled():
f = masked_print_option
if self is masked:
return str(f)
m = self._mask
if m is nomask:
res = self._data
else:
if m.shape == ():
... | https://github.com/numpy/numpy/issues/3544 | arr = np.zeros([43200, 21600], dtype=np.int8)
z = np.ma.masked_values(arr, 0)
print z
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/sci/lib/python2.7/site-packages/numpy/ma/core.py", line 3530, in __str__
res = self._data.astype("|O8")
MemoryError | MemoryError |
def _nanpercentile(
a,
q,
axis=None,
out=None,
overwrite_input=False,
interpolation="linear",
keepdims=False,
):
"""
Private function that doesn't support extended axis or keepdims.
These methods are extended to this function using _ureduce
See nanpercentile for parameter usa... | def _nanpercentile(
a,
q,
axis=None,
out=None,
overwrite_input=False,
interpolation="linear",
keepdims=False,
):
"""
Private function that doesn't support extended axis or keepdims.
These methods are extended to this function using _ureduce
See nanpercentile for parameter usa... | https://github.com/numpy/numpy/issues/5760 | In [9]: np.nanpercentile([[np.nan, np.nan], [np.nan, 2]], [50, 100], axis=0)
/usr/lib/python3.4/site-packages/numpy/lib/nanfunctions.py:914: RuntimeWarning: All-NaN slice encountered
warnings.warn("All-NaN slice encountered", RuntimeWarning)
---------------------------------------------------------------------------
Va... | ValueError |
def _nanpercentile1d(arr1d, q, overwrite_input=False, interpolation="linear"):
"""
Private function for rank 1 arrays. Compute percentile ignoring NaNs.
See nanpercentile for parameter usage
"""
c = np.isnan(arr1d)
s = np.where(c)[0]
if s.size == arr1d.size:
warnings.warn("All-NaN s... | def _nanpercentile1d(arr1d, q, overwrite_input=False, interpolation="linear"):
"""
Private function for rank 1 arrays. Compute percentile ignoring NaNs.
See nanpercentile for parameter usage
"""
c = np.isnan(arr1d)
s = np.where(c)[0]
if s.size == arr1d.size:
warnings.warn("All-NaN s... | https://github.com/numpy/numpy/issues/5760 | In [9]: np.nanpercentile([[np.nan, np.nan], [np.nan, 2]], [50, 100], axis=0)
/usr/lib/python3.4/site-packages/numpy/lib/nanfunctions.py:914: RuntimeWarning: All-NaN slice encountered
warnings.warn("All-NaN slice encountered", RuntimeWarning)
---------------------------------------------------------------------------
Va... | ValueError |
def __getitem__(self, indx):
"""
Get the index.
"""
m = self._mask
if isinstance(m[indx], ndarray):
# Can happen when indx is a multi-dimensional field:
# A = ma.masked_array(data=[([0,1],)], mask=[([True,
# False],)], dtype=[("A", ">i2", (2,))])
... | def __getitem__(self, indx):
"""
Get the index.
"""
m = self._mask
if m is not nomask and m[indx]:
return masked
return self._data[indx]
| https://github.com/numpy/numpy/issues/6724 | In [17]: numpy.version.version
Out[17]: '1.11.0.dev0+e711c95'
In [18]: A = ma.masked_array(data=[([0,1,2],), ([3,4,5],)], mask=[([True, False, False],), ([False, True, False],)], dtype=[("A", ">i2", (3,))])
In [19]: x = A[0]
In [20]: y = x["A"]
------------------------------------------------------------------------... | ValueError |
def ix_(*args):
"""
Construct an open mesh from multiple sequences.
This function takes N 1-D sequences and returns N outputs with N
dimensions each, such that the shape is 1 in all but one dimension
and the dimension with the non-unit shape value cycles through all
N dimensions.
Using `ix... | def ix_(*args):
"""
Construct an open mesh from multiple sequences.
This function takes N 1-D sequences and returns N outputs with N
dimensions each, such that the shape is 1 in all but one dimension
and the dimension with the non-unit shape value cycles through all
N dimensions.
Using `ix... | https://github.com/numpy/numpy/issues/6062 | ======================================================================
ERROR: test_qhull.TestUtilities.test_more_barycentric_transforms
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTe... | ValueError |
def masked_where(condition, a, copy=True):
"""
Mask an array where a condition is met.
Return `a` as an array masked where `condition` is True.
Any masked values of `a` or `condition` are also masked in the output.
Parameters
----------
condition : array_like
Masking condition. Wh... | def masked_where(condition, a, copy=True):
"""
Mask an array where a condition is met.
Return `a` as an array masked where `condition` is True.
Any masked values of `a` or `condition` are also masked in the output.
Parameters
----------
condition : array_like
Masking condition. Wh... | https://github.com/numpy/numpy/issues/2972 | R = numpy.empty(10, dtype=[("A", "<f2"), ("B", "<f4")])
Rm = numpy.ma.masked_where(R["A"]<0.1, R)
Rm["A"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/local/gerrit/python3.2-bleed/lib/python3.2/site-packages/numpy/ma/core.py", line 3014, in __getitem__
dout._mask = _mask[indx]
ValueErro... | ValueError |
def nan_to_num(x):
"""
Replace nan with zero and inf with finite numbers.
Returns an array or scalar replacing Not a Number (NaN) with zero,
(positive) infinity with a very large number and negative infinity
with a very small (or negative) number.
Parameters
----------
x : array_like
... | def nan_to_num(x):
"""
Replace nan with zero and inf with finite numbers.
Returns an array or scalar replacing Not a Number (NaN) with zero,
(positive) infinity with a very large number and negative infinity
with a very small (or negative) number.
Parameters
----------
x : array_like
... | https://github.com/numpy/numpy/issues/1478 | np.nan_to_num([1.0,3]) # returns: array([ 1., 3.])
n=np.array([1,3])
np.nan_to_num(n) # returns: array([1, 3])
np.nan_to_num([1,3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.5/site-packages/numpy/lib/type_check.py", line 135, in nan_to_num
maxf, minf = _getmaxmi... | ValueError |
def __add__(self, other):
try:
othercoef = self._get_coefficients(other)
coef = self._add(self.coef, othercoef)
except TypeError as e:
raise e
except:
return NotImplemented
return self.__class__(coef, self.domain, self.window)
| def __add__(self, other):
if isinstance(other, ABCPolyBase):
if not self.has_sametype(other):
raise TypeError("Polynomial types differ")
elif not self.has_samedomain(other):
raise TypeError("Domains differ")
elif not self.has_samewindow(other):
raise TypeE... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __sub__(self, other):
try:
othercoef = self._get_coefficients(other)
coef = self._sub(self.coef, othercoef)
except TypeError as e:
raise e
except:
return NotImplemented
return self.__class__(coef, self.domain, self.window)
| def __sub__(self, other):
if isinstance(other, ABCPolyBase):
if not self.has_sametype(other):
raise TypeError("Polynomial types differ")
elif not self.has_samedomain(other):
raise TypeError("Domains differ")
elif not self.has_samewindow(other):
raise TypeE... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __mul__(self, other):
try:
othercoef = self._get_coefficients(other)
coef = self._mul(self.coef, othercoef)
except TypeError as e:
raise e
except:
return NotImplemented
return self.__class__(coef, self.domain, self.window)
| def __mul__(self, other):
if isinstance(other, ABCPolyBase):
if not self.has_sametype(other):
raise TypeError("Polynomial types differ")
elif not self.has_samedomain(other):
raise TypeError("Domains differ")
elif not self.has_samewindow(other):
raise TypeE... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __truediv__(self, other):
# there is no true divide if the rhs is not a Number, although it
# could return the first n elements of an infinite series.
# It is hard to see where n would come from, though.
if not isinstance(other, Number) or isinstance(other, bool):
form = "unsupported types f... | def __truediv__(self, other):
# there is no true divide if the rhs is not a scalar, although it
# could return the first n elements of an infinite series.
# It is hard to see where n would come from, though.
if np.isscalar(other):
# this might be overly restrictive
coef = self.coef / oth... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __floordiv__(self, other):
res = self.__divmod__(other)
if res is NotImplemented:
return res
return res[0]
| def __floordiv__(self, other):
if isinstance(other, ABCPolyBase):
if not self.has_sametype(other):
raise TypeError("Polynomial types differ")
elif not self.has_samedomain(other):
raise TypeError("Domains differ")
elif not self.has_samewindow(other):
raise ... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __mod__(self, other):
res = self.__divmod__(other)
if res is NotImplemented:
return res
return res[1]
| def __mod__(self, other):
if isinstance(other, ABCPolyBase):
if not self.has_sametype(other):
raise TypeError("Polynomial types differ")
elif not self.has_samedomain(other):
raise TypeError("Domains differ")
elif not self.has_samewindow(other):
raise TypeE... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __divmod__(self, other):
try:
othercoef = self._get_coefficients(other)
quo, rem = self._div(self.coef, othercoef)
except (TypeError, ZeroDivisionError) as e:
raise e
except:
return NotImplemented
quo = self.__class__(quo, self.domain, self.window)
rem = self.__cl... | def __divmod__(self, other):
if isinstance(other, self.__class__):
if not self.has_samedomain(other):
raise TypeError("Domains are not equal")
elif not self.has_samewindow(other):
raise TypeError("Windows are not equal")
else:
quo, rem = self._div(self.coe... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __pow__(self, other):
coef = self._pow(self.coef, other, maxpower=self.maxpower)
res = self.__class__(coef, self.domain, self.window)
return res
| def __pow__(self, other):
try:
coef = self._pow(self.coef, other, maxpower=self.maxpower)
except:
raise
return self.__class__(coef, self.domain, self.window)
| https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __rtruediv__(self, other):
# An instance of ABCPolyBase is not considered a
# Number.
return NotImplemented
| def __rtruediv__(self, other):
# there is no true divide if the rhs is not a scalar, although it
# could return the first n elements of an infinite series.
# It is hard to see where n would come from, though.
if len(self.coef) == 1:
try:
quo, rem = self._div(other, self.coef[0])
... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __rfloordiv__(self, other):
res = self.__rdivmod__(other)
if res is NotImplemented:
return res
return res[0]
| def __rfloordiv__(self, other):
try:
quo, rem = self._div(other, self.coef)
except:
return NotImplemented
return self.__class__(quo, self.domain, self.window)
| https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __rmod__(self, other):
res = self.__rdivmod__(other)
if res is NotImplemented:
return res
return res[1]
| def __rmod__(self, other):
try:
quo, rem = self._div(other, self.coef)
except:
return NotImplemented
return self.__class__(rem, self.domain, self.window)
| https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __rdivmod__(self, other):
try:
quo, rem = self._div(other, self.coef)
except ZeroDivisionError as e:
raise e
except:
return NotImplemented
quo = self.__class__(quo, self.domain, self.window)
rem = self.__class__(rem, self.domain, self.window)
return quo, rem
| def __rdivmod__(self, other):
try:
quo, rem = self._div(other, self.coef)
except:
return NotImplemented
quo = self.__class__(quo, self.domain, self.window)
rem = self.__class__(rem, self.domain, self.window)
return quo, rem
| https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def __eq__(self, other):
res = (
isinstance(other, self.__class__)
and np.all(self.domain == other.domain)
and np.all(self.window == other.window)
and np.all(self.coef == other.coef)
)
return res
| def __eq__(self, other):
res = (
isinstance(other, self.__class__)
and self.has_samecoef(other)
and self.has_samedomain(other)
and self.has_samewindow(other)
)
return res
| https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def fit(cls, x, y, deg, domain=None, rcond=None, full=False, w=None, window=None):
"""Least squares fit to data.
Return a series instance that is the least squares fit to the data
`y` sampled at `x`. The domain of the returned instance can be
specified and this will often result in a superior fit with ... | def fit(cls, x, y, deg, domain=None, rcond=None, full=False, w=None, window=None):
"""Least squares fit to data.
Return a series instance that is the least squares fit to the data
`y` sampled at `x`. The domain of the returned instance can be
specified and this will often result in a superior fit with ... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def fromroots(cls, roots, domain=[], window=None):
"""Return series instance that has the specified roots.
Returns a series representing the product
``(x - r[0])*(x - r[1])*...*(x - r[n-1])``, where ``r`` is a
list of roots.
Parameters
----------
roots : array_like
List of roots.
... | def fromroots(cls, roots, domain=[], window=None):
"""Return series instance that has the specified roots.
Returns a series representing the product
``(x - r[0])*(x - r[1])*...*(x - r[n-1])``, where ``r`` is a
list of roots.
Parameters
----------
roots : array_like
List of roots.
... | https://github.com/numpy/numpy/issues/4631 | In [1]: import numpy.polynomial.polynomial as npp
In [2]: p1 = npp.Polynomial([1,2])
In [3]: p2 = npp.Polynomial([3,4])
In [4]: npp.polydiv(p1, p2)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-... | UnboundLocalError |
def loadtxt(
fname,
dtype=float,
comments="#",
delimiter=None,
converters=None,
skiprows=0,
usecols=None,
unpack=False,
ndmin=0,
):
"""
Load data from a text file.
Each row in the text file must have the same number of values.
Parameters
----------
fname : f... | def loadtxt(
fname,
dtype=float,
comments="#",
delimiter=None,
converters=None,
skiprows=0,
usecols=None,
unpack=False,
ndmin=0,
):
"""
Load data from a text file.
Each row in the text file must have the same number of values.
Parameters
----------
fname : f... | https://github.com/numpy/numpy/issues/2591 | Traceback (most recent call last):
File "./np_lt.py", line 5, in <module>
numpy.loadtxt(sys.argv[1])
File "/usr/lib/python2.7/site-packages/numpy/lib/npyio.py", line 804, in loadtxt
X = np.array(X, dtype)
ValueError: setting an array element with a sequence. | ValueError |
def select(condlist, choicelist, default=0):
"""
Return an array drawn from elements in choicelist, depending on conditions.
Parameters
----------
condlist : list of bool ndarrays
The list of conditions which determine from which array in `choicelist`
the output elements are taken. ... | def select(condlist, choicelist, default=0):
"""
Return an array drawn from elements in choicelist, depending on conditions.
Parameters
----------
condlist : list of bool ndarrays
The list of conditions which determine from which array in `choicelist`
the output elements are taken. ... | https://github.com/numpy/numpy/issues/3254 | 1
Traceback (most recent call last):
File "numpy5.py", line 11, in <module>
np.select(choices,results)
File "/Library/Python/2.7/site-packages/numpy-override/numpy/lib/function_base.py", line 779, in select
return choose(S, tuple(choicelist))
File "/Library/Python/2.7/site-packages/numpy-override/numpy/core/fromnumeric... | ValueError |
def poly(seq_of_zeros):
"""
Find the coefficients of a polynomial with the given sequence of roots.
Returns the coefficients of the polynomial whose leading coefficient
is one for the given sequence of zeros (multiple roots must be included
in the sequence as many times as their multiplicity; see E... | def poly(seq_of_zeros):
"""
Find the coefficients of a polynomial with the given sequence of roots.
Returns the coefficients of the polynomial whose leading coefficient
is one for the given sequence of zeros (multiple roots must be included
in the sequence as many times as their multiplicity; see E... | https://github.com/numpy/numpy/issues/2092 | In [1]: np.poly(np.zeros((0,0)))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/charris/<ipython console> in <module>()
/usr/local/lib/python2.6/dist-packages/numpy/lib/polynomial.pyc in poly(seq_of_zeros)
1... | ValueError |
def __init__(self, pyfunc, otypes="", doc=None, excluded=None, cache=False):
self.pyfunc = pyfunc
self.cache = cache
self._ufunc = None # Caching to improve default performance
if doc is None:
self.__doc__ = pyfunc.__doc__
else:
self.__doc__ = doc
if isinstance(otypes, str):
... | def __init__(self, pyfunc, otypes="", doc=None, excluded=None, cache=False):
self.pyfunc = pyfunc
self.cache = cache
if doc is None:
self.__doc__ = pyfunc.__doc__
else:
self.__doc__ = doc
if isinstance(otypes, str):
self.otypes = otypes
for char in self.otypes:
... | https://github.com/numpy/numpy/issues/3285 | v = numpy.vectorize( lambda x: x )
v.otypes='i'
v( [1,2] )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/numpy/lib/function_base.py", line 1873, in __call__
return self._vectorize_call(func=func, args=vargs)
File "/usr/lib64/python2.7/site-packages/numpy... | AttributeError |
def _get_ufunc_and_otypes(self, func, args):
"""Return (ufunc, otypes)."""
# frompyfunc will fail if args is empty
if not args:
raise ValueError("args can not be empty")
if self.otypes:
otypes = self.otypes
nout = len(otypes)
# Note logic here: We only *use* self._ufunc... | def _get_ufunc_and_otypes(self, func, args):
"""Return (ufunc, otypes)."""
# frompyfunc will fail if args is empty
assert args
if self.otypes:
otypes = self.otypes
nout = len(otypes)
# Note logic here: We only *use* self._ufunc if func is self.pyfunc
# even though we se... | https://github.com/numpy/numpy/issues/3285 | v = numpy.vectorize( lambda x: x )
v.otypes='i'
v( [1,2] )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/numpy/lib/function_base.py", line 1873, in __call__
return self._vectorize_call(func=func, args=vargs)
File "/usr/lib64/python2.7/site-packages/numpy... | AttributeError |
def byte_bounds(a):
"""
Returns pointers to the end-points of an array.
Parameters
----------
a : ndarray
Input array. It must conform to the Python-side of the array interface.
Returns
-------
(low, high) : tuple of 2 integers
The first integer is the first byte of the... | def byte_bounds(a):
"""
Returns pointers to the end-points of an array.
Parameters
----------
a : ndarray
Input array. It must conform to the Python-side of the array interface.
Returns
-------
(low, high) : tuple of 2 integers
The first integer is the first byte of the... | https://github.com/numpy/numpy/issues/4354 | In [52]: from datetime import datetime
In [53]: dts = [datetime(2005, 1, i) for i in range(1, 11)]
In [54]: arr = np.array(dts).astype('M8[ns]')
In [55]: byte_bounds(arr)
---------------------------------------------------------------------------
ValueError Traceback (most recent call ... | ValueError |
def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None):
"""
Return the cross product of two (arrays of) vectors.
The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular
to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors
are defined by the last axis of `a` an... | def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None):
"""
Return the cross product of two (arrays of) vectors.
The cross product of `a` and `b` in :math:`R^3` is a vector perpendicular
to both `a` and `b`. If `a` and `b` are arrays of vectors, the vectors
are defined by the last axis of `a` an... | https://github.com/numpy/numpy/issues/2624 | cross(random.randn(2,1,3),random.randn(5,3))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/numeric.py", line 1377, in cross
x = a[1]*b[2] - a[2]*b[1]
ValueError: operands could not be broadc... | ValueError |
def __init__(self, methodname, reversed=False):
self.__name__ = methodname
self.__doc__ = self.getdoc()
self.reversed = reversed
| def __init__(self, methodname):
self.__name__ = methodname
self.__doc__ = self.getdoc()
| https://github.com/numpy/numpy/issues/2495 | In [14]: arr = np.arange(8)
In [15]: arr.shape = 4,2
In [16]: cond = np.array([True, False, True, True])
In [17]: np.ma.compress(cond, arr, axis=0)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/efiring/<ip... | ValueError |
def __call__(self, a, *args, **params):
if self.reversed:
args = list(args)
arr = args[0]
args[0] = a
a = arr
# Get the method from the array (if possible)
method_name = self.__name__
method = getattr(a, method_name, None)
if method is not None:
return method(... | def __call__(self, a, *args, **params):
# Get the method from the array (if possible)
method_name = self.__name__
method = getattr(a, method_name, None)
if method is not None:
return method(*args, **params)
# Still here ? Then a is not a MaskedArray
method = getattr(MaskedArray, method_n... | https://github.com/numpy/numpy/issues/2495 | In [14]: arr = np.arange(8)
In [15]: arr.shape = 4,2
In [16]: cond = np.array([True, False, True, True])
In [17]: np.ma.compress(cond, arr, axis=0)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/efiring/<ip... | ValueError |
def CCompiler_spawn(self, cmd, display=None):
"""
Execute a command in a sub-process.
Parameters
----------
cmd : str
The command to execute.
display : str or sequence of str, optional
The text to add to the log file kept by `numpy.distutils`.
If not given, `display` is ... | def CCompiler_spawn(self, cmd, display=None):
"""
Execute a command in a sub-process.
Parameters
----------
cmd : str
The command to execute.
display : str or sequence of str, optional
The text to add to the log file kept by `numpy.distutils`.
If not given, `display` is ... | https://github.com/numpy/numpy/issues/1857 | x = np.array([-1j], '<c8')
>>> x.tostring().encode('hex')
'00000000000080bf'
# This is a little-endian representation, in the order (real, imag)
# When I swap the whole array, it swaps each of the (real, imag) parts
separately
>>> y = x.byteswap()
>>> y.tostring().encode('hex')
'00000000bf800000'
# and this round-trip... | AssertionError |
def setup_package():
# Perform 2to3 if needed
local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
src_path = local_path
if sys.version_info[0] == 3:
src_path = os.path.join(local_path, "build", "py3k")
sys.path.insert(0, os.path.join(local_path, "tools"))
import py3tool
... | def setup_package():
# Perform 2to3 if needed
local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
src_path = local_path
if sys.version_info[0] == 3:
src_path = os.path.join(local_path, "build", "py3k")
sys.path.insert(0, os.path.join(local_path, "tools"))
import py3tool
... | https://github.com/numpy/numpy/issues/1857 | x = np.array([-1j], '<c8')
>>> x.tostring().encode('hex')
'00000000000080bf'
# This is a little-endian representation, in the order (real, imag)
# When I swap the whole array, it swaps each of the (real, imag) parts
separately
>>> y = x.byteswap()
>>> y.tostring().encode('hex')
'00000000bf800000'
# and this round-trip... | AssertionError |
def savetxt(
fname,
X,
fmt="%.18e",
delimiter=" ",
newline="\n",
header="",
footer="",
comments="# ",
):
"""
Save an array to a text file.
Parameters
----------
fname : filename or file handle
If the filename ends in ``.gz``, the file is automatically saved i... | def savetxt(
fname,
X,
fmt="%.18e",
delimiter=" ",
newline="\n",
header="",
footer="",
comments="# ",
):
"""
Save an array to a text file.
Parameters
----------
fname : filename or file handle
If the filename ends in ``.gz``, the file is automatically saved i... | https://github.com/numpy/numpy/issues/1573 | ======================================================================
FAIL: Check formatting.
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python26\Lib\site-packages\numpy\core\tests\test_print.py", line 28, in test_complex_types
assert_equal(str(t(... | AssertionError |
def _raise_error():
"""
Raises errors for inotify failures.
"""
err = ctypes.get_errno()
if err == errno.ENOSPC:
raise OSError(errno.ENOSPC, "inotify watch limit reached")
elif err == errno.EMFILE:
raise OSError(errno.EMFILE, "inotify instance limit reached")
elif err == errn... | def _raise_error():
"""
Raises errors for inotify failures.
"""
err = ctypes.get_errno()
if err == errno.ENOSPC:
raise OSError(errno.ENOSPC, "inotify watch limit reached")
elif err == errno.EMFILE:
raise OSError(errno.EMFILE, "inotify instance limit reached")
else:
ra... | https://github.com/gorakhargosh/watchdog/issues/670 | $ watchmedo log --recursive /path
Traceback (most recent call last):
File ".local/bin/watchmedo", line 11, in <module>
sys.exit(main())
File "/home/user/.local/lib/python3.6/site-packages/watchdog/watchmedo.py", line 576, in main
parser.dispatch()
File "/home/user/.local/lib/python3.6/site-packages/argh/helpers.py", li... | PermissionError |
def _queue_renamed(self, src_path, is_directory, ref_snapshot, new_snapshot):
"""
Compares information from two directory snapshots (one taken before
the rename operation and another taken right after) to determine the
destination path of the file system object renamed, and adds
appropriate events t... | def _queue_renamed(self, src_path, is_directory, ref_snapshot, new_snapshot):
"""
Compares information from two directory snapshots (one taken before
the rename operation and another taken right after) to determine the
destination path of the file system object renamed, and adds
appropriate events t... | https://github.com/gorakhargosh/watchdog/issues/436 | Exception in thread Thread-4:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/SNIP/watchdog-0.8.3-py2-none-any.whl/watchdog/observers/api.py", line 146, in run
self.queue_events(self.timeout)
... | AttributeError |
def _encode_host(cls, host):
try:
ip, sep, zone = host.partition("%")
ip = ip_address(ip)
except ValueError:
for char in host:
if char > "\x7f":
break
else:
return host
try:
host = idna.encode(host, uts46=True).decode("a... | def _encode_host(cls, host):
try:
ip, sep, zone = host.partition("%")
ip = ip_address(ip)
except ValueError:
try:
host = idna.encode(host, uts46=True).decode("ascii")
except UnicodeError:
host = host.encode("idna").decode("ascii")
else:
host = ... | https://github.com/aio-libs/yarl/issues/388 | Python 3.6.5 (default, May 24 2018, 08:58:10)
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from yarl import URL
url = URL('https://www.python.org/~guido?arg=1#frag')
Traceback (most recent call last):
File "/tmp/foo/yarl/yarl/lib/python3.6/site-packages/yarl/__init__.py", ... | ValueError |
def __init__(self, slither: "SlitherCore"):
super().__init__()
self._scope: List[str] = []
self._name: Optional[str] = None
self._view: bool = False
self._pure: bool = False
self._payable: bool = False
self._visibility: Optional[str] = None
self._is_implemented: Optional[bool] = None
... | def __init__(self, slither: "SlitherCore"):
super().__init__()
self._scope: List[str] = []
self._name: Optional[str] = None
self._view: bool = False
self._pure: bool = False
self._payable: bool = False
self._visibility: Optional[str] = None
self._is_implemented: Optional[bool] = None
... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def custom_format(slither, result):
elements = result["elements"]
for element in elements:
if element["type"] != "function":
# Skip variable elements
continue
target_contract = slither.get_contract_from_name(
element["type_specific_fields"]["parent"]["name"]
... | def custom_format(slither, result):
elements = result["elements"]
for element in elements:
if element["type"] != "function":
# Skip variable elements
continue
target_contract = slither.get_contract_from_name(
element["type_specific_fields"]["parent"]["name"]
... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def custom_format(slither, result):
elements = result["elements"]
for element in elements:
target_contract = slither.get_contract_from_name(
element["type_specific_fields"]["parent"]["name"]
)
if target_contract:
function = target_contract.get_function_from_signat... | def custom_format(slither, result):
elements = result["elements"]
for element in elements:
target_contract = slither.get_contract_from_name(
element["type_specific_fields"]["parent"]["name"]
)
if target_contract:
function = target_contract.get_function_from_signat... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def __init__(
self,
function: Function,
function_data: Dict,
contract_parser: Optional["ContractSolc"],
slither_parser: "SlitherSolc",
):
self._slither_parser: "SlitherSolc" = slither_parser
self._contract_parser = contract_parser
self._function = function
# Only present if compact ... | def __init__(
self,
function: Function,
function_data: Dict,
contract_parser: Optional["ContractSolc"],
slither_parser: "SlitherSolc",
):
self._slither_parser: "SlitherSolc" = slither_parser
self._contract_parser = contract_parser
self._function = function
# Only present if compact ... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def _parse_params(self, params: Dict):
assert params[self.get_key()] == "ParameterList"
self._function.parameters_src().set_offset(params["src"], self._function.slither)
if self.is_compact_ast:
params = params["parameters"]
else:
params = params[self.get_children("children")]
for ... | def _parse_params(self, params: Dict):
assert params[self.get_key()] == "ParameterList"
self.parameters_src.set_offset(params["src"], self._function.slither)
if self.is_compact_ast:
params = params["parameters"]
else:
params = params[self.get_children("children")]
for param in par... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def _parse_returns(self, returns: Dict):
assert returns[self.get_key()] == "ParameterList"
self._function.returns_src().set_offset(returns["src"], self._function.slither)
if self.is_compact_ast:
returns = returns["parameters"]
else:
returns = returns[self.get_children("children")]
... | def _parse_returns(self, returns: Dict):
assert returns[self.get_key()] == "ParameterList"
self.returns_src.set_offset(returns["src"], self._function.slither)
if self.is_compact_ast:
returns = returns["parameters"]
else:
returns = returns[self.get_children("children")]
for ret in ... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def _get_source_code(self, contract: Contract): # pylint: disable=too-many-branches,too-many-statements
"""
Save the source code of the contract in self._source_codes
Patch the source code
:param contract:
:return:
"""
src_mapping = contract.source_mapping
content = self._slither.source... | def _get_source_code(self, contract: Contract): # pylint: disable=too-many-branches,too-many-statements
"""
Save the source code of the contract in self._source_codes
Patch the source code
:param contract:
:return:
"""
src_mapping = contract.source_mapping
content = self._slither.source... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def _export_from_type(self, t, contract, exported, list_contract):
if isinstance(t, UserDefinedType):
if isinstance(t.type, (EnumContract, StructureContract)):
if t.type.contract != contract and t.type.contract not in exported:
self._export_list_used_contracts(
... | def _export_from_type(self, t, contract, exported, list_contract):
if isinstance(t, UserDefinedType):
if isinstance(t.type, (Enum, Structure)):
if t.type.contract != contract and t.type.contract not in exported:
self._export_list_used_contracts(
t.type.contrac... | https://github.com/crytic/slither/issues/771 | Traceback (most recent call last):
File "/Users/nataliechin/.virtualenvs/slither-dev/bin/slither-flat", line 33, in <module>
sys.exit(load_entry_point('slither-analyzer', 'console_scripts', 'slither-flat')())
File "/Users/nataliechin/GitHub/slither/slither/tools/flattening/__main__.py", line 100, in main
flat = Flatten... | AttributeError |
def propagate_type_and_convert_call(result, node):
"""
Propagate the types variables and convert tmp call to real call operation
"""
calls_value = {}
calls_gas = {}
call_data = []
idx = 0
# use of while len() as result can be modified during the iteration
while idx < len(result):
... | def propagate_type_and_convert_call(result, node):
"""
Propagate the types variables and convert tmp call to real call operation
"""
calls_value = {}
calls_gas = {}
call_data = []
idx = 0
# use of while len() as result can be modified during the iteration
while idx < len(result):
... | https://github.com/crytic/slither/issues/589 | ERROR:root:Error in .\function_members.sol
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\github\slith... | AssertionError |
def propagate_types(ir, node): # pylint: disable=too-many-locals
# propagate the type
using_for = node.function.contract.using_for
if isinstance(ir, OperationWithLValue):
# Force assignment in case of missing previous correct type
if not ir.lvalue.type:
if isinstance(ir, Assignm... | def propagate_types(ir, node): # pylint: disable=too-many-locals
# propagate the type
using_for = node.function.contract.using_for
if isinstance(ir, OperationWithLValue):
# Force assignment in case of missing previous correct type
if not ir.lvalue.type:
if isinstance(ir, Assignm... | https://github.com/crytic/slither/issues/589 | ERROR:root:Error in .\function_members.sol
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\github\slith... | AssertionError |
def extract_tmp_call(ins, contract): # pylint: disable=too-many-locals
assert isinstance(ins, TmpCall)
if isinstance(ins.called, Variable) and isinstance(ins.called.type, FunctionType):
# If the call is made to a variable member, where the member is this
# We need to convert it to a HighLelelC... | def extract_tmp_call(ins, contract):
assert isinstance(ins, TmpCall)
if isinstance(ins.called, Variable) and isinstance(ins.called.type, FunctionType):
# If the call is made to a variable member, where the member is this
# We need to convert it to a HighLelelCall and not an internal dynamic cal... | https://github.com/crytic/slither/issues/589 | ERROR:root:Error in .\function_members.sol
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\github\slith... | AssertionError |
def __init__(self, variable_left, variable_right, result):
# Function can happen for something like
# library FunctionExtensions {
# function h(function() internal _t, uint8) internal { }
# }
# contract FunctionMembers {
# using FunctionExtensions for function();
#
# functio... | def __init__(self, variable_left, variable_right, result):
assert is_valid_rvalue(variable_left) or isinstance(variable_left, (Contract, Enum))
assert isinstance(variable_right, Constant)
assert isinstance(result, ReferenceVariable)
super().__init__()
self._variable_left = variable_left
self._va... | https://github.com/crytic/slither/issues/589 | ERROR:root:Error in .\function_members.sol
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\github\slith... | AssertionError |
def propagate_types(ir, node):
# propagate the type
using_for = node.function.contract.using_for
if isinstance(ir, OperationWithLValue):
# Force assignment in case of missing previous correct type
if not ir.lvalue.type:
if isinstance(ir, Assignment):
ir.lvalue.set... | def propagate_types(ir, node):
# propagate the type
using_for = node.function.contract.using_for
if isinstance(ir, OperationWithLValue):
# Force assignment in case of missing previous correct type
if not ir.lvalue.type:
if isinstance(ir, Assignment):
ir.lvalue.set... | https://github.com/crytic/slither/issues/592 | Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\core\cfg\node.py", line 887, in _find_read_write_call
self._high_level_calls.append((ir.destination.type.type, ir.function))
AttributeError: 'NoneType' object has no attribute 'type'
During handling of the above exception, another exc... | AttributeError |
def __init__(self, values):
# Note: Can return None
# ex: return call()
# where call() dont return
if not isinstance(values, list):
assert (
is_valid_rvalue(values)
or isinstance(values, (TupleVariable, Function))
or values is None
)
if values ... | def __init__(self, values):
# Note: Can return None
# ex: return call()
# where call() dont return
if not isinstance(values, list):
assert (
is_valid_rvalue(values)
or isinstance(values, TupleVariable)
or values is None
)
if values is None:
... | https://github.com/crytic/slither/issues/590 | ERROR:root:Error in .\function_returning_function.sol
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\g... | AssertionError |
def _valid_value(self, value):
if isinstance(value, list):
assert all(self._valid_value(v) for v in value)
else:
assert is_valid_rvalue(value) or isinstance(value, (TupleVariable, Function))
return True
| def _valid_value(self, value):
if isinstance(value, list):
assert all(self._valid_value(v) for v in value)
else:
assert is_valid_rvalue(value) or isinstance(value, TupleVariable)
return True
| https://github.com/crytic/slither/issues/590 | ERROR:root:Error in .\function_returning_function.sol
ERROR:root:Traceback (most recent call last):
File "c:\users\x\documents\github\slither\slither\__main__.py", line 610, in main_impl
(slither_instances, results_detectors, results_printers, number_contracts) = process_all(filename, args,
File "c:\users\x\documents\g... | AssertionError |
def parse_yul_identifier(
root: YulScope, node: YulNode, ast: Dict
) -> Optional[Expression]:
name = ast["name"]
if name in builtins:
return Identifier(YulBuiltin(name))
# check function-scoped variables
if root.parent_func:
variable = root.parent_func.get_local_variable_from_name(... | def parse_yul_identifier(
root: YulScope, node: YulNode, ast: Dict
) -> Optional[Expression]:
name = ast["name"]
if name in builtins:
return Identifier(YulBuiltin(name))
# check function-scoped variables
if root.parent_func:
variable = root.parent_func.get_local_variable_from_name(... | https://github.com/crytic/slither/issues/574 | Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/slither_analyzer-0.6.12-py3.6.egg/slither/__main__.py", line 612, in main_impl
printer_classes)
File "/usr/local/lib/python3.6/dist-packages/slither_analyzer-0.6.12-py3.6.egg/slither/__main__.py", line 68, in process_all
compilation, args, ... | slither.exceptions.SlitherException |
def __init__(self, called, arguments, type_call):
assert isinstance(called, Expression)
super(CallExpression, self).__init__()
self._called = called
self._arguments = arguments
self._type_call = type_call
# gas and value are only available if the syntax is {gas: , value: }
# For the .gas().v... | def __init__(self, called, arguments, type_call):
assert isinstance(called, Expression)
super(CallExpression, self).__init__()
self._called = called
self._arguments = arguments
self._type_call = type_call
# gas and value are only available if the syntax is {gas: , value: }
# For the .gas().v... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def __str__(self):
txt = str(self._called)
if self.call_gas or self.call_value:
gas = f"gas: {self.call_gas}" if self.call_gas else ""
value = f"value: {self.call_value}" if self.call_value else ""
salt = f"salt: {self.call_salt}" if self.call_salt else ""
if gas or value or salt... | def __str__(self):
txt = str(self._called)
if self.call_gas or self.call_value:
gas = f"gas: {self.call_gas}" if self.call_gas else ""
value = f"value: {self.call_value}" if self.call_value else ""
if gas and value:
txt += "{" + f"{gas}, {value}" + "}"
elif gas:
... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def __init__(self, contract_name):
super(NewContract, self).__init__()
self._contract_name = contract_name
self._gas = None
self._value = None
self._salt = None
| def __init__(self, contract_name):
super(NewContract, self).__init__()
self._contract_name = contract_name
| https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
def extract_tmp_call(ins, contract):
assert isinstance(ins, TmpCall)
if isinstance(ins.called, Variable) and isinstance(ins.called.type, FunctionType):
call = InternalDynamicCall(ins.lvalue, ins.called, ins.called.type)
call.set_expression(ins.expression)
call.call_id = ins.call_id
... | def extract_tmp_call(ins, contract):
assert isinstance(ins, TmpCall)
if isinstance(ins.called, Variable) and isinstance(ins.called.type, FunctionType):
call = InternalDynamicCall(ins.lvalue, ins.called, ins.called.type)
call.set_expression(ins.expression)
call.call_id = ins.call_id
... | https://github.com/crytic/slither/issues/485 | ERROR:root:Error in .
ERROR:root:Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 606, in main_impl
printer_classes)
File "/usr/local/lib/python3.7/site-packages/slither/__main__.py", line 68, in process_all
compilation, args, detector_classes, printer_classes)
... | AssertionError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.