rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.warn('not existing data path in %s: %s' \ | self.warn('not existing path in %s: %s' \ | def _fix_paths(self,paths,include_non_existing=True): assert is_sequence(paths), repr(type(paths)) new_paths = [] for n in paths: if isinstance(n,str): if '*' in n or '?' in n: p = glob.glob(n) p2 = glob.glob(njoin(self.local_path,n)) if p2: new_paths.extend(p2) elif p: new_paths.extend(p) else: if include_non_existing... |
new_args = [] for a in args: if type(a) is type(''): a = ppimport(a) if hasattr(a,'_ppimport_importer') or \ hasattr(a,'_ppimport_module'): a = a._ppimport_module if hasattr(a,'_ppimport_attr'): a = a._ppimport_attr new_args.append(a) return _old_pydoc_help_call(self, *new_args, **kwds) | return _old_pydoc_help_call(self, *map(realize,args), **kwds) | def _scipy_pydoc_help_call(self,*args,**kwds): new_args = [] for a in args: if type(a) is type(''): a = ppimport(a) if hasattr(a,'_ppimport_importer') or \ hasattr(a,'_ppimport_module'): a = a._ppimport_module if hasattr(a,'_ppimport_attr'): a = a._ppimport_attr new_args.append(a) return _old_pydoc_help_call(self, *new... |
dirs = d.split(os.pathsep) + dirs | ds = d.split(os.pathsep) ds2 = [] for d in ds: if os.path.isdir(d): ds2.append(d) for dd in ['include','lib']: d1 = os.path.join(d,dd) if os.path.isdir(d1): ds2.append(d1) dirs = ds2 + dirs | def get_paths(self, section, key): dirs = self.cp.get(section, key).split(os.pathsep) if self.dir_env_var and os.environ.has_key(self.dir_env_var): d = os.environ[self.dir_env_var] if d=='None': print 'Disabled',self.__class__.__name__,'(%s is None)' % (self.dir_env_var) return [] if os.path.isfile(d): dirs = [os.path.... |
atlas_1 = None | def calc_info(self): lib_dirs = self.get_lib_dirs() info = {} atlas_libs = self.get_libs('atlas_libs', self._lib_names + ['atlas']) atlas = None atlas_1 = None for d in lib_dirs: atlas = self.check_libs(d,atlas_libs,[]) if atlas is not None: lib_dirs2 = self.combine_paths(d,['atlas*','ATLAS*'])+[d] if atlas: atlas_1 = ... | |
lib_dirs2 = self.combine_paths(d,['atlas*','ATLAS*'])+[d] if atlas: atlas_1 = atlas print self.__class__ if atlas is None: atlas = atlas_1 | break | def calc_info(self): lib_dirs = self.get_lib_dirs() info = {} atlas_libs = self.get_libs('atlas_libs', self._lib_names + ['atlas']) atlas = None atlas_1 = None for d in lib_dirs: atlas = self.check_libs(d,atlas_libs,[]) if atlas is not None: lib_dirs2 = self.combine_paths(d,['atlas*','ATLAS*'])+[d] if atlas: atlas_1 = ... |
s = N.ndarray.sum(self, axis, dtype) if axis==1: return s.transpose() else: return s | return N.ndarray.sum(self, axis, dtype)._align(axis) | def sum(self, axis=None, dtype=None): """Sum the matrix over the given axis. If the axis is None, sum over all dimensions. This preserves the orientation of the result as a row or column. """ s = N.ndarray.sum(self, axis, dtype) if axis==1: return s.transpose() else: return s |
s = N.ndarray.mean(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.mean(self, axis)._align(axis) | def mean(self, axis=None): s = N.ndarray.mean(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.std(self, axis, dtype) if axis==1: return s.transpose() else: return s | return N.ndarray.std(self, axis, dtype)._align(axis) | def std(self, axis=None, dtype=None): s = N.ndarray.std(self, axis, dtype) if axis==1: return s.transpose() else: return s |
s = N.ndarray.var(self, axis, dtype) if axis==1: return s.transpose() else: return s | return N.ndarray.var(self, axis, dtype)._align(axis) | def var(self, axis=None, dtype=None): s = N.ndarray.var(self, axis, dtype) if axis==1: return s.transpose() else: return s |
s = N.ndarray.prod(self, axis, dtype) if axis==1: return s.transpose() else: return s | return N.ndarray.prod(self, axis, dtype)._align(axis) | def prod(self, axis=None, dtype=None): s = N.ndarray.prod(self, axis, dtype) if axis==1: return s.transpose() else: return s |
s = N.ndarray.any(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.any(self, axis)._align(axis) | def any(self, axis=None): s = N.ndarray.any(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.all(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.all(self, axis)._align(axis) | def all(self, axis=None): s = N.ndarray.all(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.max(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.max(self, axis)._align(axis) | def max(self, axis=None): s = N.ndarray.max(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.argmax(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.argmax(self, axis)._align(axis) | def argmax(self, axis=None): s = N.ndarray.argmax(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.min(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.min(self, axis)._align(axis) | def min(self, axis=None): s = N.ndarray.min(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.argmin(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.argmin(self, axis)._align(axis) | def argmin(self, axis=None): s = N.ndarray.argmin(self, axis) if axis==1: return s.transpose() else: return s |
s = N.ndarray.ptp(self, axis) if axis==1: return s.transpose() else: return s | return N.ndarray.ptp(self, axis)._align(axis) | def ptp(self, axis=None): s = N.ndarray.ptp(self, axis) if axis==1: return s.transpose() else: return s |
status = spawn_command(os.P_WAIT,argv[0],argv,os.environ) | status = spawn_command(os.P_WAIT,argv0,argv,os.environ) | def _exec_command( command, use_shell=None, **env ): log.debug('_exec_command(...)') if use_shell is None: use_shell = os.name=='posix' using_command = 0 if use_shell: # We use shell (unless use_shell==0) so that wildcards can be # used. sh = os.environ.get('SHELL','/bin/sh') if type(command) is type([]): argv = [sh,... |
else: | elif 0: | def test_nt(**kws): pythonexe = get_pythonexe() echo = find_executable('echo') using_cygwin_echo = echo != 'echo' if using_cygwin_echo: log.warn('Using cygwin echo in win32 environment is not supported') s,o=exec_command(pythonexe\ +' -c "import os;print os.environ.get(\'AAA\',\'\')"') assert s==0 and o=='',(s,o) s,... |
raise FortranCompileError, 'failure during compile' | raise FortranCompileError,\ 'failure during compile (exit status = %s)' % failure | def f_compile(self,compiler,switches, source_files, module_dirs=None, temp_dir=''): |
output_dir='', debug=None): | output_dir='', debug=None, skip_ranlib=0): | def create_static_lib(self, object_files, library_name, output_dir='', debug=None): lib_file = os.path.join(output_dir, self.lib_prefix+library_name+self.lib_suffix) objects = string.join(object_files) if objects: cmd = '%s%s %s' % (self.lib_ar,lib_file,objects) print yellow_text(cmd) os.system(cmd) if self.lib_ranlib:... |
os.system(cmd) if self.lib_ranlib: | failure = os.system(cmd) if failure: raise FortranBuildError,\ 'failure during build (exit status = %s)'%failure if self.lib_ranlib and not skip_ranlib: | def create_static_lib(self, object_files, library_name, output_dir='', debug=None): lib_file = os.path.join(output_dir, self.lib_prefix+library_name+self.lib_suffix) objects = string.join(object_files) if objects: cmd = '%s%s %s' % (self.lib_ar,lib_file,objects) print yellow_text(cmd) os.system(cmd) if self.lib_ranlib:... |
os.system(cmd) | failure = os.system(cmd) if failure: raise FortranBuildError,\ 'failure during build (exit status = %s)'%failure | def create_static_lib(self, object_files, library_name, output_dir='', debug=None): lib_file = os.path.join(output_dir, self.lib_prefix+library_name+self.lib_suffix) objects = string.join(object_files) if objects: cmd = '%s%s %s' % (self.lib_ar,lib_file,objects) print yellow_text(cmd) os.system(cmd) if self.lib_ranlib:... |
if os.name == 'nt': | if 1 or os.name == 'nt' or sys.platform[:4] == 'irix': | def build_library(self,library_name,source_list,module_dirs=None, temp_dir = ''): #make sure the temp directory exists before trying to build files import distutils.dir_util distutils.dir_util.mkpath(temp_dir) |
obj,objects = objects[:20],objects[20:] self.create_static_lib(obj,library_name,temp_dir) | i = 0 obj = [] while i<1900 and objects: i = i + len(objects[0]) + 1 obj.append(objects[0]) objects = objects[1:] self.create_static_lib(obj,library_name,temp_dir, skip_ranlib = len(objects)) | def build_library(self,library_name,source_list,module_dirs=None, temp_dir = ''): #make sure the temp directory exists before trying to build files import distutils.dir_util distutils.dir_util.mkpath(temp_dir) |
lib_ranlib = '' | def get_extra_link_args(self): return ['-mimpure-text'] | |
pattern_list = d.split(os.sep) | pattern_list = pp + d.split(os.sep) | def add_data_dir(self,data_path): """ Recursively add files under data_path to data_files list. Argument can be either - 2-sequence (<datadir suffix>,<path to data directory>) - path to data directory where python datadir suffix defaults to package dir. |
i += 1 | def add_data_dir(self,data_path): """ Recursively add files under data_path to data_files list. Argument can be either - 2-sequence (<datadir suffix>,<path to data directory>) - path to data directory where python datadir suffix defaults to package dir. | |
shape = shape[nn:] | shape = shape[:-nn] | def fromarrays(arrayList, dtype=None, shape=None, formats=None, names=None, titles=None, aligned=False, byteorder=None): """ create a record array from a (flat) list of arrays >>> x1=array([1,2,3,4]) >>> x2=array(['a','dd','xyz','12']) >>> x3=array([1.1,2,3,4]) >>> r=fromarrays([x1,x2,x3],names='a,b,c') >>> print r[1]... |
if obj.shape[nn:] != shape: | testshape = obj.shape[:len(obj.shape)-nn] if testshape != shape: | def fromarrays(arrayList, dtype=None, shape=None, formats=None, names=None, titles=None, aligned=False, byteorder=None): """ create a record array from a (flat) list of arrays >>> x1=array([1,2,3,4]) >>> x2=array(['a','dd','xyz','12']) >>> x3=array([1.1,2,3,4]) >>> r=fromarrays([x1,x2,x3],names='a,b,c') >>> print r[1]... |
def atlas_version_c(extension, build_dir,macig=magic): | def atlas_version_c(extension, build_dir,magic=magic): | def atlas_version_c(extension, build_dir,macig=magic): source = os.path.join(build_dir,'atlas_version_%s.c' % (magic)) if os.path.isfile(source): from distutils.dep_util import newer if newer(source,__file__): return source f = open(source,'w') f.write(atlas_version_c_text) f.close() return source |
The 2d fft of a. This is really just fftnd with different default | The 2d fft of a. This is really just fftn with different default | def fft2(a, s=None, axes=(-2,-1)): """fft2(a, s=None, axes=(-2,-1)) The 2d fft of a. This is really just fftnd with different default behavior.""" return _raw_fftnd(a,s,axes,fft) |
The inverse of fft2d. This is really just inverse_fftnd with different | The inverse of fft2d. This is really just ifftn with different | def ifft2(a, s=None, axes=(-2,-1)): """ifft2(a, s=None, axes=(-2, -1)) The inverse of fft2d. This is really just inverse_fftnd with different default behavior.""" return _raw_fftnd(a, s, axes, ifft) |
if self.info.get('arch','')=='IA-64': | if self.info[0].get('arch','')=='IA-64': | def _is_64bit(self): if self.is_Alpha(): return 1 if self.info[0].get('clflush size','')=='64': return 1 if self.info[0]['uname_m']=='x86_64': return 1 if self.info.get('arch','')=='IA-64': return 1 return 0 |
if not _globalvar and self.dtype.char not in 'SU': | if not _globalvar and self.dtype.char not in 'SUb': | def __array_finalize__(self, obj): if not _globalvar and self.dtype.char not in 'SU': raise ValueError, "Can only create a chararray from string data." |
if res: return self.getfield(*res[:2]) | if res: obj = self.getfield(*res[:2]) if obj.dtype.fields: return obj.view(recarray) if obj.dtype.char in 'SU': return obj.view(chararray) return obj | def __getattribute__(self, attr): if attr in ['setfield', 'getfield', 'dtype']: return nt.void.__getattribute__(self, attr) try: return nt.void.__getattribute__(self, attr) except AttributeError: pass fielddict = nt.void.__getattribute__(self, 'dtype').fields res = fielddict.get(attr,None) if res: return self.getfield(... |
self.f90_switches = ' -fixed -pic' | self.f90_switches = ' -pic' | def __init__(self, fc=None, f90c=None, verbose=0): fortran_compiler_base.__init__(self, verbose=verbose) |
self.library_dirs = self.find_lib_dir() | if self.is_available(): self.library_dirs = self.find_lib_dir() | def __init__(self, fc=None, f90c=None, verbose=0): fortran_compiler_base.__init__(self, verbose=verbose) |
if libs[0] == "(null)": | if libs and libs[0] == "(null)": | def find_lib_dir(self): library_dirs = ["/opt/SUNWspro/prod/lib"] lib_match = r'### f90: Note: LD_RUN_PATH\s*= '\ '(?P<lib_paths>[^\s.]*).*' cmd = self.f90_compiler + ' -dryrun dummy.f' self.announce(yellow_text(cmd)) exit_status, output = run_command(cmd) if not exit_status: libs = re.findall(lib_match,output) if libs... |
self._lib_names + ['atlas']) lapack_libs = self.get_libs('lapack_libs',['lapack']) | self._lib_names + self._lib_atlas) lapack_libs = self.get_libs('lapack_libs',self._lib_lapack) | def calc_info(self): lib_dirs = self.get_lib_dirs() info = {} atlas_libs = self.get_libs('atlas_libs', self._lib_names + ['atlas']) lapack_libs = self.get_libs('lapack_libs',['lapack']) atlas = None lapack = None atlas_1 = None for d in lib_dirs: atlas = self.check_libs(d,atlas_libs,[]) lapack_atlas = self.check_libs(d... |
self._lib_names + ['atlas']) | self._lib_names + self._lib_atlas) | def calc_info(self): lib_dirs = self.get_lib_dirs() info = {} atlas_libs = self.get_libs('atlas_libs', self._lib_names + ['atlas']) atlas = None for d in lib_dirs: atlas = self.check_libs(d,atlas_libs,[]) if atlas is not None: break if atlas is None: return include_dirs = self.get_include_dirs() h = (self.combine_paths... |
from scipy.distutils.core import setup from scipy.distutils.misc_util import Configuration | from numpy.distutils.core import setup from numpy.distutils.misc_util import Configuration | def setup_package(): from scipy.distutils.core import setup from scipy.distutils.misc_util import Configuration old_path = os.getcwd() local_path = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(local_path) sys.path.insert(0,local_path) try: config = Configuration( maintainer = "SciPy Developers", maintainer... |
description = "Core SciPy", | description = DOCLINES[0], long_description = "\n".join(DOCLINES[2:]), | def setup_package(): from scipy.distutils.core import setup from scipy.distutils.misc_util import Configuration old_path = os.getcwd() local_path = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(local_path) sys.path.insert(0,local_path) try: config = Configuration( maintainer = "SciPy Developers", maintainer... |
config.add_subpackage('scipy') | config.add_subpackage('numpy') | def setup_package(): from scipy.distutils.core import setup from scipy.distutils.misc_util import Configuration old_path = os.getcwd() local_path = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(local_path) sys.path.insert(0,local_path) try: config = Configuration( maintainer = "SciPy Developers", maintainer... |
from scipy.core_version import version config.name = 'scipy_core' | from numpy.version import version config.name = 'numpy' | def setup_package(): from scipy.distutils.core import setup from scipy.distutils.misc_util import Configuration old_path = os.getcwd() local_path = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(local_path) sys.path.insert(0,local_path) try: config = Configuration( maintainer = "SciPy Developers", maintainer... |
result.append(('','|V%d' % (field[1]-offset))) | num = field[1] - offset result.append(('','|V%d' % num)) offset += num | def _array_descr(descriptor): fields = descriptor.fields if fields is None: return descriptor.str names = descriptor.names ordered_fields = [fields[x] + (x,) for x in names] result = [] offset = 0 for field in ordered_fields: if field[1] > offset: result.append(('','|V%d' % (field[1]-offset))) if len(field) > 3: name ... |
newfunc.__dict__.update(func.__dict__) | try: d = func.__dict__ except AttributeError: pass else: newfunc.__dict__.update(d) | def newfunc(*args,**kwds): warnings.warn("%s is deprecated, use %s" % (oldname, newname), DeprecationWarning) return func(*args, **kwds) |
Inputs: doc_titles - a list to be filled with strings of package documentation titles. | def __init__(self): """ Manages loading SciPy packages. Inputs: | |
buf=None, offset=0, strides=None, byteorder=_sysbyte, | buf=None, offset=0, strides=None, byteorder=None, | def __new__(subtype, shape, formats, names=None, titles=None, buf=None, offset=0, strides=None, byteorder=_sysbyte, aligned=0): |
parsed = format_parser(formats, names, titles, aligned, byteorder) | parsed = format_parser(formats, names, titles, aligned) | def __new__(subtype, shape, formats, names=None, titles=None, buf=None, offset=0, strides=None, byteorder=_sysbyte, aligned=0): |
byteorder=_sysbyte, aligned=0, offset=0): | byteorder=None, aligned=0, offset=0): | def fromstring(datastring, formats, shape=None, names=None, titles=None, byteorder=_sysbyte, aligned=0, offset=0): """ create a (read-only) record array from binary data contained in a string""" parsed = format_parser(formats, names, titles, aligned) itemsize = parsed._descr.itemsize if (shape is None or shape == 0 or... |
byteorder=_sysbyte, aligned=0, offset=0): | byteorder=None, aligned=0, offset=0): | def fromfile(fd, formats, shape=None, names=None, titles=None, byteorder=_sysbyte, aligned=0, offset=0): """Create an array from binary file data If file is a string then that file is opened, else it is assumed to be a file object. No options at the moment, all file positioning must be done prior to this function call... |
parsed = format_parser(formats, names, titles, aligned, byteorder) | parsed = format_parser(formats, names, titles, aligned) | def fromfile(fd, formats, shape=None, names=None, titles=None, byteorder=_sysbyte, aligned=0, offset=0): """Create an array from binary file data If file is a string then that file is opened, else it is assumed to be a file object. No options at the moment, all file positioning must be done prior to this function call... |
return None | def atlas_version_c(extension, build_dir,magic=magic): source = os.path.join(build_dir,'atlas_version_%s.c' % (magic)) if os.path.isfile(source): from distutils.dep_util import newer if newer(source,__file__): return source f = open(source,'w') f.write(atlas_version_c_text) f.close() return source | |
info_files.append(os.path.join(self.parent_path,package,'info.py')) | info_file = os.path.join(self.parent_path,package,'info.py') if not os.path.isfile(info_file): info_file += 'c' if os.path.isfile(info_file): info_files.append(info_file) else: if self.verbose: print >> sys.stderr, 'Package',`package`,\ 'does not have info.py file. Ignoring.' | def _init_info_modules(self, packages=None): """Initialize info_modules = {<package_name>: <package info.py module>}. """ import imp from glob import glob if packages is None: info_files = glob(os.path.join(self.parent_path,'*','info.py')) else: info_files = [] for package in packages: package = os.path.join(*package.s... |
open(info_file,'U'), info_file, ('.py','U',1)) | open(info_file,filedescriptor[1]), info_file, filedescriptor) | def _init_info_modules(self, packages=None): """Initialize info_modules = {<package_name>: <package info.py module>}. """ import imp from glob import glob if packages is None: info_files = glob(os.path.join(self.parent_path,'*','info.py')) else: info_files = [] for package in packages: package = os.path.join(*package.s... |
verbose = options.get('verbose',False) | self.verbose = verbose = options.get('verbose',False) | def __call__(self,*packages, **options): """Load one or more packages into scipy's top-level namespace. |
from fcompiler import new_fcompiler | from numpy.distutils.fcompiler import new_fcompiler | def get_flags_debug(self): return ['/debug'] |
beta. It depends on numpy.special (in full numpy) for the modified bessel function i0. | beta. | def kaiser(M,beta): """kaiser(M, beta) returns a Kaiser window of length M with shape parameter beta. It depends on numpy.special (in full numpy) for the modified bessel function i0. """ from numpy.dual import i0 n = arange(0,M) alpha = (M-1)/2.0 return i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/i0(beta) |
If dtype.char is not None and | If dtype is not None and | def size (object, axis=None): return fromnumeric.size(filled(object), axis) |
class forte_fortran_compiler(sun_compiler_compiler): | class forte_fortran_compiler(sun_fortran_compiler): | def get_linker_so(self): return [self.f90_compiler,'-Bdynamic','-G'] |
% (`name`,`parent_name`,`local_path`)) | % (`name`,`parent_name`,`local_path`, `name`,`parent_name`,`local_path`, )) | def default_config_dict(name = None, parent_name = None, local_path=None): """ Return a configuration dictionary for usage in configuration() function defined in file setup_<name>.py. """ import warnings warnings.warn('Use Configuration(%s,%s,top_path=%s) instead of '\ 'deprecated default_config_dict(%s,%s,%s)' \ % (`n... |
if any(isreal(x) & x<0): | if any(isreal(x) & (x<0)): | def _fix_real_lt_zero(x): x = asarray(x) if any(isreal(x) & x<0): x = _tocomplex(x) return x |
idx = unravel_index(p) | idx = unravel_index(p,x.shape) | def unravel_index(x,dims): """Convert a flat index into an index tuple for an array of given shape. e.g. for a 2x2 array, unravel_index(2,(2,2)) returns (1,0). Example usage: p = x.argmax() idx = unravel_index(p) x[idx] == x.max() Note: x.flat[p] == x.max() Thus, it may be easier to use flattened indexing than to ... |
self.__dict__ = attr.__dict__ | try: self.__dict__ = attr.__dict__ except AttributeError: pass | def _ppimport_attr_getter(self): attr = getattr(self.__dict__['_ppimport_attr_module'], self.__dict__['_ppimport_attr_name']) self.__dict__ = attr.__dict__ self.__dict__['_ppimport_attr'] = attr return attr |
location = _is_local_module(p_dir, name, ('.py','.pyc','.pyo')) if location is None: so_ext = _get_so_ext() location = _is_local_module(p_dir, name, (so_ext,'module'+so_ext)) if location is None: | so_ext = _get_so_ext() py_exts = ('.py','.pyc','.pyo') so_exts = (so_ext,'module'+so_ext) for d,n,fn,e in [\ (p_dir, name, fullname, py_exts+so_exts), | def ppimport(name): """ ppimport(name) -> module or module wrapper If name has been imported before, return module. Otherwise return ModuleLoader instance that transparently postpones module import until the first attempt to access module name attributes. """ p_frame = _get_frame(1) p_name = p_frame.f_locals['__name__... |
location = _is_local_module(os.path.join(p_dir, name), '__init__', ('.py','.pyc','.pyo')) | (os.path.join(p_dir, name), '__init__', fullname, py_exts), (os.path.join(os.path.dirname(p_dir), name), '__init__', name, py_exts), ]: location = _is_local_module(d, n, e) if location is not None: fullname = fn break | def ppimport(name): """ ppimport(name) -> module or module wrapper If name has been imported before, return module. Otherwise return ModuleLoader instance that transparently postpones module import until the first attempt to access module name attributes. """ p_frame = _get_frame(1) p_name = p_frame.f_locals['__name__... |
% (package_name,self._obj2str(new_object), self._obj2str(old_object))) | % (package_name,self._obj2repr(new_object), self._obj2repr(old_object))) | def __call__(self,*packages, **options): """Load one or more packages into numpy's top-level namespace. |
""" | def test_divide(self): with errstate(all='raise', under='ignore'): a = -arange(3) # This should work with errstate(divide='ignore'): a / 0 # While this should fail! try: a / 0 except FloatingPointError: pass else: self.fail() | |
ll=m.group('after') | ll=m.group('after').strip() | def analyzeline(m,case,line): global groupcounter,groupname,groupcache,grouplist,filepositiontext,\ currentfilename,f77modulename,neededinterface,neededmodule,expectbegin,\ gotnextfile,previous_context block=m.group('this') if case != 'multiline': previous_context = None if expectbegin and case not in ['begin','call','... |
assert result.stream.data[-1]=='E',`result.stream.data` result.stream.data[-1] = 'i' del result.errors[-1] | if l==1: assert result.stream.data[-1]=='E',`result.stream.data` result.stream.data[-1] = 'i' del result.errors[-1] else: assert result.stream.data[-1]=='ERROR\n',`result.stream.data` result.stream.data[-1] = 'ignoring\n' del result.errors[-1] elif errstr.startswith('HideException:'): if l==1: assert result.stream.data... | def __call__(self, result=None): if result is None: return unittest.TestCase.__call__(self, result) |
libs = ['rfftw', 'fftw'] includes = ['fftw.h','rfftw.h'] macros = [('SCIPY_FFTW_H',None)] | def combine_paths(self,*args): return combine_paths(*args,**{'verbosity':self.verbosity}) | |
def calc_info(self): | def calc_ver_info(self,ver_param): """Returns True on successful version detection, else False""" | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
libs = self.get_libs(self.section+'_libs', self.libs) | libs = self.get_libs(self.section+'_libs', ver_param['libs']) | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
if len(self.combine_paths(d,self.includes))==2: | if len(self.combine_paths(d,ver_param['includes']))==len(ver_param['includes']): | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
dict_append(info,define_macros=self.macros) | dict_append(info,define_macros=ver_param['macros']) | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
libs = ['drfftw','dfftw'] includes = ['dfftw.h','drfftw.h'] macros = [('SCIPY_DFFTW_H',None)] | ver_info = [ { 'name':'dfftw', 'libs':['drfftw','dfftw'], 'includes':['dfftw.h','drfftw.h'], 'macros':[('SCIPY_DFFTW_H',None)]} ] | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
libs = ['srfftw','sfftw'] includes = ['sfftw.h','srfftw.h'] macros = [('SCIPY_SFFTW_H',None)] | ver_info = [ { 'name':'sfftw', 'libs':['srfftw','sfftw'], 'includes':['sfftw.h','srfftw.h'], 'macros':[('SCIPY_SFFTW_H',None)]} ] | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
libs = ['rfftw_threads','fftw_threads'] includes = ['fftw_threads.h','rfftw_threads.h'] macros = [('SCIPY_FFTW_THREADS_H',None)] | ver_info = [ { 'name':'fftw threads', 'libs':['rfftw_threads','fftw_threads'], 'includes':['fftw_threads.h','rfftw_threads.h'], 'macros':[('SCIPY_FFTW_THREADS_H',None)]} ] | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
libs = ['drfftw_threads','dfftw_threads'] includes = ['dfftw_threads.h','drfftw_threads.h'] macros = [('SCIPY_DFFTW_THREADS_H',None)] | ver_info = [ { 'name':'dfftw threads', 'libs':['drfftw_threads','dfftw_threads'], 'includes':['dfftw_threads.h','drfftw_threads.h'], 'macros':[('SCIPY_DFFTW_THREADS_H',None)]} ] | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
libs = ['srfftw_threads','sfftw_threads'] includes = ['sfftw_threads.h','srfftw_threads.h'] macros = [('SCIPY_SFFTW_THREADS_H',None)] | ver_info = [ { 'name':'sfftw threads', 'libs':['srfftw_threads','sfftw_threads'], 'includes':['sfftw_threads.h','srfftw_threads.h'], 'macros':[('SCIPY_SFFTW_THREADS_H',None)]} ] | def calc_info(self): lib_dirs = self.get_lib_dirs() incl_dirs = self.get_include_dirs() incl_dir = None libs = self.get_libs(self.section+'_libs', self.libs) info = None for d in lib_dirs: r = self.check_libs(d,libs) if r is not None: info = r break if info is not None: flag = 0 for d in incl_dirs: if len(self.combine_... |
return masked_array(umath.fromstring(s, t)) | return masked_array(numeric.fromstring(s, t)) | def fromstring (s, t): "Construct a masked array from a string. Result will have no mask." return masked_array(umath.fromstring(s, t)) |
d = umath.reshape(filled(a), *newshape) | d = filled(a).reshape(*newshape) | def reshape (a, *newshape): "Copy of a with a new shape." m = getmask(a) d = umath.reshape(filled(a), *newshape) if m is None: return masked_array(d) else: return masked_array(d, mask=numeric.reshape(m, *newshape)) |
return object.__getattr__(self, attr) | return object.__getattribute__(self, attr) | def __getattr__(self,attr): if (attr == 'array'): return object.__getattr__(self, attr) return self.array.__getattribute__(attr) |
if release_level: scipy_core_version = '%(major)d.%(minor)d.%(micro)d'\ '_%(release_level)s'\ '_%(cvs_minor)d.%(cvs_serial)d' % (locals ()) | if cvs_minor or cvs_serial: if release_level: scipy_core_version = '%(major)d.%(minor)d.%(micro)d'\ '_%(release_level)s'\ '_%(cvs_minor)d.%(cvs_serial)d' % (locals ()) else: scipy_core_version = '%(major)d.%(minor)d.%(micro)d'\ '_%(cvs_minor)d.%(cvs_serial)d' % (locals ()) | def setup_package(): old_path = os.getcwd() local_path = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(local_path) sys.path.insert(0, local_path) try: configs = [{'name':'Scipy_core'}] versions = [] for n in bundle_packages: sys.path.insert(0,os.path.join(local_path,n)) try: mod = __import__('setup_'+n) confi... |
scipy_core_version = '%(major)d.%(minor)d.%(micro)d'\ '_%(cvs_minor)d.%(cvs_serial)d' % (locals ()) | if release_level: scipy_core_version = '%(major)d.%(minor)d.%(micro)d'\ '_%(release_level)s'\ % (locals ()) else: scipy_core_version = '%(major)d.%(minor)d.%(micro)d'\ % (locals ()) | def setup_package(): old_path = os.getcwd() local_path = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(local_path) sys.path.insert(0, local_path) try: configs = [{'name':'Scipy_core'}] versions = [] for n in bundle_packages: sys.path.insert(0,os.path.join(local_path,n)) try: mod = __import__('setup_'+n) confi... |
if lib_dir not in self.compiler.libraries_dirs: | if lib_dir not in self.compiler.library_dirs: | def build_extension(self, ext): #XXX: anything else we need to save? save_linker_so = self.compiler.linker_so save_compiler_libs = self.compiler.libraries save_compiler_libs_dirs = self.compiler.library_dirs # support for building static fortran libraries need_f_libs = 0 ext_name = string.split(ext.name,'.')[-1] |
assert_equal(amax(b, axis=0),[8.0,10.0,9.0]) | assert_equal(amax(b),[8.0,10.0,9.0]) | def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amax(a),10.0) b = [[3,6.0, 9.0], [4,10.0,5.0], [8,3.0,2.0]] assert_equal(amax(b, axis=0),[8.0,10.0,9.0]) assert_equal(amax(b,axis=1),[9.0,10.0,8.0]) assert_equal(amax(b,axis=-1),[9.0,10.0,8.0]) |
assert_equal(amax(b,axis=-1),[9.0,10.0,8.0]) | def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amax(a),10.0) b = [[3,6.0, 9.0], [4,10.0,5.0], [8,3.0,2.0]] assert_equal(amax(b, axis=0),[8.0,10.0,9.0]) assert_equal(amax(b,axis=1),[9.0,10.0,8.0]) assert_equal(amax(b,axis=-1),[9.0,10.0,8.0]) | |
assert_equal(amin(b,axis=0),[3.0,3.0,2.0]) | assert_equal(amin(b),[3.0,3.0,2.0]) | def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amin(a),-5.0) b = [[3,6.0, 9.0], [4,10.0,5.0], [8,3.0,2.0]] assert_equal(amin(b,axis=0),[3.0,3.0,2.0]) assert_equal(amin(b,axis=1),[3.0,4.0,2.0]) assert_equal(amin(b),[3.0,4.0,2.0]) |
assert_equal(amin(b),[3.0,4.0,2.0]) | def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amin(a),-5.0) b = [[3,6.0, 9.0], [4,10.0,5.0], [8,3.0,2.0]] assert_equal(amin(b,axis=0),[3.0,3.0,2.0]) assert_equal(amin(b,axis=1),[3.0,4.0,2.0]) assert_equal(amin(b),[3.0,4.0,2.0]) | |
restore_path() | def check_test_interning(self): a0 = bool_(0) b0 = bool_(False) self.failUnless(a0 is b0) a1 = bool_(1) b1 = bool_(True) self.failUnless(a1 is b1) self.failUnless(array([True])[0] is a1) self.failUnless(array(True)[...] is a1) | |
buffer=buf, swap=swap) | buffer=buf, offset=offset, swap=swap) | def __new__(subtype, shape, formats, names=None, titles=None, buf=None, offset=0, strides=None, byteorder=_sysbyte, aligned=0): |
new = data.view(matrix) | new = data.view(subtype) | def __new__(subtype, data, dtype=None, copy=True): if isinstance(data, matrix): dtype2 = data.dtype if (dtype is None): dtype = dtype2 if (dtype2 == dtype) and (not copy): return data return data.astype(dtype) |
>>> deletefrom(arr, 1) | >>> deletefrom(arr, 1, 0) | def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem... |
try: wrap = arr.__array_wrap__ except AttributeError: wrap = None | wrap = None if type(arr) is not ndarray: try: wrap = arr.__array_wrap__ except AttributeError: pass | def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem... |
slobj[axis] = slice(ojb+1,None) new[slobj] = arr[slobj2] if wrap: return wrap(new) return new | slobj2[axis] = slice(obj+1,None) new[slobj] = arr[slobj2] | def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem... |
all = arange(N, dtype=intp) | all = arange(start, stop, dtype=intp) | def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem... |
if wrap: return wrap(new) return new obj = array(obj, dtype=intp, copy=0, ndmin=1) all = arange(N, dtype=intp) obj = setdiff1d(all, obj) slobj[axis] = obj slobj = tuple(slobj) new = arr[slobj] | else: obj = array(obj, dtype=intp, copy=0, ndmin=1) all = arange(N, dtype=intp) obj = setdiff1d(all, obj) slobj[axis] = obj new = arr[slobj] | def deletefrom(arr, obj, axis=None): """Return a new array with sub-arrays along an axis deleted. Return a new array with the sub-arrays (i.e. rows or columns) deleted along the given axis as specified by obj obj may be a slice_object (s_[3:5:2]) or an integer or an array of integers indicated which sub-arrays to rem... |
try: wrap = arr.__array_wrap__ except AttributeError: wrap = None | wrap = None if type(arr) is not ndarray: try: wrap = arr.__array_wrap__ except AttributeError: pass | def insertinto(arr, obj, values, axis=None): """Return a new array with values inserted along the given axis before the given indices If axis is None, then ravel the array first. The obj argument can be an integer, a slice, or a sequence of integers. Example: >>> a = array([[1,2,3], [4,5,6], [7,8,9]]) >>> insertint... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.