neulab/docprompting-conala huggingface dataset:
numpy.testing.assert_string_equal   testing.assert_string_equal(actual, desired)[source]
 
Test if two strings are equal. If the given strings are equal, assert_string_equal does nothing. If they are not equal, an AssertionError is raised, and the diff between the strings is shown.  Parameters 
 
actualstr


The string to test for equality against the expected string.  
desiredstr


The expected string.     Examples >>> np.testing.assert_string_equal('abc', 'abc')
>>> np.testing.assert_string_equal('abc', 'abcd')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
...
AssertionError: Differences in strings:
- abc+ abcd?    +
numpy.testing.assert_warns   testing.assert_warns(warning_class, *args, **kwargs)[source]
 
Fail unless the given callable throws the specified warning. A warning of class warning_class should be thrown by the callable when invoked with arguments args and keyword arguments kwargs. If a different type of warning is thrown, it will not be caught. If called with all arguments other than the warning class omitted, may be used as a context manager:  with assert_warns(SomeWarning):

do_something()   The ability to be used as a context manager is new in NumPy v1.11.0.  New in version 1.4.0.   Parameters 
 
warning_classclass


The class defining the warning that func is expected to throw.  
funccallable, optional


Callable to test  
*argsArguments


Arguments for func.  
**kwargsKwargs


Keyword arguments for func.    Returns 
 The value returned by func.
   Examples >>> import warnings
>>> def deprecated_func(num):
...     warnings.warn("Please upgrade", DeprecationWarning)
...     return num*num
>>> with np.testing.assert_warns(DeprecationWarning):
...     assert deprecated_func(4) == 16
>>> # or passing a func
>>> ret = np.testing.assert_warns(DeprecationWarning, deprecated_func, 4)
>>> assert ret == 16
numpy.testing.dec.deprecated   testing.dec.deprecated(conditional=True)[source]
 
 Deprecated since version 1.21: This decorator is retained for compatibility with the nose testing framework, which is being phased out. Please use the nose2 or pytest frameworks instead.  Filter deprecation warnings while running the test suite. This decorator can be used to filter DeprecationWarning’s, to avoid printing them during the test suite run, while checking that the test actually raises a DeprecationWarning.  Parameters 
 
conditionalbool or callable, optional


Flag to determine whether to mark test as deprecated or not. If the condition is a callable, it is used at runtime to dynamically make the decision. Default is True.    Returns 
 
decoratorfunction


The deprecated decorator itself.     Notes  New in version 1.4.0.
numpy.testing.dec.knownfailureif   testing.dec.knownfailureif(fail_condition, msg=None)[source]
 
 Deprecated since version 1.21: This decorator is retained for compatibility with the nose testing framework, which is being phased out. Please use the nose2 or pytest frameworks instead.  Make function raise KnownFailureException exception if given condition is true. If the condition is a callable, it is used at runtime to dynamically make the decision. This is useful for tests that may require costly imports, to delay the cost until the test suite is actually executed.  Parameters 
 
fail_conditionbool or callable


Flag to determine whether to mark the decorated test as a known failure (if True) or not (if False).  
msgstr, optional


Message to give on raising a KnownFailureException exception. Default is None.    Returns 
 
decoratorfunction


Decorator, which, when applied to a function, causes KnownFailureException to be raised when fail_condition is True, and the function to be called normally otherwise.     Notes The decorator itself is decorated with the nose.tools.make_decorator function in order to transmit function name, and various other metadata.
numpy.testing.dec.setastest   testing.dec.setastest(tf=True)[source]
 
 Deprecated since version 1.21: This decorator is retained for compatibility with the nose testing framework, which is being phased out. Please use the nose2 or pytest frameworks instead.  Signals to nose that this function is or is not a test.  Parameters 
 
tfbool


If True, specifies that the decorated callable is a test. If False, specifies that the decorated callable is not a test. Default is True.     Notes This decorator can’t use the nose namespace, because it can be called from a non-test module. See also istest and nottest in nose.tools. Examples setastest can be used in the following way: from numpy.testing import dec

@dec.setastest(False)
def func_with_test_in_name(arg1, arg2):
    pass
numpy.testing.dec.skipif   testing.dec.skipif(skip_condition, msg=None)[source]
 
 Deprecated since version 1.21: This decorator is retained for compatibility with the nose testing framework, which is being phased out. Please use the nose2 or pytest frameworks instead.  Make function raise SkipTest exception if a given condition is true. If the condition is a callable, it is used at runtime to dynamically make the decision. This is useful for tests that may require costly imports, to delay the cost until the test suite is actually executed.  Parameters 
 
skip_conditionbool or callable


Flag to determine whether to skip the decorated test.  
msgstr, optional


Message to give on raising a SkipTest exception. Default is None.    Returns 
 
decoratorfunction


Decorator which, when applied to a function, causes SkipTest to be raised when skip_condition is True, and the function to be called normally otherwise.     Notes The decorator itself is decorated with the nose.tools.make_decorator function in order to transmit function name, and various other metadata.
numpy.testing.dec.slow   testing.dec.slow(t)[source]
 
 Deprecated since version 1.21: This decorator is retained for compatibility with the nose testing framework, which is being phased out. Please use the nose2 or pytest frameworks instead.  Label a test as ‘slow’. The exact definition of a slow test is obviously both subjective and hardware-dependent, but in general any individual test that requires more than a second or two should be labeled as slow (the whole suite consists of thousands of tests, so even a second is significant).  Parameters 
 
tcallable


The test to label as slow.    Returns 
 
tcallable


The decorated test t.     Examples The numpy.testing module includes import decorators as dec. A test can be decorated as slow like this: from numpy.testing import *

@dec.slow
def test_big(self):
    print('Big, slow test')
numpy.testing.decorate_methods   testing.decorate_methods(cls, decorator, testmatch=None)[source]
 
Apply a decorator to all methods in a class matching a regular expression. The given decorator is applied to all public methods of cls that are matched by the regular expression testmatch (testmatch.search(methodname)). Methods that are private, i.e. start with an underscore, are ignored.  Parameters 
 
clsclass


Class whose methods to decorate.  
decoratorfunction


Decorator to apply to methods  
testmatchcompiled regexp or str, optional


The regular expression. Default value is None, in which case the nose default (re.compile(r'(?:^|[\b_\.%s-])[Tt]est' % os.sep)) is used. If testmatch is a string, it is compiled to a regular expression first.
numpy.testing.run_module_suite   testing.run_module_suite(file_to_run=None, argv=None)[source]
 
Run a test module. Equivalent to calling $ nosetests <argv> <file_to_run> from the command line  Parameters 
 
file_to_runstr, optional


Path to test module, or None. By default, run the module from which this function is called.  
argvlist of strings


Arguments to be passed to the nose test runner. argv[0] is ignored. All command line arguments accepted by nosetests will work. If it is the default value None, sys.argv is used.  New in version 1.9.0.      Examples Adding the following: if __name__ == "__main__" :
    run_module_suite(argv=sys.argv)
 at the end of a test module will run the tests when that module is called in the python interpreter. Alternatively, calling: >>> run_module_suite(file_to_run="numpy/tests/test_matlib.py")  
 from an interpreter will run all the test routine in ‘test_matlib.py’.
numpy.testing.rundocs   testing.rundocs(filename=None, raise_on_error=True)[source]
 
Run doctests found in the given file. By default rundocs raises an AssertionError on failure.  Parameters 
 
filenamestr


The path to the file for which the doctests are run.  
raise_on_errorbool


Whether to raise an AssertionError when a doctest fails. Default is True.     Notes The doctests can be run by the user/developer by adding the doctests argument to the test() call. For example, to run all tests (including doctests) for numpy.lib: >>> np.lib.test(doctests=True)
numpy.testing.suppress_warnings.__call__ method   testing.suppress_warnings.__call__(func)[source]
 
Function decorator to apply certain suppressions to a whole function.
numpy.testing.suppress_warnings.filter method   testing.suppress_warnings.filter(category=<class 'Warning'>, message='', module=None)[source]
 
Add a new suppressing filter or apply it if the state is entered.  Parameters 
 
categoryclass, optional


Warning class to filter  
messagestring, optional


Regular expression matching the warning message.  
modulemodule, optional


Module to filter for. Note that the module (and its file) must match exactly and cannot be a submodule. This may make it unreliable for external modules.     Notes When added within a context, filters are only added inside the context and will be forgotten when the context is exited.
numpy.testing.suppress_warnings.record method   testing.suppress_warnings.record(category=<class 'Warning'>, message='', module=None)[source]
 
Append a new recording filter or apply it if the state is entered. All warnings matching will be appended to the log attribute.  Parameters 
 
categoryclass, optional


Warning class to filter  
messagestring, optional


Regular expression matching the warning message.  
modulemodule, optional


Module to filter for. Note that the module (and its file) must match exactly and cannot be a submodule. This may make it unreliable for external modules.    Returns 
 
loglist


A list which will be filled with all matched warnings.     Notes When added within a context, filters are only added inside the context and will be forgotten when the context is exited.
numpy.ufunc.__call__ method   ufunc.__call__(*args, **kwargs)
 
Call self as a function.
numpy.ufunc.accumulate method   ufunc.accumulate(array, axis=0, dtype=None, out=None)
 
Accumulate the result of applying the operator to all elements. For a one-dimensional array, accumulate produces results equivalent to: r = np.empty(len(A))
t = op.identity        # op = the ufunc being applied to A's  elements
for i in range(len(A)):
    t = op(t, A[i])
    r[i] = t
return r
 For example, add.accumulate() is equivalent to np.cumsum(). For a multi-dimensional array, accumulate is applied along only one axis (axis zero by default; see Examples below) so repeated use is necessary if one wants to accumulate over multiple axes.  Parameters 
 
arrayarray_like


The array to act on.  
axisint, optional


The axis along which to apply the accumulation; default is zero.  
dtypedata-type code, optional


The data-type used to represent the intermediate results. Defaults to the data-type of the output array if such is provided, or the the data-type of the input array if no output array is provided.  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If not provided or None, a freshly-allocated array is returned. For consistency with ufunc.__call__, if given as a keyword, this may be wrapped in a 1-element tuple.  Changed in version 1.13.0: Tuples are allowed for keyword argument.     Returns 
 
rndarray


The accumulated values. If out was supplied, r is a reference to out.     Examples 1-D array examples: >>> np.add.accumulate([2, 3, 5])
array([ 2,  5, 10])
>>> np.multiply.accumulate([2, 3, 5])
array([ 2,  6, 30])
 2-D array examples: >>> I = np.eye(2)
>>> I
array([[1.,  0.],
       [0.,  1.]])
 Accumulate along axis 0 (rows), down columns: >>> np.add.accumulate(I, 0)
array([[1.,  0.],
       [1.,  1.]])
>>> np.add.accumulate(I) # no axis specified = axis zero
array([[1.,  0.],
       [1.,  1.]])
 Accumulate along axis 1 (columns), through rows: >>> np.add.accumulate(I, 1)
array([[1.,  1.],
       [0.,  1.]])
numpy.ufunc.at method   ufunc.at(a, indices, b=None, /)
 
Performs unbuffered in place operation on operand ‘a’ for elements specified by ‘indices’. For addition ufunc, this method is equivalent to a[indices] += b, except that results are accumulated for elements that are indexed more than once. For example, a[[0,0]] += 1 will only increment the first element once because of buffering, whereas add.at(a, [0,0], 1) will increment the first element twice.  New in version 1.8.0.   Parameters 
 
aarray_like


The array to perform in place operation on.  
indicesarray_like or tuple


Array like index object or slice object for indexing into first operand. If first operand has multiple dimensions, indices can be a tuple of array like index objects or slice objects.  
barray_like


Second operand for ufuncs requiring two operands. Operand must be broadcastable over first operand after indexing or slicing.     Examples Set items 0 and 1 to their negative values: >>> a = np.array([1, 2, 3, 4])
>>> np.negative.at(a, [0, 1])
>>> a
array([-1, -2,  3,  4])
 Increment items 0 and 1, and increment item 2 twice: >>> a = np.array([1, 2, 3, 4])
>>> np.add.at(a, [0, 1, 2, 2], 1)
>>> a
array([2, 3, 5, 4])
 Add items 0 and 1 in first array to second array, and store results in first array: >>> a = np.array([1, 2, 3, 4])
>>> b = np.array([1, 2])
>>> np.add.at(a, [0, 1], b)
>>> a
array([2, 4, 3, 4])
numpy.ufunc.identity attribute   ufunc.identity
 
The identity value. Data attribute containing the identity element for the ufunc, if it has one. If it does not, the attribute value is None. Examples >>> np.add.identity
0
>>> np.multiply.identity
1
>>> np.power.identity
1
>>> print(np.exp.identity)
None
numpy.ufunc.nargs attribute   ufunc.nargs
 
The number of arguments. Data attribute containing the number of arguments the ufunc takes, including optional ones. Notes Typically this value will be one more than what you might expect because all ufuncs take the optional “out” argument. Examples >>> np.add.nargs
3
>>> np.multiply.nargs
3
>>> np.power.nargs
3
>>> np.exp.nargs
2
numpy.ufunc.nin attribute   ufunc.nin
 
The number of inputs. Data attribute containing the number of arguments the ufunc treats as input. Examples >>> np.add.nin
2
>>> np.multiply.nin
2
>>> np.power.nin
2
>>> np.exp.nin
1
numpy.ufunc.nout attribute   ufunc.nout
 
The number of outputs. Data attribute containing the number of arguments the ufunc treats as output. Notes Since all ufuncs can take output arguments, this will always be (at least) 1. Examples >>> np.add.nout
1
>>> np.multiply.nout
1
>>> np.power.nout
1
>>> np.exp.nout
1
numpy.ufunc.ntypes attribute   ufunc.ntypes
 
The number of types. The number of numerical NumPy types - of which there are 18 total - on which the ufunc can operate.  See also  numpy.ufunc.types
  Examples >>> np.add.ntypes
18
>>> np.multiply.ntypes
18
>>> np.power.ntypes
17
>>> np.exp.ntypes
7
>>> np.remainder.ntypes
14
numpy.ufunc.outer method   ufunc.outer(A, B, /, **kwargs)
 
Apply the ufunc op to all pairs (a, b) with a in A and b in B. Let M = A.ndim, N = B.ndim. Then the result, C, of op.outer(A, B) is an array of dimension M + N such that:  \[C[i_0, ..., i_{M-1}, j_0, ..., j_{N-1}] = op(A[i_0, ..., i_{M-1}], B[j_0, ..., j_{N-1}])\] For A and B one-dimensional, this is equivalent to: r = empty(len(A),len(B))
for i in range(len(A)):
    for j in range(len(B)):
        r[i,j] = op(A[i], B[j])  # op = ufunc in question
  Parameters 
 
Aarray_like


First array  
Barray_like


Second array  
kwargsany


Arguments to pass on to the ufunc. Typically dtype or out. See ufunc for a comprehensive overview of all available arguments.    Returns 
 
rndarray


Output array      See also  numpy.outer

A less powerful version of np.multiply.outer that ravels all inputs to 1D. This exists primarily for compatibility with old code.  tensordot

np.tensordot(a, b, axes=((), ())) and np.multiply.outer(a, b) behave same for all dimensions of a and b.    Examples >>> np.multiply.outer([1, 2, 3], [4, 5, 6])
array([[ 4,  5,  6],
       [ 8, 10, 12],
       [12, 15, 18]])
 A multi-dimensional example: >>> A = np.array([[1, 2, 3], [4, 5, 6]])
>>> A.shape
(2, 3)
>>> B = np.array([[1, 2, 3, 4]])
>>> B.shape
(1, 4)
>>> C = np.multiply.outer(A, B)
>>> C.shape; C
(2, 3, 1, 4)
array([[[[ 1,  2,  3,  4]],
        [[ 2,  4,  6,  8]],
        [[ 3,  6,  9, 12]]],
       [[[ 4,  8, 12, 16]],
        [[ 5, 10, 15, 20]],
        [[ 6, 12, 18, 24]]]])
numpy.ufunc.reduceat method   ufunc.reduceat(array, indices, axis=0, dtype=None, out=None)
 
Performs a (local) reduce with specified slices over a single axis. For i in range(len(indices)), reduceat computes ufunc.reduce(array[indices[i]:indices[i+1]]), which becomes the i-th generalized “row” parallel to axis in the final result (i.e., in a 2-D array, for example, if axis = 0, it becomes the i-th row, but if axis = 1, it becomes the i-th column). There are three exceptions to this:  when i = len(indices) - 1 (so for the last index), indices[i+1] = array.shape[axis]. if indices[i] >= indices[i + 1], the i-th generalized “row” is simply array[indices[i]]. if indices[i] >= len(array) or indices[i] < 0, an error is raised.  The shape of the output depends on the size of indices, and may be larger than array (this happens if len(indices) > array.shape[axis]).  Parameters 
 
arrayarray_like


The array to act on.  
indicesarray_like


Paired indices, comma separated (not colon), specifying slices to reduce.  
axisint, optional


The axis along which to apply the reduceat.  
dtypedata-type code, optional


The type used to represent the intermediate results. Defaults to the data type of the output array if this is provided, or the data type of the input array if no output array is provided.  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If not provided or None, a freshly-allocated array is returned. For consistency with ufunc.__call__, if given as a keyword, this may be wrapped in a 1-element tuple.  Changed in version 1.13.0: Tuples are allowed for keyword argument.     Returns 
 
rndarray


The reduced values. If out was supplied, r is a reference to out.     Notes A descriptive example: If array is 1-D, the function ufunc.accumulate(array) is the same as ufunc.reduceat(array, indices)[::2] where indices is range(len(array) - 1) with a zero placed in every other element: indices = zeros(2 * len(array) - 1), indices[1::2] = range(1, len(array)). Don’t be fooled by this attribute’s name: reduceat(array) is not necessarily smaller than array. Examples To take the running sum of four successive values: >>> np.add.reduceat(np.arange(8),[0,4, 1,5, 2,6, 3,7])[::2]
array([ 6, 10, 14, 18])
 A 2-D example: >>> x = np.linspace(0, 15, 16).reshape(4,4)
>>> x
array([[ 0.,   1.,   2.,   3.],
       [ 4.,   5.,   6.,   7.],
       [ 8.,   9.,  10.,  11.],
       [12.,  13.,  14.,  15.]])
 # reduce such that the result has the following five rows:
# [row1 + row2 + row3]
# [row4]
# [row2]
# [row3]
# [row1 + row2 + row3 + row4]
 >>> np.add.reduceat(x, [0, 3, 1, 2, 0])
array([[12.,  15.,  18.,  21.],
       [12.,  13.,  14.,  15.],
       [ 4.,   5.,   6.,   7.],
       [ 8.,   9.,  10.,  11.],
       [24.,  28.,  32.,  36.]])
 # reduce such that result has the following two columns:
# [col1 * col2 * col3, col4]
 >>> np.multiply.reduceat(x, [0, 3], 1)
array([[   0.,     3.],
       [ 120.,     7.],
       [ 720.,    11.],
       [2184.,    15.]])
numpy.ufunc.signature attribute   ufunc.signature
 
Definition of the core elements a generalized ufunc operates on. The signature determines how the dimensions of each input/output array are split into core and loop dimensions:  Each dimension in the signature is matched to a dimension of the corresponding passed-in array, starting from the end of the shape tuple. Core dimensions assigned to the same label in the signature must have exactly matching sizes, no broadcasting is performed. The core dimensions are removed from all inputs and the remaining dimensions are broadcast together, defining the loop dimensions.  Notes Generalized ufuncs are used internally in many linalg functions, and in the testing suite; the examples below are taken from these. For ufuncs that operate on scalars, the signature is None, which is equivalent to ‘()’ for every argument. Examples >>> np.core.umath_tests.matrix_multiply.signature
'(m,n),(n,p)->(m,p)'
>>> np.linalg._umath_linalg.det.signature
'(m,m)->()'
>>> np.add.signature is None
True  # equivalent to '(),()->()'
numpy.ufunc.types attribute   ufunc.types
 
Returns a list with types grouped input->output. Data attribute listing the data-type “Domain-Range” groupings the ufunc can deliver. The data-types are given using the character codes.  See also  numpy.ufunc.ntypes
  Examples >>> np.add.types
['??->?', 'bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l',
'LL->L', 'qq->q', 'QQ->Q', 'ff->f', 'dd->d', 'gg->g', 'FF->F', 'DD->D',
'GG->G', 'OO->O']
 >>> np.multiply.types
['??->?', 'bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l',
'LL->L', 'qq->q', 'QQ->Q', 'ff->f', 'dd->d', 'gg->g', 'FF->F', 'DD->D',
'GG->G', 'OO->O']
 >>> np.power.types
['bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l', 'LL->L',
'qq->q', 'QQ->Q', 'ff->f', 'dd->d', 'gg->g', 'FF->F', 'DD->D', 'GG->G',
'OO->O']
 >>> np.exp.types
['f->f', 'd->d', 'g->g', 'F->F', 'D->D', 'G->G', 'O->O']
 >>> np.remainder.types
['bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l', 'LL->L',
'qq->q', 'QQ->Q', 'ff->f', 'dd->d', 'gg->g', 'OO->O']
numpy.vectorize.__call__ method   vectorize.__call__(*args, **kwargs)[source]
 
Return arrays with the results of pyfunc broadcast (vectorized) over args and kwargs not in excluded.