neulab/docprompting-conala huggingface dataset:
numpy.savez_compressed   numpy.savez_compressed(file, *args, **kwds)[source]
 
Save several arrays into a single file in compressed .npz format. Provide arrays as keyword arguments to store them under the corresponding name in the output file: savez(fn, x=x, y=y). If arrays are specified as positional arguments, i.e., savez(fn,
x, y), their names will be arr_0, arr_1, etc.  Parameters 
 
filestr or file


Either the filename (string) or an open file (file-like object) where the data will be saved. If file is a string or a Path, the .npz extension will be appended to the filename if it is not already there.  
argsArguments, optional


Arrays to save to the file. Please use keyword arguments (see kwds below) to assign names to arrays. Arrays specified as args will be named “arr_0”, “arr_1”, and so on.  
kwdsKeyword arguments, optional


Arrays to save to the file. Each array will be saved to the output file with its corresponding keyword name.    Returns 
 None
    See also  numpy.save

Save a single array to a binary file in NumPy format.  numpy.savetxt

Save an array to a file as plain text.  numpy.savez

Save several arrays into an uncompressed .npz file format  numpy.load

Load the files created by savez_compressed.    Notes The .npz file format is a zipped archive of files named after the variables they contain. The archive is compressed with zipfile.ZIP_DEFLATED and each file in the archive contains one variable in .npy format. For a description of the .npy format, see numpy.lib.format. When opening the saved .npz file with load a NpzFile object is returned. This is a dictionary-like object which can be queried for its list of arrays (with the .files attribute), and for the arrays themselves. Examples >>> test_array = np.random.rand(3, 2)
>>> test_vector = np.random.rand(4)
>>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector)
>>> loaded = np.load('/tmp/123.npz')
>>> print(np.array_equal(test_array, loaded['a']))
True
>>> print(np.array_equal(test_vector, loaded['b']))
True
numpy.sctype2char   numpy.sctype2char(sctype)[source]
 
Return the string representation of a scalar dtype.  Parameters 
 
sctypescalar dtype or object


If a scalar dtype, the corresponding string character is returned. If an object, sctype2char tries to infer its scalar type and then return the corresponding string character.    Returns 
 
typecharstr


The string character corresponding to the scalar type.    Raises 
 ValueError

If sctype is an object for which the type can not be inferred.      See also  
obj2sctype, issctype, issubsctype, mintypecode

  Examples >>> for sctype in [np.int32, np.double, np.complex_, np.string_, np.ndarray]:
...     print(np.sctype2char(sctype))
l # may vary
d
D
S
O
 >>> x = np.array([1., 2-1.j])
>>> np.sctype2char(x)
'D'
>>> np.sctype2char(list)
'O'
numpy.searchsorted   numpy.searchsorted(a, v, side='left', sorter=None)[source]
 
Find indices where elements should be inserted to maintain order. Find the indices into a sorted array a such that, if the corresponding elements in v were inserted before the indices, the order of a would be preserved. Assuming that a is sorted:   
side returned index i satisfies   
left a[i-1] < v <= a[i]  
right a[i-1] <= v < a[i]    Parameters 
 
a1-D array_like


Input array. If sorter is None, then it must be sorted in ascending order, otherwise sorter must be an array of indices that sort it.  
varray_like


Values to insert into a.  
side{‘left’, ‘right’}, optional


If ‘left’, the index of the first suitable location found is given. If ‘right’, return the last such index. If there is no suitable index, return either 0 or N (where N is the length of a).  
sorter1-D array_like, optional


Optional array of integer indices that sort array a into ascending order. They are typically the result of argsort.  New in version 1.7.0.     Returns 
 
indicesint or array of ints


Array of insertion points with the same shape as v, or an integer if v is a scalar.      See also  sort

Return a sorted copy of an array.  histogram

Produce histogram from 1-D data.    Notes Binary search is used to find the required insertion points. As of NumPy 1.4.0 searchsorted works with real/complex arrays containing nan values. The enhanced sort order is documented in sort. This function uses the same algorithm as the builtin python bisect.bisect_left (side='left') and bisect.bisect_right (side='right') functions, which is also vectorized in the v argument. Examples >>> np.searchsorted([1,2,3,4,5], 3)
2
>>> np.searchsorted([1,2,3,4,5], 3, side='right')
3
>>> np.searchsorted([1,2,3,4,5], [-10, 10, 2, 3])
array([0, 5, 1, 2])
numpy.select   numpy.select(condlist, choicelist, default=0)[source]
 
Return an array drawn from elements in choicelist, depending on conditions.  Parameters 
 
condlistlist of bool ndarrays


The list of conditions which determine from which array in choicelist the output elements are taken. When multiple conditions are satisfied, the first one encountered in condlist is used.  
choicelistlist of ndarrays


The list of arrays from which the output elements are taken. It has to be of the same length as condlist.  
defaultscalar, optional


The element inserted in output when all conditions evaluate to False.    Returns 
 
outputndarray


The output at position m is the m-th element of the array in choicelist where the m-th element of the corresponding array in condlist is True.      See also  where

Return elements from one of two arrays depending on condition.  
take, choose, compress, diag, diagonal

  Examples >>> x = np.arange(6)
>>> condlist = [x<3, x>3]
>>> choicelist = [x, x**2]
>>> np.select(condlist, choicelist, 42)
array([ 0,  1,  2, 42, 16, 25])
 >>> condlist = [x<=4, x>3]
>>> choicelist = [x, x**2]
>>> np.select(condlist, choicelist, 55)
array([ 0,  1,  2,  3,  4, 25])
numpy.set_string_function   numpy.set_string_function(f, repr=True)[source]
 
Set a Python function to be used when pretty printing arrays.  Parameters 
 
ffunction or None


Function to be used to pretty print arrays. The function should expect a single array argument and return a string of the representation of the array. If None, the function is reset to the default NumPy function to print arrays.  
reprbool, optional


If True (default), the function for pretty printing (__repr__) is set, if False the function that returns the default string representation (__str__) is set.      See also  
set_printoptions, get_printoptions

  Examples >>> def pprint(arr):
...     return 'HA! - What are you going to do now?'
...
>>> np.set_string_function(pprint)
>>> a = np.arange(10)
>>> a
HA! - What are you going to do now?
>>> _ = a
>>> # [0 1 2 3 4 5 6 7 8 9]
 We can reset the function to the default: >>> np.set_string_function(None)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 repr affects either pretty printing or normal string representation. Note that __repr__ is still affected by setting __str__ because the width of each array element in the returned string becomes equal to the length of the result of __str__(). >>> x = np.arange(4)
>>> np.set_string_function(lambda x:'random', repr=False)
>>> x.__str__()
'random'
>>> x.__repr__()
'array([0, 1, 2, 3])'
numpy.setbufsize   numpy.setbufsize(size)[source]
 
Set the size of the buffer used in ufuncs.  Parameters 
 
sizeint


Size of buffer.
numpy.setdiff1d   numpy.setdiff1d(ar1, ar2, assume_unique=False)[source]
 
Find the set difference of two arrays. Return the unique values in ar1 that are not in ar2.  Parameters 
 
ar1array_like


Input array.  
ar2array_like


Input comparison array.  
assume_uniquebool


If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.    Returns 
 
setdiff1dndarray


1D array of values in ar1 that are not in ar2. The result is sorted when assume_unique=False, but otherwise only sorted if the input is sorted.      See also  numpy.lib.arraysetops

Module with a number of other functions for performing set operations on arrays.    Examples >>> a = np.array([1, 2, 3, 2, 4, 1])
>>> b = np.array([3, 4, 5, 6])
>>> np.setdiff1d(a, b)
array([1, 2])
numpy.seterr   numpy.seterr(all=None, divide=None, over=None, under=None, invalid=None)[source]
 
Set how floating-point errors are handled. Note that operations on integer scalar types (such as int16) are handled like floating point, and are affected by these settings.  Parameters 
 
all{‘ignore’, ‘warn’, ‘raise’, ‘call’, ‘print’, ‘log’}, optional


Set treatment for all types of floating-point errors at once:  ignore: Take no action when the exception occurs. warn: Print a RuntimeWarning (via the Python warnings module). raise: Raise a FloatingPointError. call: Call a function specified using the seterrcall function. print: Print a warning directly to stdout. log: Record error in a Log object specified by seterrcall.  The default is not to change the current behavior.  
divide{‘ignore’, ‘warn’, ‘raise’, ‘call’, ‘print’, ‘log’}, optional


Treatment for division by zero.  
over{‘ignore’, ‘warn’, ‘raise’, ‘call’, ‘print’, ‘log’}, optional


Treatment for floating-point overflow.  
under{‘ignore’, ‘warn’, ‘raise’, ‘call’, ‘print’, ‘log’}, optional


Treatment for floating-point underflow.  
invalid{‘ignore’, ‘warn’, ‘raise’, ‘call’, ‘print’, ‘log’}, optional


Treatment for invalid floating-point operation.    Returns 
 
old_settingsdict


Dictionary containing the old settings.      See also  seterrcall

Set a callback function for the ‘call’ mode.  
geterr, geterrcall, errstate

  Notes The floating-point exceptions are defined in the IEEE 754 standard [1]:  Division by zero: infinite result obtained from finite numbers. Overflow: result too large to be expressed. Underflow: result so close to zero that some precision was lost. Invalid operation: result is not an expressible number, typically indicates that a NaN was produced.   1 
https://en.wikipedia.org/wiki/IEEE_754   Examples >>> old_settings = np.seterr(all='ignore')  #seterr to known value
>>> np.seterr(over='raise')
{'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'}
>>> np.seterr(**old_settings)  # reset to default
{'divide': 'ignore', 'over': 'raise', 'under': 'ignore', 'invalid': 'ignore'}
 >>> np.int16(32000) * np.int16(3)
30464
>>> old_settings = np.seterr(all='warn', over='raise')
>>> np.int16(32000) * np.int16(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
FloatingPointError: overflow encountered in short_scalars
 >>> old_settings = np.seterr(all='print')
>>> np.geterr()
{'divide': 'print', 'over': 'print', 'under': 'print', 'invalid': 'print'}
>>> np.int16(32000) * np.int16(3)
30464
numpy.seterrcall   numpy.seterrcall(func)[source]
 
Set the floating-point error callback function or log object. There are two ways to capture floating-point error messages. The first is to set the error-handler to ‘call’, using seterr. Then, set the function to call using this function. The second is to set the error-handler to ‘log’, using seterr. Floating-point errors then trigger a call to the ‘write’ method of the provided object.  Parameters 
 
funccallable f(err, flag) or object with write method


Function to call upon floating-point errors (‘call’-mode) or object whose ‘write’ method is used to log such message (‘log’-mode). The call function takes two arguments. The first is a string describing the type of error (such as “divide by zero”, “overflow”, “underflow”, or “invalid value”), and the second is the status flag. The flag is a byte, whose four least-significant bits indicate the type of error, one of “divide”, “over”, “under”, “invalid”: [0 0 0 0 divide over under invalid]
 In other words, flags = divide + 2*over + 4*under + 8*invalid. If an object is provided, its write method should take one argument, a string.    Returns 
 
hcallable, log instance or None


The old error handler.      See also  
seterr, geterr, geterrcall

  Examples Callback upon error: >>> def err_handler(type, flag):
...     print("Floating point error (%s), with flag %s" % (type, flag))
...
 >>> saved_handler = np.seterrcall(err_handler)
>>> save_err = np.seterr(all='call')
 >>> np.array([1, 2, 3]) / 0.0
Floating point error (divide by zero), with flag 1
array([inf, inf, inf])
 >>> np.seterrcall(saved_handler)
<function err_handler at 0x...>
>>> np.seterr(**save_err)
{'divide': 'call', 'over': 'call', 'under': 'call', 'invalid': 'call'}
 Log error message: >>> class Log:
...     def write(self, msg):
...         print("LOG: %s" % msg)
...
 >>> log = Log()
>>> saved_handler = np.seterrcall(log)
>>> save_err = np.seterr(all='log')
 >>> np.array([1, 2, 3]) / 0.0
LOG: Warning: divide by zero encountered in true_divide
array([inf, inf, inf])
 >>> np.seterrcall(saved_handler)
<numpy.core.numeric.Log object at 0x...>
>>> np.seterr(**save_err)
{'divide': 'log', 'over': 'log', 'under': 'log', 'invalid': 'log'}
numpy.seterrobj   numpy.seterrobj(errobj, /)
 
Set the object that defines floating-point error handling. The error object contains all information that defines the error handling behavior in NumPy. seterrobj is used internally by the other functions that set error handling behavior (seterr, seterrcall).  Parameters 
 
errobjlist


The error object, a list containing three elements: [internal numpy buffer size, error mask, error callback function]. The error mask is a single integer that holds the treatment information on all four floating point errors. The information for each error type is contained in three bits of the integer. If we print it in base 8, we can see what treatment is set for “invalid”, “under”, “over”, and “divide” (in that order). The printed string can be interpreted with  0 : ‘ignore’ 1 : ‘warn’ 2 : ‘raise’ 3 : ‘call’ 4 : ‘print’ 5 : ‘log’       See also  
geterrobj, seterr, geterr, seterrcall, geterrcall


getbufsize, setbufsize

  Notes For complete documentation of the types of floating-point exceptions and treatment options, see seterr. Examples >>> old_errobj = np.geterrobj()  # first get the defaults
>>> old_errobj
[8192, 521, None]
 >>> def err_handler(type, flag):
...     print("Floating point error (%s), with flag %s" % (type, flag))
...
>>> new_errobj = [20000, 12, err_handler]
>>> np.seterrobj(new_errobj)
>>> np.base_repr(12, 8)  # int for divide=4 ('print') and over=1 ('warn')
'14'
>>> np.geterr()
{'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'}
>>> np.geterrcall() is err_handler
True
numpy.setxor1d   numpy.setxor1d(ar1, ar2, assume_unique=False)[source]
 
Find the set exclusive-or of two arrays. Return the sorted, unique values that are in only one (not both) of the input arrays.  Parameters 
 
ar1, ar2array_like


Input arrays.  
assume_uniquebool


If True, the input arrays are both assumed to be unique, which can speed up the calculation. Default is False.    Returns 
 
setxor1dndarray


Sorted 1D array of unique values that are in only one of the input arrays.     Examples >>> a = np.array([1, 2, 3, 2, 4])
>>> b = np.array([2, 3, 5, 7, 5])
>>> np.setxor1d(a,b)
array([1, 4, 5, 7])
numpy.shape   numpy.shape(a)[source]
 
Return the shape of an array.  Parameters 
 
aarray_like


Input array.    Returns 
 
shapetuple of ints


The elements of the shape tuple give the lengths of the corresponding array dimensions.      See also  len
ndarray.shape

Equivalent array method.    Examples >>> np.shape(np.eye(3))
(3, 3)
>>> np.shape([[1, 2]])
(1, 2)
>>> np.shape([0])
(1,)
>>> np.shape(0)
()
 >>> a = np.array([(1, 2), (3, 4)], dtype=[('x', 'i4'), ('y', 'i4')])
>>> np.shape(a)
(2,)
>>> a.shape
(2,)
numpy.shares_memory   numpy.shares_memory(a, b, /, max_work=None)
 
Determine if two arrays share memory.  Warning This function can be exponentially slow for some inputs, unless max_work is set to a finite number or MAY_SHARE_BOUNDS. If in doubt, use numpy.may_share_memory instead.   Parameters 
 
a, bndarray


Input arrays  
max_workint, optional


Effort to spend on solving the overlap problem (maximum number of candidate solutions to consider). The following special values are recognized:  max_work=MAY_SHARE_EXACT (default)

The problem is solved exactly. In this case, the function returns True only if there is an element shared between the arrays. Finding the exact solution may take extremely long in some cases.  max_work=MAY_SHARE_BOUNDS

Only the memory bounds of a and b are checked.      Returns 
 
outbool

  Raises 
 numpy.TooHardError

Exceeded max_work.      See also  may_share_memory
  Examples >>> x = np.array([1, 2, 3, 4])
>>> np.shares_memory(x, np.array([5, 6, 7]))
False
>>> np.shares_memory(x[::2], x)
True
>>> np.shares_memory(x[::2], x[1::2])
False
 Checking whether two arrays share memory is NP-complete, and runtime may increase exponentially in the number of dimensions. Hence, max_work should generally be set to a finite number, as it is possible to construct examples that take extremely long to run: >>> from numpy.lib.stride_tricks import as_strided
>>> x = np.zeros([192163377], dtype=np.int8)
>>> x1 = as_strided(x, strides=(36674, 61119, 85569), shape=(1049, 1049, 1049))
>>> x2 = as_strided(x[64023025:], strides=(12223, 12224, 1), shape=(1049, 1049, 1))
>>> np.shares_memory(x1, x2, max_work=1000)
Traceback (most recent call last):
...
numpy.TooHardError: Exceeded max_work
 Running np.shares_memory(x1, x2) without max_work set takes around 1 minute for this case. It is possible to find problems that take still significantly longer.
class numpy.short[source]
 
Signed integer type, compatible with C short.  Character code 
'h'  Alias on this platform (Linux x86_64) 
numpy.int16: 16-bit signed integer (-32_768 to 32_767).
numpy.show_config   numpy.show_config()[source]
 
Show libraries in the system on which NumPy was built. Print information about various resources (libraries, library directories, include directories, etc.) in the system on which NumPy was built.  See also  get_include

Returns the directory containing NumPy C header files.    Notes  
Classes specifying the information to be printed are defined in the numpy.distutils.system_info module. Information may include:  
language: language used to write the libraries (mostly C or f77) 
libraries: names of libraries found in the system 
library_dirs: directories containing the libraries 
include_dirs: directories containing library header files 
src_dirs: directories containing library source files 
define_macros: preprocessor macros used by distutils.setup
 
baseline: minimum CPU features required 
found: dispatched features supported in the system 
not found: dispatched features that are not supported in the system   
NumPy BLAS/LAPACK Installation Notes Installing a numpy wheel (pip install numpy or force it via pip install numpy --only-binary :numpy: numpy) includes an OpenBLAS implementation of the BLAS and LAPACK linear algebra APIs. In this case, library_dirs reports the original build time configuration as compiled with gcc/gfortran; at run time the OpenBLAS library is in site-packages/numpy.libs/ (linux), or site-packages/numpy/.dylibs/ (macOS), or site-packages/numpy/.libs/ (windows). Installing numpy from source (pip install numpy --no-binary numpy) searches for BLAS and LAPACK dynamic link libraries at build time as influenced by environment variables NPY_BLAS_LIBS, NPY_CBLAS_LIBS, and NPY_LAPACK_LIBS; or NPY_BLAS_ORDER and NPY_LAPACK_ORDER; or the optional file ~/.numpy-site.cfg. NumPy remembers those locations and expects to load the same libraries at run-time. In NumPy 1.21+ on macOS, ‘accelerate’ (Apple’s Accelerate BLAS library) is in the default build-time search order after ‘openblas’.   Examples >>> import numpy as np
>>> np.show_config()
blas_opt_info:
    language = c
    define_macros = [('HAVE_CBLAS', None)]
    libraries = ['openblas', 'openblas']
    library_dirs = ['/usr/local/lib']
numpy.sign   numpy.sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'sign'>
 
Returns an element-wise indication of the sign of a number. The sign function returns -1 if x < 0, 0 if x==0, 1 if x > 0. nan is returned for nan inputs. For complex inputs, the sign function returns sign(x.real) + 0j if x.real != 0 else sign(x.imag) + 0j. complex(nan, 0) is returned for complex nan inputs.  Parameters 
 
xarray_like


Input values.  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
yndarray


The sign of x. This is a scalar if x is a scalar.     Notes There is more than one definition of sign in common use for complex numbers. The definition used here is equivalent to \(x/\sqrt{x*x}\) which is different from a common alternative, \(x/|x|\). Examples >>> np.sign([-5., 4.5])
array([-1.,  1.])
>>> np.sign(0)
0
>>> np.sign(5-2j)
(1+0j)
numpy.signbit   numpy.signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'signbit'>
 
Returns element-wise True where signbit is set (less than zero).  Parameters 
 
xarray_like


The input value(s).  
outndarray, None, or tuple of ndarray and None, optional


A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.  
wherearray_like, optional


This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.  **kwargs

For other keyword-only arguments, see the ufunc docs.    Returns 
 
resultndarray of bool


Output array, or reference to out if that was supplied. This is a scalar if x is a scalar.     Examples >>> np.signbit(-1.2)
True
>>> np.signbit(np.array([1, -2.3, 2.1]))
array([False,  True, False])