Dataset Viewer
Auto-converted to Parquet Duplicate
rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
"""Takes a PIL image and returns a copy of the image in a Numeric container. If the image is RGB returns a 3-dimensional array: arr[:,:,n] is each channel
"""Takes a PIL image and returns a copy of the image in a Numeric container. If the image is RGB returns a 3-dimensional array: arr[:,:,n] is each channel
def fromimage(im, flatten=0): """Takes a PIL image and returns a copy of the image in a Numeric container. If the image is RGB returns a 3-dimensional array: arr[:,:,n] is each channel Optional arguments: - flatten (0): if true, the image is flattened by calling convert('F') on the image object before extracting the...
8a6662fcba07c2c4d22f646995e8b6f3ab31d7ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8a6662fcba07c2c4d22f646995e8b6f3ab31d7ff/pilutil.py
- flatten (0): if true, the image is flattened by calling convert('F') on the image object before extracting the numerical data. This flattens the color layers into a single grayscale layer. Note that the supplied image object is NOT modified.
- flatten (0): if true, the image is flattened by calling convert('F') on the image object before extracting the numerical data. This flattens the color layers into a single grayscale layer. Note that the supplied image object is NOT modified.
def fromimage(im, flatten=0): """Takes a PIL image and returns a copy of the image in a Numeric container. If the image is RGB returns a 3-dimensional array: arr[:,:,n] is each channel Optional arguments: - flatten (0): if true, the image is flattened by calling convert('F') on the image object before extracting the...
8a6662fcba07c2c4d22f646995e8b6f3ab31d7ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8a6662fcba07c2c4d22f646995e8b6f3ab31d7ff/pilutil.py
print "di"
def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=np.nan): """ Initialize a 2D interpolator.
0fd926738190f2ebd369125b367fed04eae880c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0fd926738190f2ebd369125b367fed04eae880c8/interpolate.py
print self.x, self.y, self.z
def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=np.nan): """ Initialize a 2D interpolator.
0fd926738190f2ebd369125b367fed04eae880c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0fd926738190f2ebd369125b367fed04eae880c8/interpolate.py
expr = numexpr("2.0*a+3.0*c",[('a',float),('c', float)]) assert_array_equal(expr(a,c), 2.0*a+3.0*c) def check_all_scalar(self): a = 3. b = 4. assert_equal(evaluate("a+b"), a+b) expr = numexpr("2*a+3*b",[('a',float),('b', float)]) assert_equal(expr(a,b), 2*a+3*b) def check_run(self): a = arange(100).reshape(10,10)[::2...
def check_broadcasting(self): a = arange(100).reshape(10,10)[::2] c = arange(10) d = arange(5).reshape(5,1) assert_array_equal(evaluate("a+c"), a+c) assert_array_equal(evaluate("a+d"), a+d)
a98cf77a23aaabba56e1f91f8502448bd9dcae34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a98cf77a23aaabba56e1f91f8502448bd9dcae34/test_numexpr.py
def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csc_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M = amax(new.rowind) + 1
M = int(amax(new.rowind)) + 1
def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csc_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
new.data = new.data * other
new.data *= other
def __mul__(self, other): # implement matrix multiplication and matrix-vector multiplication if isspmatrix(other): return self.matmat(other) elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return self.matvec...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
def __rsub__(self, other): # implement other - self ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)] data1, data2 = _convert_data(self.data, ocs.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+'c...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other):
""" Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalar(other):
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
new.data = new.data * other
new.data = new.data ** other
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
new = csr_matrix(N,M,nzmax=0,dtype=self._dtypechar)
new = csr_matrix((N,M), nzmax=0, dtype=self._dtypechar)
def transpose(self, copy=False): M,N = self.shape new = csr_matrix(N,M,nzmax=0,dtype=self._dtypechar) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
elif isinstance(key,type(3)):
elif type(key) == int:
def __getitem__(self, key): if isinstance(key,types.TupleType): row = key[0] col = key[1] func = getattr(sparsetools,self.ftype+'cscgetel') M, N = self.shape if not (0<=row<M) or not (0<=col<N): raise KeyError, "Index out of bounds." ind, val = func(self.data, self.rowind, self.indptr, row, col) return val elif isinsta...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M, N = self.shape
def copy(self): M, N = self.shape dtype = self._dtypechar new = csc_matrix.Construct(M, N, nzmax=0, dtype=dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
new = csc_matrix.Construct(M, N, nzmax=0, dtype=dtype)
new = csc_matrix(self.shape, nzmax=0, dtype=dtype)
def copy(self): M, N = self.shape dtype = self._dtypechar new = csc_matrix.Construct(M, N, nzmax=0, dtype=dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
N = amax(new.colind) + 1
N = int(amax(new.colind)) + 1
def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csr_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M,N = self.shape
M, N = self.shape
def _check(self): M,N = self.shape nnz = self.indptr[-1] nzmax = len(self.colind) if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "Data, colind, and indptr arrays "\ "should be rank 1." if (len(self.data) != nzmax): raise ValueError, "Data and row list should have ...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
new.data = new.data * other
new.data *= other
def __mul__(self, other): # implement matrix multiplication and matrix-vector multiplication if isspmatrix(other): return self.matmat(other) elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return self.matvec...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
def __rsub__(self, other): # implement other - self ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,other._dtypechar)] data1, data2 = _convert_data(self.data, other.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other):
""" Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalar(other):
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
new.data = new.data * other
new.data = new.data ** other
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
elif isinstance(key,type(3)):
elif type(key) == int:
def __getitem__(self, key): if isinstance(key,types.TupleType): row = key[0] col = key[1] func = getattr(sparsetools,self.ftype+'cscgetel') M, N = self.shape if (row < 0): row = M + row if (col < 0): col = N + col if (row >= M ) or (col >= N) or (row < 0) or (col < 0): raise IndexError, "Index out of bounds." ind, val ...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M, N = self.shape new = csr_matrix(M, N, nzmax=0, dtype=self._dtypechar)
new = csr_matrix(self.shape, nzmax=0, dtype=self._dtypechar)
def copy(self): M, N = self.shape new = csr_matrix(M, N, nzmax=0, dtype=self._dtypechar) new.data = self.data.copy() new.colind = self.colind.copy() new.indptr = self.indptr.copy() new._check() return new
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
keys = self.keys()
def matvec(self, other): other = asarray(other) if other.shape[0] != self.shape[1]: raise ValueError, "Dimensions do not match." keys = self.keys() res = [0]*self.shape[0] for key in keys: res[int(key[0])] += self[key] * other[int(key[1]),...] return array(res)
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
for key in keys:
for key in self.keys():
def matvec(self, other): other = asarray(other) if other.shape[0] != self.shape[1]: raise ValueError, "Dimensions do not match." keys = self.keys() res = [0]*self.shape[0] for key in keys: res[int(key[0])] += self[key] * other[int(key[1]),...] return array(res)
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
keys = self.keys()
def rmatvec(self, other): other = asarray(other)
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
for key in keys:
for key in self.keys():
def rmatvec(self, other): other = asarray(other)
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M = amax(ij[0])
M = int(amax(ij[0]))
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
N = amax(ij[1])
N = int(amax(ij[1]))
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M = amax(aij[:,0])
M = int(amax(aij[:,0]))
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
N = amax(aij[:,1])
N = int(amax(aij[:,1]))
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M,N = A.shape
M, N = A.shape
def solve(A,b,permc_spec=2): if not hasattr(A, 'tocsr') and not hasattr(A, 'tocsc'): raise ValueError, "Sparse matrix must be able to return CSC format--"\ "A.tocsc()--or CSR format--A.tocsr()" if not hasattr(A,'shape'): raise ValueError, "Sparse matrix must be able to return shape (rows,cols) = A.shape" M,N = A.shape ...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
M,N = A.shape
M, N = A.shape
def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): M,N = A.shape if (M != N): raise ValueError, "Can only factor square matrices." csc = A.tocsc() gstrf = eval('_superlu.' + csc.ftype + 'gstrf') return gstrf(N,csc.nnz,csc.data,csc.rowind,csc.indptr,permc_spec, diag_pivot_thresh...
a2bf57fc75113a68b861da7355c48c019c1ddc40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a2bf57fc75113a68b861da7355c48c019c1ddc40/sparse.py
edges.update(zip(self.triangle_nodes[border[:,0]][:,1], self.triangle_nodes[border[:,0]][:,2])) edges.update(zip(self.triangle_nodes[border[:,1]][:,2], self.triangle_nodes[border[:,1]][:,0])) edges.update(zip(self.triangle_nodes[border[:,2]][:,0], self.triangle_nodes[border[:,2]][:,1]))
edges.update(dict(zip(self.triangle_nodes[border[:,0]][:,1], self.triangle_nodes[border[:,0]][:,2]))) edges.update(dict(zip(self.triangle_nodes[border[:,1]][:,2], self.triangle_nodes[border[:,1]][:,0]))) edges.update(dict(zip(self.triangle_nodes[border[:,2]][:,0], self.triangle_nodes[border[:,2]][:,1])))
def _compute_convex_hull(self): """Extract the convex hull from the triangulation information.
c210adcdba8dd94fdea864daa246de58ea492f77 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c210adcdba8dd94fdea864daa246de58ea492f77/triangulate.py
def configuration(parent_package='',parent_path=None): from scipy.distutils.system_info import get_info package = 'cluster' local_path = get_path(__name__,parent_path) config = Configuration(package,parent_package)
def configuration(parent_package='',top_path=None): from scipy.distutils.misc_util import Configuration config = Configuration('cluster',parent_package,top_path) config.add_data_dir('tests')
def configuration(parent_package='',parent_path=None): from scipy.distutils.system_info import get_info package = 'cluster' local_path = get_path(__name__,parent_path) config = Configuration(package,parent_package) config.add_extension('_vq', sources=[join('src', 'vq_wrap.cpp')]) return config
64d85ae8d3fb0f7cebd49730623ca86bac49fef6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/64d85ae8d3fb0f7cebd49730623ca86bac49fef6/setup.py
**configuration()
**configuration(top_path='').todict()
def configuration(parent_package='',parent_path=None): from scipy.distutils.system_info import get_info package = 'cluster' local_path = get_path(__name__,parent_path) config = Configuration(package,parent_package) config.add_extension('_vq', sources=[join('src', 'vq_wrap.cpp')]) return config
64d85ae8d3fb0f7cebd49730623ca86bac49fef6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/64d85ae8d3fb0f7cebd49730623ca86bac49fef6/setup.py
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'):
def __init__(self, freq, year=None, month=None, day=None, seconds=None,quarter=None, mxDate=None, val=None): if hasattr(freq, 'freq'):
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
elif date is not None: self.__date = date
elif mxDate is not None: self.__date = mxDate
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
if self.freq in ('B','D'):
if self.freq in ('B', 'D'):
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
def strfmt(self,fmt): qFmt = fmt.replace("%q","XXXX")
def strfmt(self, fmt): qFmt = fmt.replace("%q", "XXXX")
def strfmt(self,fmt): qFmt = fmt.replace("%q","XXXX") tmpStr = self.__date.strftime(qFmt) return tmpStr.replace("XXXX",str(self.quarter()))
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return tmpStr.replace("XXXX",str(self.quarter()))
return tmpStr.replace("XXXX", str(self.quarter()))
def strfmt(self,fmt): qFmt = fmt.replace("%q","XXXX") tmpStr = self.__date.strftime(qFmt) return tmpStr.replace("XXXX",str(self.quarter()))
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y")
if self.freq in ("B", "D"): return self.strfmt("%d-%b-%y")
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return self.__date.strftime("%d-%b-%Y %H:%M:%S")
return self.strfmt("%d-%b-%Y %H:%M:%S")
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return self.__date.strftime("%b-%Y")
return self.strfmt("%b-%Y")
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return str(self.year())+"q"+str(self.quarter())
return self.strfmt("%Yq%q")
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return str(self.year())
return self.strfmt("%Y")
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return self.__date.strftime("%d-%b-%y")
return self.strfmt("%d-%b-%y")
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
if self.freq <> other.freq: raise ValueError("Cannont subtract dates of different frequency (" + str(self.freq) + " <> " + str(other.freq) + ")")
if self.freq != other.freq: raise ValueError("Cannont subtract dates of different frequency (" + str(self.freq) + " != " + str(other.freq) + ")")
def __sub__(self, other): try: return self + (-1) * other except: pass try: if self.freq <> other.freq: raise ValueError("Cannont subtract dates of different frequency (" + str(self.freq) + " <> " + str(other.freq) + ")") return int(self) - int(other) except TypeError: raise TypeError("Could not subtract types " + str(...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
if self.freq <> other.freq:
if self.freq != other.freq:
def __eq__(self, other): if self.freq <> other.freq: raise TypeError("frequencies are not equal!") return int(self) == int(other)
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
if self.freq <> other.freq:
if self.freq != other.freq:
def __cmp__(self, other): if self.freq <> other.freq: raise TypeError("frequencies are not equal!") return int(self)-int(other)
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return Date(freq, date=tempDate)
return Date(freq, mxDate=tempDate)
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return Date(freq,tempDate.year,tempDate.month)
return Date(freq, year=tempDate.year, month=tempDate.month)
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return Date(freq,tempDate.year,quarter=monthToQuarter(tempDate.month))
return Date(freq, yaer=tempDate.year, quarter=monthToQuarter(tempDate.month))
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
return Date(freq,tempDate.year) def prevbusday(day_end_hour=18,day_end_min=0):
return Date(freq, year=tempDate.year) def prevbusday(day_end_hour=18, day_end_min=0):
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)...
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
def dateOf(_date,_destFreq,_relation="BEFORE"): _destFreq = corelib.fmtFreq(_destFreq) _rel = _relation.upper()[0] if _date.freq == _destFreq: return _date elif _date.freq == 'D': if _destFreq == 'B': tempDate = _date.mxDate() if _rel == "B":
def dateOf(date, toFreq, relation="BEFORE"): toFreq = corelib.fmtFreq(toFreq) _rel = relation.upper()[0] if date.freq == toFreq: return date elif date.freq == 'D': if toFreq == 'B': tempDate = date.mxDate() if _rel == 'B':
def prevbusday(day_end_hour=18,day_end_min=0): tempDate = mx.DateTime.localtime() dateNum = tempDate.hour + float(tempDate.minute)/60 checkNum = day_end_hour + float(day_end_min)/60 if dateNum < checkNum: return thisday('B') - 1 else: return thisday('B')
c207acc5c7f49d5bd86329331c20462583407dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c207acc5c7f49d5bd86329331c20462583407dd3/tsdate.py
'blas_src',blas_src_info['sources'],
'blas_src',blas_src_info['sources'] + \ [os.path.join(local_path,'src','fblaswrap.f')],
def configuration(parent_package=''): if sys.platform == 'win32': import scipy_distutils.mingw32_support from scipy_distutils.core import Extension from scipy_distutils.misc_util import get_path, default_config_dict from scipy_distutils.misc_util import fortran_library_item, dot_join from scipy_distutils.system_info ...
b1e1ccbf85736bc67a87e9364025451a1d59dadd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b1e1ccbf85736bc67a87e9364025451a1d59dadd/setup_linalg.py
sys.args.insert(0,'scipy_core')
sys.argv.insert(0,'scipy_core')
def get_package_config(name): sys.path.insert(0,os.path.join('scipy_core',name)) try: mod = __import__('setup_'+name) config = mod.configuration() finally: del sys.path[0] return config
b1e1ccbf85736bc67a87e9364025451a1d59dadd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b1e1ccbf85736bc67a87e9364025451a1d59dadd/setup_linalg.py
from scipy.special import binomcdf, binomcdfc, binomcdfinv, betacdf, betaq, fcdf, \ fcdfc, fp, gammacdf, gammacdfc, gammaq, negbinomcdf, negbinomcdfinv, \ possioncdf, poissioncdfc, possioncdfinv, studentcdf, studentq, \ chi2cdf, chi2cdfc, chi2p, normalcdf, normalq, smirnovcdfc, smirnovp, \ kolmogorovcdfc, kolmogorovp
def friedmanchisquare(*args): """
b5687aa43d7494456b3a512e58b25567d07f7305 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b5687aa43d7494456b3a512e58b25567d07f7305/stats.py
fcdfc, fp, gammacdf, gammacdfc, gammaq, negbinomcdf, negbinomcdfinv, \ possioncdf, poissioncdfc, possioncdfinv, studentcdf, studentq, \ chi2cdf, chi2cdfc, chi2p, normalcdf, normalq, smirnovcdfc, smirnovp, \ kolmogorovcdfc, kolmogorovp
fcdfc, fp, gammacdf, gammacdfc, gammaq, negbinomcdf, negbinomcdfinv from scipy.special import poissoncdf, poissoncdfc, poissoncdfinv, studentcdf, \ studentq, chi2cdf, chi2cdfc, chi2p, normalcdf, normalq, smirnovcdfc from scipy.special import smirnovp, kolmogorovcdfc, kolmogorovp
def friedmanchisquare(*args): """
576e0a3361df2e89cd086a66b330cb03edf197ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/576e0a3361df2e89cd086a66b330cb03edf197ae/stats.py
def __del__(self):
b7aff2a07a384ad500a3cb77f124eacba4d7ec26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b7aff2a07a384ad500a3cb77f124eacba4d7ec26/cox.py
lin = 1. + b * X
lin = 1 + b*X
def information(self, b, ties='breslow'):
b7aff2a07a384ad500a3cb77f124eacba4d7ec26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b7aff2a07a384ad500a3cb77f124eacba4d7ec26/cox.py
maxfun=None, full_output=0, disp=1, retall=0, callback=None):
maxfun=None, full_output=0, disp=1, retall=0, callback=None, direc=None):
def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None): """Minimize a function using modified Powell's method. Description: Uses a modification of Powell's method to find the minimum of a function of N variables Inputs: func -- the Python ...
8974d1f4da239d0c491cb9e9b4582fc60c0f37d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8974d1f4da239d0c491cb9e9b4582fc60c0f37d4/optimize.py
direc = eye(N,dtype=float)
if direc is None: direc = eye(N, dtype=float) else: direc = asarray(direc, dtype=float)
def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None): """Minimize a function using modified Powell's method. Description: Uses a modification of Powell's method to find the minimum of a function of N variables Inputs: func -- the Python ...
8974d1f4da239d0c491cb9e9b4582fc60c0f37d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8974d1f4da239d0c491cb9e9b4582fc60c0f37d4/optimize.py
print "Gegenbauer, a = ", a
def check_gegenbauer(self): a = 5*rand()-0.5 if any(a==0): a = -0.2 print "Gegenbauer, a = ", a Ca0 = gegenbauer(0,a) Ca1 = gegenbauer(1,a) Ca2 = gegenbauer(2,a) Ca3 = gegenbauer(3,a) Ca4 = gegenbauer(4,a) Ca5 = gegenbauer(5,a)
c578408812d8d2503357dbbbd47520ad7539cee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c578408812d8d2503357dbbbd47520ad7539cee1/test_basic.py
jc = jv(0,.1) assert_almost_equal(jc,0.99750156206604002,8)
values = [[0, 0.1, 0.99750156206604002], [2./3, 1e-8, 0.3239028506761532e-5], [2./3, 1e-10, 0.1503423854873779e-6], [3.1, 1e-10, 0.1711956265409013e-32], [2./3, 4.0, -0.2325440850267039], ] for i, (v, x, y) in enumerate(values): yc = jv(v, x) assert_almost_equal(yc, y, 8, err_msg='test
def check_jv(self): jc = jv(0,.1) assert_almost_equal(jc,0.99750156206604002,8)
c578408812d8d2503357dbbbd47520ad7539cee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c578408812d8d2503357dbbbd47520ad7539cee1/test_basic.py
maxnfeval : max. number of function evaluation
maxfun : max. number of function evaluation
def fmin_tnc(func, x0, fprime=None, args=(), approx_grad=False, bounds=None, epsilon=1e-8, scale=None, messages=MSG_ALL, maxCGit=-1, maxfun=None, eta=-1, stepmx=0, accuracy=0, fmin=0, ftol=0, rescale=-1): """Minimize a function with variables subject to bounds, using gradient information. returns (rc, nfeval, x). Inp...
3138646cae18d97c5f5303e1ff1e0679b7fa2422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3138646cae18d97c5f5303e1ff1e0679b7fa2422/tnc.py
up[i] = l
up[i] = u
def func_and_grad(x): x = asarray(x) f = func(x, *args) g = fprime(x, *args) return f, list(g)
3138646cae18d97c5f5303e1ff1e0679b7fa2422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3138646cae18d97c5f5303e1ff1e0679b7fa2422/tnc.py
rc, nf, x = minimize(function, [-7, 3], bounds=([-10, 10], [1, 10]))
rc, nf, x = fmin_tnc(function, [-7, 3], bounds=([-10, 10], [1, 10]))
def function(x): f = pow(x[0],2.0)+pow(abs(x[1]),3.0) g = [0,0] g[0] = 2.0*x[0] g[1] = 3.0*pow(abs(x[1]),2.0) if x[1]<0: g[1] = -g[1] return f, g
3138646cae18d97c5f5303e1ff1e0679b7fa2422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3138646cae18d97c5f5303e1ff1e0679b7fa2422/tnc.py
rc, nf, x = minimize(fg, x, bounds=bounds, messages = MSG_NONE, maxnfeval = 200)
rc, nf, x = fmin_tnc(fg, x, bounds=bounds, messages = MSG_NONE, maxnfeval = 200)
def test(fg, x, bounds, xopt): print "** Test", fg.__name__ rc, nf, x = minimize(fg, x, bounds=bounds, messages = MSG_NONE, maxnfeval = 200) print "After", nf, "function evaluations, TNC returned:", RCSTRINGS[rc] print "x =", x print "exact value =", xopt enorm = 0.0 norm = 1.0 for y,yo in zip(x, xopt): enorm += (y-yo...
3138646cae18d97c5f5303e1ff1e0679b7fa2422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3138646cae18d97c5f5303e1ff1e0679b7fa2422/tnc.py
assert isinstance(ij, ArrayType) and (rank(ij) == 2) and (shape(ij) == (len(s), 2))
assert isinstance(ij, ArrayType) and (rank(ij) == 2) \ and (shape(ij) == (2, len(s)))
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSC format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: #s = asarr...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
temp = coo_matrix((s, ij), dims=dims, dtype=dtype).tocsc()
ijnew = array(ij, copy=copy) temp = coo_matrix((s, ijnew), dims=dims, \ dtype=self.dtype).tocsc()
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSC format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: #s = asarr...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
a[ij[k, 0], ij[k, 1]] = data[k]
a[ij[0, k], ij[1, k]] = data[k]
def copy(self): new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
assert isinstance(ij, ArrayType) and (rank(ij) == 2) and (shape(ij) == (len(s), 2))
assert isinstance(ij, ArrayType) and (rank(ij) == 2) \ and (shape(ij) == (2, len(s)))
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
except: raise ValueError, "unrecognized form for csr_matrix constructor"
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
ijnew = ij.copy() ijnew[:, 0] = ij[:, 1] ijnew[:, 1] = ij[:, 0] temp = coo_matrix((s, ijnew), dims=dims, dtype=dtype).tocsr()
self.dtype = getdtype(dtype, s) ijnew = array([ij[1], ij[0]], copy=copy) temp = coo_matrix((s, ijnew), dims=dims, \ dtype=self.dtype).tocsr()
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
self.dtype = temp.dtype
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
A = coo_matrix(obj, ij, [dims])
A = coo_matrix((obj, ij), [dims])
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
ij[:][0] and ij[:][1]
ij[0][:] and ij[1][:]
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
1. obj[:]: the entries of the matrix, in any order 2. ij[:][0]: the row indices of the matrix entries 3. ij[:][1]: the column indices of the matrix entries
1. obj[:] the entries of the matrix, in any order 2. ij[0][:] the row indices of the matrix entries 3. ij[1][:] the column indices of the matrix entries
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
A[ij[k][0], ij[k][1]] = obj[k]
A[ij[0][k], ij[1][k] = obj[k]
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
obj, ij_in = arg1
obj, ij = arg1
def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): try: obj, ij_in = arg1 except: raise TypeError, "invalid input format" elif arg1 is None: # clumsy! We should make ALL arguments # keyword arguments instead! # Initialize an empty matrix. if not isinstance(dims, t...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
if len(ij_in) != 2: if isdense( ij_in ) and (ij_in.shape[1] == 2): ij = (ij_in[:,0], ij_in[:,1]) else: raise AssertionError else: ij = ij_in if dims is None: M = int(amax(ij[0])) + 1 N = int(amax(ij[1])) + 1 self.shape = (M, N) else: M, N = dims self.shape = (M, N) self.row = asarray(ij[0]) self.col = asarray(ij[1])...
if len(ij) != 2: raise TypeError except TypeError:
def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): try: obj, ij_in = arg1 except: raise TypeError, "invalid input format" elif arg1 is None: # clumsy! We should make ALL arguments # keyword arguments instead! # Initialize an empty matrix. if not isinstance(dims, t...
d5ad978cd0a938588df0380720c9a573220ef0f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5ad978cd0a938588df0380720c9a573220ef0f4/sparse.py
def complex(a, b, complex=__builtins__.complex): c = zeros(a.shape, dtype=complex)
def complex(a, b): c = zeros(a.shape, dtype=complex_)
def complex(a, b, complex=__builtins__.complex): c = zeros(a.shape, dtype=complex) c.real = a c.imag = b return c
5a55ddd6f5dccf6a603d032b045d6859a6e2a4f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5a55ddd6f5dccf6a603d032b045d6859a6e2a4f6/test_numexpr.py
tests.append(('OPERATIONS', optests))
def complex(a, b, complex=__builtins__.complex): c = zeros(a.shape, dtype=complex) c.real = a c.imag = b return c
5a55ddd6f5dccf6a603d032b045d6859a6e2a4f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5a55ddd6f5dccf6a603d032b045d6859a6e2a4f6/test_numexpr.py
x = random.randint(1,2**31-1)
x = random.randint(1,2**31-2)
def seed(x=0,y=0): """seed(x, y), set the seed using the integers x, y; Set a random one from clock if y == 0 """ if type (x) != types.IntType or type (y) != types.IntType : raise ArgumentError, "seed requires integer arguments." if y == 0: import random y = int(rv.initial_seed()) x = random.randint(1,2**31-1) rand.se...
dcca2a1be393d7a19d876d002c9ee41602d4cb5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/dcca2a1be393d7a19d876d002c9ee41602d4cb5f/distributions.py
self.isCSR = 1
self.isCSR = 0
def _getIndx( self, mtx ):
1ab51e60f923d1b3d3f9fae58333f00489f07b56 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1ab51e60f923d1b3d3f9fae58333f00489f07b56/umfpack.py
self.isCSR = 0
self.isCSR = 1
def _getIndx( self, mtx ):
1ab51e60f923d1b3d3f9fae58333f00489f07b56 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1ab51e60f923d1b3d3f9fae58333f00489f07b56/umfpack.py
"""Print all status information."""
"""Print all status information. Output depends on self.control[UMFPACK_PRL]."""
def report_info( self ): """Print all status information.""" self.funs.report_info( self.control, self.info )
1ab51e60f923d1b3d3f9fae58333f00489f07b56 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1ab51e60f923d1b3d3f9fae58333f00489f07b56/umfpack.py
assert rt == T, 'Expected %s, got %s type' % (T, rt)
assert N.dtype(rt) == N.dtype(T), \ 'Expected %s, got %s type' % (T, rt)
def test_smallest_int_sctype(self): # Smallest int sctype with testing recaster params = sctype_attributes() mmax = params[N.int32]['max'] mmin = params[N.int32]['min'] for kind in ('int', 'uint'): for T in N.sctypes[kind]: mx = params[T]['max'] mn = params[T]['min'] rt = self.recaster.smallest_int_sctype(mx, mn) if mx...
a701824a0efd9e5698d8a33c1423c306e04dc0b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a701824a0efd9e5698d8a33c1423c306e04dc0b4/test_recaster.py
## def __del__(self):
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
def __init__(self, parent):
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
panel = TestPanel(self)
self.panel = TestPanel(self)
def __init__(self, parent):
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
def __init__(self, parent):
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
def is_alive(obj): if obj() is None: return 0 else: return 1
def is_alive(obj): if obj() is None: return 0 else: return 1
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
time.sleep(0.25)
yield()
def check_wx_class(self): "Checking a wxFrame proxied class" for i in range(5): f = gui_thread.register(TestFrame) a = f(None) p = weakref.ref(a) a.Close(1) del a time.sleep(0.25) # sync threads # this checks for memory leaks self.assertEqual(is_alive(p), 0)
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
def check_normal_class(self): "Checking non-wxWindows proxied class " f = gui_thread.register(TestClass) a = f() p = weakref.ref(a) # the reference count has to be 2. self.assertEqual(sys.getrefcount(a), 2) del a self.assertEqual(is_alive(p), 0)
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
class NoThreadTestFrame(wxFrame):
class TesterApp (wxApp): def OnInit (self): f = TesterFrame(None) return true class TesterFrame(wxFrame):
def test(): all_tests = test_suite() runner = unittest.TextTestRunner(verbosity=2) runner.run(all_tests)
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
wxFrame.__init__(self, parent, -1, "Hello Test")
wxFrame.__init__(self, parent, -1, "Tester") self.CreateStatusBar() sizer = wxBoxSizer(wxHORIZONTAL) ID = NewId() btn = wxButton(self, ID, "Start Test") EVT_BUTTON(self, ID, self.OnStart) msg = "Click to start running tests. "\ "Tester Output will be shown on the shell." btn.SetToolTip(wxToolTip(msg)) sizer.Add(btn, 1...
def __init__(self, parent): wxFrame.__init__(self, parent, -1, "Hello Test") test() self.Close(1)
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
app = wxPySimpleApp() frame = NoThreadTestFrame(None)
app = TesterApp()
def __init__(self, parent): wxFrame.__init__(self, parent, -1, "Hello Test") test() self.Close(1)
10a9f586935a179066a0a38a59a0ccd013cd4a66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/10a9f586935a179066a0a38a59a0ccd013cd4a66/test_gui_thread.py
'libraries' : ['specfun']
'libraries' : ['specfun'], 'depends':specfun
def configuration(parent_package='',parent_path=None): from scipy_distutils.core import Extension from scipy_distutils.misc_util import get_path,\ default_config_dict, dot_join from scipy_distutils.system_info import dict_append, get_info package = 'special' config = default_config_dict(package,parent_package) local_p...
3e5294d3405d9e791160ac9b52973d66c8599116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3e5294d3405d9e791160ac9b52973d66c8599116/setup_special.py
End of preview. Expand in Data Studio

Dataset Card for CoCoNuT-Python(2010)

Dataset Summary

Part of the data used to train the models in the "CoCoNuT: Combining Context-Aware Neural Translation Models using Ensemble for Program Repair" paper. These datasets contain raw data extracted from GitHub, GitLab, and Bitbucket, and have neither been shuffled nor tokenized. The year in the dataset’s name is the cutting year that shows the year of the newest commit in the dataset.

Languages

  • Python

Dataset Structure

Data Fields

The dataset consists of 4 columns: add, rem, context, and meta. These match the original dataset files: add.txt, rem.txt, context.txt, and meta.txt.

Data Instances

There is a mapping between the 4 columns for each instance. For example:

5 first rows of rem (i.e., the buggy line/hunk):

1 public synchronized StringBuffer append(char ch)
2 ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this;
3 public String substring(int beginIndex, int endIndex)
4 if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex;  return new String(value, beginIndex + offset, len, (len << 2) >= value.length);
5 public Object next() {

5 first rows of add (i.e., the fixed line/hunk):

1 public StringBuffer append(Object obj)
2 return append(obj == null ? "null" : obj.toString());
3 public String substring(int begin)
4 return substring(begin, count);
5 public FSEntry next() {

These map to the 5 instances:

- public synchronized StringBuffer append(char ch)
+ public StringBuffer append(Object obj)
- ensureCapacity_unsynchronized(count + 1); value[count++] = ch; return this;
+ return append(obj == null ? "null" : obj.toString());
- public String substring(int beginIndex, int endIndex)
+ public String substring(int begin)
- if (beginIndex < 0 || endIndex > count || beginIndex > endIndex) throw new StringIndexOutOfBoundsException(); if (beginIndex == 0 && endIndex == count) return this; int len = endIndex - beginIndex;  return new String(value, beginIndex + offset, len, (len << 2) >= value.length);
+ return substring(begin, count);
- public Object next() {
+ public FSEntry next() { 

context contains the associated "context". Context is the (in-lined) buggy function (including the buggy lines and comments). For example, the context of

public synchronized StringBuffer append(char ch)

is its associated function:

public synchronized StringBuffer append(char ch)  {    ensureCapacity_unsynchronized(count + 1);    value[count++] = ch;    return this;  }

meta contains some metadata about the project:

1056	/local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/68a6301301378680519f2b146daec37812a1bc22/StringBuffer.java/buggy/core/src/classpath/java/java/lang/StringBuffer.java

1056 is the project id. /local/... is the absolute path to the buggy file. This can be parsed to extract the commit id: 68a6301301378680519f2b146daec37812a1bc22, the file name: StringBuffer.java and the original path within the project core/src/classpath/java/java/lang/StringBuffer.java

Number of projects Number of Instances
13,899 480,777

Dataset Creation

Curation Rationale

Data is collected to train automated program repair (APR) models.

Citation Information

@inproceedings{lutellierCoCoNuTCombiningContextaware2020,
  title = {{{CoCoNuT}}: Combining Context-Aware Neural Translation Models Using Ensemble for Program Repair},
  shorttitle = {{{CoCoNuT}}},
  booktitle = {Proceedings of the 29th {{ACM SIGSOFT International Symposium}} on {{Software Testing}} and {{Analysis}}},
  author = {Lutellier, Thibaud and Pham, Hung Viet and Pang, Lawrence and Li, Yitong and Wei, Moshi and Tan, Lin},
  year = {2020},
  month = jul,
  series = {{{ISSTA}} 2020},
  pages = {101--114},
  publisher = {{Association for Computing Machinery}},
  address = {{New York, NY, USA}},
  doi = {10.1145/3395363.3397369},
  url = {https://doi.org/10.1145/3395363.3397369},
  urldate = {2022-12-06},
  isbn = {978-1-4503-8008-9},
  keywords = {AI and Software Engineering,Automated program repair,Deep Learning,Neural Machine Translation}
}
Downloads last month
25

Collection including h4iku/coconut_python2010