neulab/docprompting-conala huggingface dataset:
numpy.DataSource   class numpy.DataSource(destpath='.')[source]
 
A generic data source file (file, http, ftp, …). DataSources can be local files or remote files/URLs. The files may also be compressed or uncompressed. DataSource hides some of the low-level details of downloading the file, allowing you to simply pass in a valid file path (or URL) and obtain a file object.  Parameters 
 
destpathstr or None, optional


Path to the directory where the source file gets downloaded to for use. If destpath is None, a temporary directory will be created. The default path is the current directory.     Notes URLs require a scheme string (http://) to be used, without it they will fail: >>> repos = np.DataSource()
>>> repos.exists('www.google.com/index.html')
False
>>> repos.exists('http://www.google.com/index.html')
True
 Temporary directories are deleted when the DataSource is deleted. Examples >>> ds = np.DataSource('/home/guido')
>>> urlname = 'http://www.google.com/'
>>> gfile = ds.open('http://www.google.com/')
>>> ds.abspath(urlname)
'/home/guido/www.google.com/index.html'

>>> ds = np.DataSource(None)  # use with temporary file
>>> ds.open('/home/guido/foobar.txt')
<open file '/home/guido.foobar.txt', mode 'r' at 0x91d4430>
>>> ds.abspath('/home/guido/foobar.txt')
'/tmp/.../home/guido/foobar.txt'
 Methods  
abspath(path) Return absolute path of file in the DataSource directory.  
exists(path) Test if path exists.  
open(path[, mode, encoding, newline]) Open and return file-like object.
class numpy.datetime64[source]
 
If created from a 64-bit integer, it represents an offset from 1970-01-01T00:00:00. If created from string, the string can be in ISO 8601 date or datetime format. >>> np.datetime64(10, 'Y')
numpy.datetime64('1980')
>>> np.datetime64('1980', 'Y')
numpy.datetime64('1980')
>>> np.datetime64(10, 'D')
numpy.datetime64('1970-01-11')
 See Datetimes and Timedeltas for more information.  Character code 
'M'
numpy.datetime_as_string   numpy.datetime_as_string(arr, unit=None, timezone='naive', casting='same_kind')
 
Convert an array of datetimes into an array of strings.  Parameters 
 
arrarray_like of datetime64


The array of UTC timestamps to format.  
unitstr


One of None, ‘auto’, or a datetime unit.  
timezone{‘naive’, ‘UTC’, ‘local’} or tzinfo


Timezone information to use when displaying the datetime. If ‘UTC’, end with a Z to indicate UTC time. If ‘local’, convert to the local timezone first, and suffix with a +-#### timezone offset. If a tzinfo object, then do as with ‘local’, but use the specified timezone.  
casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}


Casting to allow when changing between datetime units.    Returns 
 
str_arrndarray


An array of strings the same shape as arr.     Examples >>> import pytz
>>> d = np.arange('2002-10-27T04:30', 4*60, 60, dtype='M8[m]')
>>> d
array(['2002-10-27T04:30', '2002-10-27T05:30', '2002-10-27T06:30',
       '2002-10-27T07:30'], dtype='datetime64[m]')
 Setting the timezone to UTC shows the same information, but with a Z suffix >>> np.datetime_as_string(d, timezone='UTC')
array(['2002-10-27T04:30Z', '2002-10-27T05:30Z', '2002-10-27T06:30Z',
       '2002-10-27T07:30Z'], dtype='<U35')
 Note that we picked datetimes that cross a DST boundary. Passing in a pytz timezone object will print the appropriate offset >>> np.datetime_as_string(d, timezone=pytz.timezone('US/Eastern'))
array(['2002-10-27T00:30-0400', '2002-10-27T01:30-0400',
       '2002-10-27T01:30-0500', '2002-10-27T02:30-0500'], dtype='<U39')
 Passing in a unit will change the precision >>> np.datetime_as_string(d, unit='h')
array(['2002-10-27T04', '2002-10-27T05', '2002-10-27T06', '2002-10-27T07'],
      dtype='<U32')
>>> np.datetime_as_string(d, unit='s')
array(['2002-10-27T04:30:00', '2002-10-27T05:30:00', '2002-10-27T06:30:00',
       '2002-10-27T07:30:00'], dtype='<U38')
 ‘casting’ can be used to specify whether precision can be changed >>> np.datetime_as_string(d, unit='h', casting='safe')
Traceback (most recent call last):
    ...
TypeError: Cannot create a datetime string as units 'h' from a NumPy
datetime with units 'm' according to the rule 'safe'
numpy.datetime_data   numpy.datetime_data(dtype, /)
 
Get information about the step size of a date or time type. The returned tuple can be passed as the second argument of numpy.datetime64 and numpy.timedelta64.  Parameters 
 
dtypedtype


The dtype object, which must be a datetime64 or timedelta64 type.    Returns 
 
unitstr


The datetime unit on which this dtype is based.  
countint


The number of base units in a step.     Examples >>> dt_25s = np.dtype('timedelta64[25s]')
>>> np.datetime_data(dt_25s)
('s', 25)
>>> np.array(10, dt_25s).astype('timedelta64[s]')
array(250, dtype='timedelta64[s]')
 The result can be used to construct a datetime that uses the same units as a timedelta >>> np.datetime64('2010', np.datetime_data(dt_25s))
numpy.datetime64('2010-01-01T00:00:00','25s')
numpy.deg2rad   numpy.deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'deg2rad'>
 
Convert angles from degrees to radians.  Parameters 
 
xarray_like


Angles in degrees.  
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 corresponding angle in radians. This is a scalar if x is a scalar.      See also  rad2deg

Convert angles from radians to degrees.  unwrap

Remove large jumps in angle by wrapping.    Notes  New in version 1.3.0.  deg2rad(x) is x * pi / 180. Examples >>> np.deg2rad(180)
3.1415926535897931
numpy.degrees   numpy.degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'degrees'>
 
Convert angles from radians to degrees.  Parameters 
 
xarray_like


Input array in radians.  
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 of floats


The corresponding degree values; if out was supplied this is a reference to it. This is a scalar if x is a scalar.      See also  rad2deg

equivalent function    Examples Convert a radian array to degrees >>> rad = np.arange(12.)*np.pi/6
>>> np.degrees(rad)
array([   0.,   30.,   60.,   90.,  120.,  150.,  180.,  210.,  240.,
        270.,  300.,  330.])
 >>> out = np.zeros((rad.shape))
>>> r = np.degrees(rad, out)
>>> np.all(r == out)
True
numpy.delete   numpy.delete(arr, obj, axis=None)[source]
 
Return a new array with sub-arrays along an axis deleted. For a one dimensional array, this returns those entries not returned by arr[obj].  Parameters 
 
arrarray_like


Input array.  
objslice, int or array of ints


Indicate indices of sub-arrays to remove along the specified axis.  Changed in version 1.19.0: Boolean indices are now treated as a mask of elements to remove, rather than being cast to the integers 0 and 1.   
axisint, optional


The axis along which to delete the subarray defined by obj. If axis is None, obj is applied to the flattened array.    Returns 
 
outndarray


A copy of arr with the elements specified by obj removed. Note that delete does not occur in-place. If axis is None, out is a flattened array.      See also  insert

Insert elements into an array.  append

Append elements at the end of an array.    Notes Often it is preferable to use a boolean mask. For example: >>> arr = np.arange(12) + 1
>>> mask = np.ones(len(arr), dtype=bool)
>>> mask[[0,2,4]] = False
>>> result = arr[mask,...]
 Is equivalent to np.delete(arr, [0,2,4], axis=0), but allows further use of mask. Examples >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])
>>> arr
array([[ 1,  2,  3,  4],
       [ 5,  6,  7,  8],
       [ 9, 10, 11, 12]])
>>> np.delete(arr, 1, 0)
array([[ 1,  2,  3,  4],
       [ 9, 10, 11, 12]])
 >>> np.delete(arr, np.s_[::2], 1)
array([[ 2,  4],
       [ 6,  8],
       [10, 12]])
>>> np.delete(arr, [1,3,5], None)
array([ 1,  3,  5,  7,  8,  9, 10, 11, 12])
numpy.deprecate   numpy.deprecate(*args, **kwargs)[source]
 
Issues a DeprecationWarning, adds warning to old_name’s docstring, rebinds old_name.__name__ and returns the new function object. This function may also be used as a decorator.  Parameters 
 
funcfunction


The function to be deprecated.  
old_namestr, optional


The name of the function to be deprecated. Default is None, in which case the name of func is used.  
new_namestr, optional


The new name for the function. Default is None, in which case the deprecation message is that old_name is deprecated. If given, the deprecation message is that old_name is deprecated and new_name should be used instead.  
messagestr, optional


Additional explanation of the deprecation. Displayed in the docstring after the warning.    Returns 
 
old_funcfunction


The deprecated function.     Examples Note that olduint returns a value after printing Deprecation Warning: >>> olduint = np.deprecate(np.uint)
DeprecationWarning: `uint64` is deprecated! # may vary
>>> olduint(6)
6
numpy.deprecate_with_doc   numpy.deprecate_with_doc(msg)[source]
 
Deprecates a function and includes the deprecation in its docstring. This function is used as a decorator. It returns an object that can be used to issue a DeprecationWarning, by passing the to-be decorated function as argument, this adds warning to the to-be decorated function’s docstring and returns the new function object.  Parameters 
 
msgstr


Additional explanation of the deprecation. Displayed in the docstring after the warning.    Returns 
 
objobject

    See also  deprecate

Decorate a function such that it issues a DeprecationWarning
numpy.diag   numpy.diag(v, k=0)[source]
 
Extract a diagonal or construct a diagonal array. See the more detailed documentation for numpy.diagonal if you use this function to extract a diagonal and wish to write to the resulting array; whether it returns a copy or a view depends on what version of numpy you are using.  Parameters 
 
varray_like


If v is a 2-D array, return a copy of its k-th diagonal. If v is a 1-D array, return a 2-D array with v on the k-th diagonal.  
kint, optional


Diagonal in question. The default is 0. Use k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal.    Returns 
 
outndarray


The extracted diagonal or constructed diagonal array.      See also  diagonal

Return specified diagonals.  diagflat

Create a 2-D array with the flattened input as a diagonal.  trace

Sum along diagonals.  triu

Upper triangle of an array.  tril

Lower triangle of an array.    Examples >>> x = np.arange(9).reshape((3,3))
>>> x
array([[0, 1, 2],
       [3, 4, 5],
       [6, 7, 8]])
 >>> np.diag(x)
array([0, 4, 8])
>>> np.diag(x, k=1)
array([1, 5])
>>> np.diag(x, k=-1)
array([3, 7])
 >>> np.diag(np.diag(x))
array([[0, 0, 0],
       [0, 4, 0],
       [0, 0, 8]])
numpy.diag_indices   numpy.diag_indices(n, ndim=2)[source]
 
Return the indices to access the main diagonal of an array. This returns a tuple of indices that can be used to access the main diagonal of an array a with a.ndim >= 2 dimensions and shape (n, n, …, n). For a.ndim = 2 this is the usual diagonal, for a.ndim > 2 this is the set of indices to access a[i, i, ..., i] for i = [0..n-1].  Parameters 
 
nint


The size, along each dimension, of the arrays for which the returned indices can be used.  
ndimint, optional


The number of dimensions.      See also  diag_indices_from
  Notes  New in version 1.4.0.  Examples Create a set of indices to access the diagonal of a (4, 4) array: >>> di = np.diag_indices(4)
>>> di
(array([0, 1, 2, 3]), array([0, 1, 2, 3]))
>>> a = np.arange(16).reshape(4, 4)
>>> a
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11],
       [12, 13, 14, 15]])
>>> a[di] = 100
>>> a
array([[100,   1,   2,   3],
       [  4, 100,   6,   7],
       [  8,   9, 100,  11],
       [ 12,  13,  14, 100]])
 Now, we create indices to manipulate a 3-D array: >>> d3 = np.diag_indices(2, 3)
>>> d3
(array([0, 1]), array([0, 1]), array([0, 1]))
 And use it to set the diagonal of an array of zeros to 1: >>> a = np.zeros((2, 2, 2), dtype=int)
>>> a[d3] = 1
>>> a
array([[[1, 0],
        [0, 0]],
       [[0, 0],
        [0, 1]]])
numpy.diag_indices_from   numpy.diag_indices_from(arr)[source]
 
Return the indices to access the main diagonal of an n-dimensional array. See diag_indices for full details.  Parameters 
 
arrarray, at least 2-D

    See also  diag_indices
  Notes  New in version 1.4.0.
numpy.diagflat   numpy.diagflat(v, k=0)[source]
 
Create a two-dimensional array with the flattened input as a diagonal.  Parameters 
 
varray_like


Input data, which is flattened and set as the k-th diagonal of the output.  
kint, optional


Diagonal to set; 0, the default, corresponds to the “main” diagonal, a positive (negative) k giving the number of the diagonal above (below) the main.    Returns 
 
outndarray


The 2-D output array.      See also  diag

MATLAB work-alike for 1-D and 2-D arrays.  diagonal

Return specified diagonals.  trace

Sum along diagonals.    Examples >>> np.diagflat([[1,2], [3,4]])
array([[1, 0, 0, 0],
       [0, 2, 0, 0],
       [0, 0, 3, 0],
       [0, 0, 0, 4]])
 >>> np.diagflat([1,2], 1)
array([[0, 1, 0],
       [0, 0, 2],
       [0, 0, 0]])
numpy.diff   numpy.diff(a, n=1, axis=-1, prepend=<no value>, append=<no value>)[source]
 
Calculate the n-th discrete difference along the given axis. The first difference is given by out[i] = a[i+1] - a[i] along the given axis, higher differences are calculated by using diff recursively.  Parameters 
 
aarray_like


Input array  
nint, optional


The number of times values are differenced. If zero, the input is returned as-is.  
axisint, optional


The axis along which the difference is taken, default is the last axis.  
prepend, appendarray_like, optional


Values to prepend or append to a along axis prior to performing the difference. Scalar values are expanded to arrays with length 1 in the direction of axis and the shape of the input array in along all other axes. Otherwise the dimension and shape must match a except along axis.  New in version 1.16.0.     Returns 
 
diffndarray


The n-th differences. The shape of the output is the same as a except along axis where the dimension is smaller by n. The type of the output is the same as the type of the difference between any two elements of a. This is the same as the type of a in most cases. A notable exception is datetime64, which results in a timedelta64 output array.      See also  
gradient, ediff1d, cumsum

  Notes Type is preserved for boolean arrays, so the result will contain False when consecutive elements are the same and True when they differ. For unsigned integer arrays, the results will also be unsigned. This should not be surprising, as the result is consistent with calculating the difference directly: >>> u8_arr = np.array([1, 0], dtype=np.uint8)
>>> np.diff(u8_arr)
array([255], dtype=uint8)
>>> u8_arr[1,...] - u8_arr[0,...]
255
 If this is not desirable, then the array should be cast to a larger integer type first: >>> i16_arr = u8_arr.astype(np.int16)
>>> np.diff(i16_arr)
array([-1], dtype=int16)
 Examples >>> x = np.array([1, 2, 4, 7, 0])
>>> np.diff(x)
array([ 1,  2,  3, -7])
>>> np.diff(x, n=2)
array([  1,   1, -10])
 >>> x = np.array([[1, 3, 6, 10], [0, 5, 6, 8]])
>>> np.diff(x)
array([[2, 3, 4],
       [5, 1, 2]])
>>> np.diff(x, axis=0)
array([[-1,  2,  0, -2]])
 >>> x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64)
>>> np.diff(x)
array([1, 1], dtype='timedelta64[D]')
numpy.digitize   numpy.digitize(x, bins, right=False)[source]
 
Return the indices of the bins to which each value in input array belongs.   
right order of bins returned index i satisfies   
False increasing bins[i-1] <= x < bins[i]  
True increasing bins[i-1] < x <= bins[i]  
False decreasing bins[i-1] > x >= bins[i]  
True decreasing bins[i-1] >= x > bins[i]   If values in x are beyond the bounds of bins, 0 or len(bins) is returned as appropriate.  Parameters 
 
xarray_like


Input array to be binned. Prior to NumPy 1.10.0, this array had to be 1-dimensional, but can now have any shape.  
binsarray_like


Array of bins. It has to be 1-dimensional and monotonic.  
rightbool, optional


Indicating whether the intervals include the right or the left bin edge. Default behavior is (right==False) indicating that the interval does not include the right edge. The left bin end is open in this case, i.e., bins[i-1] <= x < bins[i] is the default behavior for monotonically increasing bins.    Returns 
 
indicesndarray of ints


Output array of indices, of same shape as x.    Raises 
 ValueError

If bins is not monotonic.  TypeError

If the type of the input is complex.      See also  
bincount, histogram, unique, searchsorted

  Notes If values in x are such that they fall outside the bin range, attempting to index bins with the indices that digitize returns will result in an IndexError.  New in version 1.10.0.  np.digitize is implemented in terms of np.searchsorted. This means that a binary search is used to bin the values, which scales much better for larger number of bins than the previous linear search. It also removes the requirement for the input array to be 1-dimensional. For monotonically _increasing_ bins, the following are equivalent: np.digitize(x, bins, right=True)
np.searchsorted(bins, x, side='left')
 Note that as the order of the arguments are reversed, the side must be too. The searchsorted call is marginally faster, as it does not do any monotonicity checks. Perhaps more importantly, it supports all dtypes. Examples >>> x = np.array([0.2, 6.4, 3.0, 1.6])
>>> bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0])
>>> inds = np.digitize(x, bins)
>>> inds
array([1, 4, 3, 2])
>>> for n in range(x.size):
...   print(bins[inds[n]-1], "<=", x[n], "<", bins[inds[n]])
...
0.0 <= 0.2 < 1.0
4.0 <= 6.4 < 10.0
2.5 <= 3.0 < 4.0
1.0 <= 1.6 < 2.5
 >>> x = np.array([1.2, 10.0, 12.4, 15.5, 20.])
>>> bins = np.array([0, 5, 10, 15, 20])
>>> np.digitize(x,bins,right=True)
array([1, 2, 3, 4, 4])
>>> np.digitize(x,bins,right=False)
array([1, 3, 3, 4, 5])
numpy.disp   numpy.disp(mesg, device=None, linefeed=True)[source]
 
Display a message on a device.  Parameters 
 
mesgstr


Message to display.  
deviceobject


Device to write message. If None, defaults to sys.stdout which is very similar to print. device needs to have write() and flush() methods.  
linefeedbool, optional


Option whether to print a line feed or not. Defaults to True.    Raises 
 AttributeError

If device does not have a write() or flush() method.     Examples Besides sys.stdout, a file-like object can also be used as it has both required methods: >>> from io import StringIO
>>> buf = StringIO()
>>> np.disp(u'"Display" in a file', device=buf)
>>> buf.getvalue()
'"Display" in a file\n'
numpy.distutils.ccompiler Functions  
CCompiler_compile(self, sources[, ...]) Compile one or more source files.  
CCompiler_customize(self, dist[, need_cxx]) Do any platform-specific customization of a compiler instance.  
CCompiler_customize_cmd(self, cmd[, ignore]) Customize compiler using distutils command.  
CCompiler_cxx_compiler(self) Return the C++ compiler.  
CCompiler_find_executables(self) Does nothing here, but is called by the get_version method and can be overridden by subclasses.  
CCompiler_get_version(self[, force, ok_status]) Return compiler version, or None if compiler is not available.  
CCompiler_object_filenames(self, ...[, ...]) Return the name of the object files for the given source files.  
CCompiler_show_customization(self) Print the compiler customizations to stdout.  
CCompiler_spawn(self, cmd[, display, env]) Execute a command in a sub-process.  
gen_lib_options(compiler, library_dirs, ...)   
new_compiler([plat, compiler, verbose, ...])   
replace_method(klass, method_name, func)   
simple_version_match([pat, ignore, start]) Simple matching of version numbers, for use in CCompiler and FCompiler.
numpy.distutils.ccompiler_opt Provides the CCompilerOpt class, used for handling the CPU/hardware optimization, starting from parsing the command arguments, to managing the relation between the CPU baseline and dispatch-able features, also generating the required C headers and ending with compiling the sources with proper compiler’s flags. CCompilerOpt doesn’t provide runtime detection for the CPU features, instead only focuses on the compiler side, but it creates abstract C headers that can be used later for the final runtime dispatching process. Functions  
new_ccompiler_opt(compiler, dispatch_hpath, ...) Create a new instance of 'CCompilerOpt' and generate the dispatch header which contains the #definitions and headers of platform-specific instruction-sets for the enabled CPU baseline and dispatch-able features.   Classes  
CCompilerOpt(ccompiler[, cpu_baseline, ...]) A helper class for CCompiler aims to provide extra build options to effectively control of compiler optimizations that are directly related to CPU features.
numpy.distutils.core.Extension   class numpy.distutils.core.Extension(name, sources, include_dirs=None, define_macros=None, undef_macros=None, library_dirs=None, libraries=None, runtime_library_dirs=None, extra_objects=None, extra_compile_args=None, extra_link_args=None, export_symbols=None, swig_opts=None, depends=None, language=None, f2py_options=None, module_dirs=None, extra_c_compile_args=None, extra_cxx_compile_args=None, extra_f77_compile_args=None, extra_f90_compile_args=None)[source]
 
 Parameters 
 
namestr


Extension name.  
sourceslist of str


List of source file locations relative to the top directory of the package.  
extra_compile_argslist of str


Extra command line arguments to pass to the compiler.  
extra_f77_compile_argslist of str


Extra command line arguments to pass to the fortran77 compiler.  
extra_f90_compile_argslist of str


Extra command line arguments to pass to the fortran90 compiler.     Methods  
has_cxx_sources   
has_f2py_sources
numpy.distutils.misc_util.allpath(name)[source]
 
Convert a /-separated pathname to one using the OS’s path separator.
numpy.distutils.misc_util.cyg2win32(path: str) → str[source]
 
Convert a path from Cygwin-native to Windows-native. Uses the cygpath utility (part of the Base install) to do the actual conversion. Falls back to returning the original path if this fails. Handles the default /cygdrive mount prefix as well as the /proc/cygdrive portable prefix, custom cygdrive prefixes such as / or /mnt, and absolute paths such as /usr/src/ or /home/username  Parameters 
 
pathstr


The path to convert    Returns 
 
converted_pathstr


The converted path     Notes Documentation for cygpath utility: https://cygwin.com/cygwin-ug-net/cygpath.html Documentation for the C function it wraps: https://cygwin.com/cygwin-api/func-cygwin-conv-path.html
numpy.distutils.misc_util.default_config_dict(name=None, parent_name=None, local_path=None)[source]
 
Return a configuration dictionary for usage in configuration() function defined in file setup_<name>.py.