本文整理汇总了Python中numpy.distutils.misc_util.dict_append函数的典型用法代码示例。如果您正苦于以下问题:Python dict_append函数的具体用法?Python dict_append怎么用?Python dict_append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dict_append函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: buildmodules
def buildmodules(list):
cfuncs.buildcfuncs()
outmess('Building modules...\n')
modules,mnames,isusedby=[],[],{}
for i in range(len(list)):
if string.find(list[i]['name'],'__user__')>=0:
cb_rules.buildcallbacks(list[i])
else:
if list[i].has_key('use'):
for u in list[i]['use'].keys():
if not isusedby.has_key(u): isusedby[u]=[]
isusedby[u].append(list[i]['name'])
modules.append(list[i])
mnames.append(list[i]['name'])
ret = {}
for i in range(len(mnames)):
if isusedby.has_key(mnames[i]):
outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],string.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]),',')))
else:
um=[]
if modules[i].has_key('use'):
for u in modules[i]['use'].keys():
if isusedby.has_key(u) and u in mnames:
um.append(modules[mnames.index(u)])
else:
outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n'%(mnames[i],u))
ret[mnames[i]] = {}
dict_append(ret[mnames[i]],rules.buildmodule(modules[i],um))
return ret
开发者ID:radical-software,项目名称:radicalspam,代码行数:29,代码来源:f2py2e.py
示例2: buildmodules
def buildmodules(lst):
cfuncs.buildcfuncs()
outmess("Building modules...\n")
modules, mnames, isusedby = [], [], {}
for i in range(len(lst)):
if "__user__" in lst[i]["name"]:
cb_rules.buildcallbacks(lst[i])
else:
if "use" in lst[i]:
for u in lst[i]["use"].keys():
if u not in isusedby:
isusedby[u] = []
isusedby[u].append(lst[i]["name"])
modules.append(lst[i])
mnames.append(lst[i]["name"])
ret = {}
for i in range(len(mnames)):
if mnames[i] in isusedby:
outmess(
'\tSkipping module "%s" which is used by %s.\n'
% (mnames[i], ",".join(map(lambda s: '"%s"' % s, isusedby[mnames[i]])))
)
else:
um = []
if "use" in modules[i]:
for u in modules[i]["use"].keys():
if u in isusedby and u in mnames:
um.append(modules[mnames.index(u)])
else:
outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n' % (mnames[i], u))
ret[mnames[i]] = {}
dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um))
return ret
开发者ID:dwcrandell,项目名称:GeneDesigner,代码行数:33,代码来源:f2py2e.py
示例3: buildmodules
def buildmodules(lst):
cfuncs.buildcfuncs()
outmess('Building modules...\n')
modules,mnames,isusedby=[],[],{}
for i in range(len(lst)):
if '__user__' in lst[i]['name']:
cb_rules.buildcallbacks(lst[i])
else:
if 'use' in lst[i]:
for u in list(lst[i]['use'].keys()):
if u not in isusedby:
isusedby[u]=[]
isusedby[u].append(lst[i]['name'])
modules.append(lst[i])
mnames.append(lst[i]['name'])
ret = {}
for i in range(len(mnames)):
if mnames[i] in isusedby:
outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],','.join(['"%s"'%s for s in isusedby[mnames[i]]])))
else:
um=[]
if 'use' in modules[i]:
for u in list(modules[i]['use'].keys()):
if u in isusedby and u in mnames:
um.append(modules[mnames.index(u)])
else:
outmess('\tModule "%s" uses nonexisting "%s" which will be ignored.\n'%(mnames[i],u))
ret[mnames[i]] = {}
dict_append(ret[mnames[i]],rules.buildmodule(modules[i],um))
return ret
开发者ID:BlackEarth,项目名称:portable-python-win32,代码行数:30,代码来源:f2py2e.py
示例4: configuration
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration, dict_append
from numpy.distutils.system_info import system_info
config = Configuration('numexprz', parent_package, top_path)
# os.chdir( here )
#try to find configuration for MKL, either from environment or site.cfg
if op.exists('site.cfg'):
mkl_config_data = config.get_info('mkl')
# some version of MKL need to be linked with libgfortran, for this, use
# entries of DEFAULT section in site.cfg
default_config = system_info()
dict_append(mkl_config_data,
libraries=default_config.get_libraries(),
library_dirs=default_config.get_lib_dirs())
else:
mkl_config_data = {}
#setup information for C extension
if os.name == 'nt':
pthread_win = [ 'numexprz/win32/pthread.c' ]
else:
pthread_win = []
extension_config_data = {
'sources': ['numexprz/interpreter.cpp',
'numexprz/module.cpp',
'numexprz/numexpr_object.cpp'] + pthread_win,
'depends': ['numexprz/interp_body.cpp',
'numexprz/complex_functions.hpp',
'numexprz/interpreter.hpp',
'numexprz/module.hpp',
'numexprz/msvc_function_stubs.hpp',
'numexprz/numexpr_config.hpp',
'numexprz/numexpr_object.hpp',
'numexprz/opcodes.hpp',
'numexprz/functions.hpp',
'numexprz/complexf_functions.hpp',
'numexprz/missing_posix_functions.hpp',
'numexprz/str-two-way.hpp', ],
}
if os.name == 'nt':
# Don't use GNU math or LINK.exe args on Win64 platform
pass
else:
extension_config_data['libraries'] = ['m']
extension_config_data['extra_compile_args'] = ['-funroll-all-loops', ]
dict_append(extension_config_data, **mkl_config_data)
if 'library_dirs' in mkl_config_data:
library_dirs = ':'.join(mkl_config_data['library_dirs'])
config.add_extension('interpreter', **extension_config_data)
config.make_config_py()
# Remove tests, it may be generating UNKNOWN.egg
# config.add_subpackage('tests')
#version handling
config.get_version('version.py')
return config
开发者ID:C-CINA,项目名称:zorro,代码行数:60,代码来源:setup.py
示例5: configuration
def configuration():
from numpy.distutils.misc_util import Configuration, dict_append
from numpy.distutils.system_info import system_info
config = Configuration("numexpr")
# try to find configuration for MKL, either from environment or site.cfg
if op.exists("site.cfg"):
mkl_config_data = config.get_info("mkl")
# some version of MKL need to be linked with libgfortran, for this, use
# entries of DEFAULT section in site.cfg
default_config = system_info()
dict_append(
mkl_config_data,
libraries=default_config.get_libraries(),
library_dirs=default_config.get_lib_dirs(),
)
else:
mkl_config_data = {}
# setup information for C extension
if os.name == "nt":
pthread_win = ["numexpr/win32/pthread.c"]
else:
pthread_win = []
extension_config_data = {
"sources": ["numexpr/interpreter.cpp", "numexpr/module.cpp", "numexpr/numexpr_object.cpp"]
+ pthread_win,
"depends": [
"numexpr/interp_body.cpp",
"numexpr/complex_functions.hpp",
"numexpr/interpreter.hpp",
"numexpr/module.hpp",
"numexpr/msvc_function_stubs.hpp",
"numexpr/numexpr_config.hpp",
"numexpr/numexpr_object.hpp",
],
"libraries": ["m"],
"extra_compile_args": ["-funroll-all-loops"],
}
dict_append(extension_config_data, **mkl_config_data)
if "library_dirs" in mkl_config_data:
library_dirs = ":".join(mkl_config_data["library_dirs"])
config.add_extension("interpreter", **extension_config_data)
config.make_config_py()
config.add_subpackage("tests", "numexpr/tests")
# version handling
config.get_version("numexpr/version.py")
return config
开发者ID:benmoran,项目名称:numexpr,代码行数:51,代码来源:setup.py
示例6: configuration
def configuration():
from numpy.distutils.misc_util import Configuration, dict_append
from numpy.distutils.system_info import system_info
config = Configuration('numexpr')
#try to find configuration for MKL, either from environment or site.cfg
if op.exists('site.cfg'):
mkl_config_data = config.get_info('mkl')
# some version of MKL need to be linked with libgfortran, for this, use
# entries of DEFAULT section in site.cfg
default_config = system_info()
dict_append(mkl_config_data,
libraries = default_config.get_libraries(),
library_dirs = default_config.get_lib_dirs() )
else:
mkl_config_data = {}
#setup information for C extension
if os.name == 'nt':
pthread_win = ['numexpr/win32/pthread.c']
else:
pthread_win = []
extension_config_data = {
'sources': ['numexpr/interpreter.cpp',
'numexpr/module.cpp',
'numexpr/numexpr_object.cpp'] + pthread_win,
'depends': ['numexpr/interp_body.cpp',
'numexpr/complex_functions.hpp',
'numexpr/interpreter.hpp',
'numexpr/module.hpp',
'numexpr/msvc_function_stubs.hpp',
'numexpr/numexpr_config.hpp',
'numexpr/numexpr_object.hpp'],
'libraries': ['m'],
'extra_compile_args': ['-funroll-all-loops',],
}
dict_append(extension_config_data, **mkl_config_data)
if 'library_dirs' in mkl_config_data:
library_dirs = ':'.join(mkl_config_data['library_dirs'])
rpath_link = '-Xlinker --rpath -Xlinker %s' % library_dirs
extension_config_data['extra_link_args'] = [rpath_link]
config.add_extension('interpreter', **extension_config_data)
config.make_config_py()
config.add_subpackage('tests', 'numexpr/tests')
#version handling
config.make_svn_version_py()
config.get_version('numexpr/version.py')
return config
开发者ID:Alwnikrotikz,项目名称:numexpr,代码行数:51,代码来源:setup.py
示例7: run_main
def run_main(comline_list):
"""Run f2py as if string.join(comline_list,' ') is used as a command line.
In case of using -h flag, return None.
"""
if sys.version_info[0] >= 3:
import imp
imp.reload(crackfortran)
else:
reload(crackfortran)
f2pydir = os.path.dirname(os.path.abspath(cfuncs.__file__))
fobjhsrc = os.path.join(f2pydir, "src", "fortranobject.h")
fobjcsrc = os.path.join(f2pydir, "src", "fortranobject.c")
files, options = scaninputline(comline_list)
auxfuncs.options = options
postlist = callcrackfortran(files, options)
isusedby = {}
for i in range(len(postlist)):
if "use" in postlist[i]:
for u in postlist[i]["use"].keys():
if u not in isusedby:
isusedby[u] = []
isusedby[u].append(postlist[i]["name"])
for i in range(len(postlist)):
if postlist[i]["block"] == "python module" and "__user__" in postlist[i]["name"]:
if postlist[i]["name"] in isusedby:
# if not quiet:
outmess(
'Skipping Makefile build for module "%s" which is used by %s\n'
% (postlist[i]["name"], ",".join(map(lambda s: '"%s"' % s, isusedby[postlist[i]["name"]])))
)
if "signsfile" in options:
if options["verbose"] > 1:
outmess("Stopping. Edit the signature file and then run f2py on the signature file: ")
outmess("%s %s\n" % (os.path.basename(sys.argv[0]), options["signsfile"]))
return
for i in range(len(postlist)):
if postlist[i]["block"] != "python module":
if "python module" not in options:
errmess("Tip: If your original code is Fortran source then you must use -m option.\n")
raise TypeError, "All blocks must be python module blocks but got %s" % (` postlist[i]["block"] `)
auxfuncs.debugoptions = options["debug"]
f90mod_rules.options = options
auxfuncs.wrapfuncs = options["wrapfuncs"]
ret = buildmodules(postlist)
for mn in ret.keys():
dict_append(ret[mn], {"csrc": fobjcsrc, "h": fobjhsrc})
return ret
开发者ID:dwcrandell,项目名称:GeneDesigner,代码行数:50,代码来源:f2py2e.py
示例8: run_main
def run_main(comline_list):
"""Run f2py as if string.join(comline_list,' ') is used as a command line.
In case of using -h flag, return None.
"""
crackfortran.reset_global_f2py_vars()
f2pydir = os.path.dirname(os.path.abspath(cfuncs.__file__))
fobjhsrc = os.path.join(f2pydir, 'src', 'fortranobject.h')
fobjcsrc = os.path.join(f2pydir, 'src', 'fortranobject.c')
files, options = scaninputline(comline_list)
auxfuncs.options = options
postlist = callcrackfortran(files, options)
isusedby = {}
for i in range(len(postlist)):
if 'use' in postlist[i]:
for u in postlist[i]['use'].keys():
if u not in isusedby:
isusedby[u] = []
isusedby[u].append(postlist[i]['name'])
for i in range(len(postlist)):
if postlist[i]['block'] == 'python module' and '__user__' in postlist[i]['name']:
if postlist[i]['name'] in isusedby:
# if not quiet:
outmess('Skipping Makefile build for module "%s" which is used by %s\n' % (
postlist[i]['name'], ','.join(['"%s"' % s for s in isusedby[postlist[i]['name']]])))
if 'signsfile' in options:
if options['verbose'] > 1:
outmess(
'Stopping. Edit the signature file and then run f2py on the signature file: ')
outmess('%s %s\n' %
(os.path.basename(sys.argv[0]), options['signsfile']))
return
for i in range(len(postlist)):
if postlist[i]['block'] != 'python module':
if 'python module' not in options:
errmess(
'Tip: If your original code is Fortran source then you must use -m option.\n')
raise TypeError('All blocks must be python module blocks but got %s' % (
repr(postlist[i]['block'])))
auxfuncs.debugoptions = options['debug']
f90mod_rules.options = options
auxfuncs.wrapfuncs = options['wrapfuncs']
ret = buildmodules(postlist)
for mn in ret.keys():
dict_append(ret[mn], {'csrc': fobjcsrc, 'h': fobjhsrc})
return ret
开发者ID:dyao-vu,项目名称:meta-core,代码行数:47,代码来源:f2py2e.py
示例9: run_compile
#.........这里部分代码省略.........
if ov not in vmap.values():
print 'Unknown vendor: "%s"' % (s[len(v) :])
nv = ov
i = flib_flags.index(s)
flib_flags[i] = "--fcompiler=" + nv
continue
for s in del_list:
i = flib_flags.index(s)
del flib_flags[i]
assert len(flib_flags) <= 2, ` flib_flags `
setup_flags = filter(re.compile(r"[-][-](verbose)").match, sys.argv[1:])
sys.argv = filter(lambda a, flags=setup_flags: a not in flags, sys.argv)
if "--quiet" in f2py_flags:
setup_flags.append("--quiet")
modulename = "untitled"
sources = sys.argv[1:]
if "-m" in sys.argv:
i = sys.argv.index("-m")
modulename = sys.argv[i + 1]
del sys.argv[i + 1], sys.argv[i]
sources = sys.argv[1:]
else:
from numpy.distutils.command.build_src import get_f2py_modulename
pyf_files, sources = filter_files("", "[.]pyf([.]src|)", sources)
sources = pyf_files + sources
for f in pyf_files:
modulename = get_f2py_modulename(f)
if modulename:
break
extra_objects, sources = filter_files("", "[.](o|a|so)", sources)
include_dirs, sources = filter_files("-I", "", sources, remove_prefix=1)
library_dirs, sources = filter_files("-L", "", sources, remove_prefix=1)
libraries, sources = filter_files("-l", "", sources, remove_prefix=1)
undef_macros, sources = filter_files("-U", "", sources, remove_prefix=1)
define_macros, sources = filter_files("-D", "", sources, remove_prefix=1)
using_numarray = 0
using_numeric = 0
for i in range(len(define_macros)):
name_value = define_macros[i].split("=", 1)
if len(name_value) == 1:
name_value.append(None)
if len(name_value) == 2:
define_macros[i] = tuple(name_value)
else:
print "Invalid use of -D:", name_value
from numpy.distutils.system_info import get_info
num_include_dir = None
num_info = {}
# import numpy
# n = 'numpy'
# p = get_prefix(numpy)
# from numpy.distutils.misc_util import get_numpy_include_dirs
# num_info = {'include_dirs': get_numpy_include_dirs()}
if num_info:
include_dirs.extend(num_info.get("include_dirs", []))
from numpy.distutils.core import setup, Extension
ext_args = {
"name": modulename,
"sources": sources,
"include_dirs": include_dirs,
"library_dirs": library_dirs,
"libraries": libraries,
"define_macros": define_macros,
"undef_macros": undef_macros,
"extra_objects": extra_objects,
"f2py_options": f2py_flags,
}
if sysinfo_flags:
from numpy.distutils.misc_util import dict_append
for n in sysinfo_flags:
i = get_info(n)
if not i:
outmess("No %s resources found in system" " (try `f2py --help-link`)\n" % (` n `))
dict_append(ext_args, **i)
ext = Extension(**ext_args)
sys.argv = [sys.argv[0]] + setup_flags
sys.argv.extend(["build", "--build-temp", build_dir, "--build-base", build_dir, "--build-platlib", "."])
if fc_flags:
sys.argv.extend(["config_fc"] + fc_flags)
if flib_flags:
sys.argv.extend(["build_ext"] + flib_flags)
setup(ext_modules=[ext])
if remove_build_dir and os.path.exists(build_dir):
import shutil
outmess("Removing build directory %s\n" % (build_dir))
shutil.rmtree(build_dir)
开发者ID:dwcrandell,项目名称:GeneDesigner,代码行数:101,代码来源:f2py2e.py
示例10: run_compile
#.........这里部分代码省略.........
assert len(flib_flags)<=2, repr(flib_flags)
_reg5 = re.compile(r'[-][-](verbose)')
setup_flags = [_m for _m in sys.argv[1:] if _reg5.match(_m)]
sys.argv = [_m for _m in sys.argv if _m not in setup_flags]
if '--quiet' in f2py_flags:
setup_flags.append('--quiet')
modulename = 'untitled'
sources = sys.argv[1:]
for optname in ['--include_paths', '--include-paths']:
if optname in sys.argv:
i = sys.argv.index (optname)
f2py_flags.extend (sys.argv[i:i+2])
del sys.argv[i+1], sys.argv[i]
sources = sys.argv[1:]
if '-m' in sys.argv:
i = sys.argv.index('-m')
modulename = sys.argv[i+1]
del sys.argv[i+1], sys.argv[i]
sources = sys.argv[1:]
else:
from numpy.distutils.command.build_src import get_f2py_modulename
pyf_files, sources = filter_files('', '[.]pyf([.]src|)', sources)
sources = pyf_files + sources
for f in pyf_files:
modulename = get_f2py_modulename(f)
if modulename:
break
extra_objects, sources = filter_files('', '[.](o|a|so)', sources)
include_dirs, sources = filter_files('-I', '', sources, remove_prefix=1)
library_dirs, sources = filter_files('-L', '', sources, remove_prefix=1)
libraries, sources = filter_files('-l', '', sources, remove_prefix=1)
undef_macros, sources = filter_files('-U', '', sources, remove_prefix=1)
define_macros, sources = filter_files('-D', '', sources, remove_prefix=1)
using_numarray = 0
using_numeric = 0
for i in range(len(define_macros)):
name_value = define_macros[i].split('=', 1)
if len(name_value)==1:
name_value.append(None)
if len(name_value)==2:
define_macros[i] = tuple(name_value)
else:
print('Invalid use of -D:', name_value)
from numpy.distutils.system_info import get_info
num_include_dir = None
num_info = {}
#import numpy
#n = 'numpy'
#p = get_prefix(numpy)
#from numpy.distutils.misc_util import get_numpy_include_dirs
#num_info = {'include_dirs': get_numpy_include_dirs()}
if num_info:
include_dirs.extend(num_info.get('include_dirs', []))
from numpy.distutils.core import setup, Extension
ext_args = {'name': modulename, 'sources': sources,
'include_dirs': include_dirs,
'library_dirs': library_dirs,
'libraries': libraries,
'define_macros': define_macros,
'undef_macros': undef_macros,
'extra_objects': extra_objects,
'f2py_options': f2py_flags,
}
if sysinfo_flags:
from numpy.distutils.misc_util import dict_append
for n in sysinfo_flags:
i = get_info(n)
if not i:
outmess('No %s resources found in system'\
' (try `f2py --help-link`)\n' % (repr(n)))
dict_append(ext_args,**i)
ext = Extension(**ext_args)
sys.argv = [sys.argv[0]] + setup_flags
sys.argv.extend(['build',
'--build-temp', build_dir,
'--build-base', build_dir,
'--build-platlib', '.'])
if fc_flags:
sys.argv.extend(['config_fc']+fc_flags)
if flib_flags:
sys.argv.extend(['build_ext']+flib_flags)
setup(ext_modules = [ext])
if remove_build_dir and os.path.exists(build_dir):
import shutil
outmess('Removing build directory %s\n'%(build_dir))
shutil.rmtree(build_dir)
开发者ID:7924102,项目名称:numpy,代码行数:101,代码来源:f2py2e.py
示例11: run_main
def run_main(comline_list):
"""
Equivalent to running::
f2py <args>
where ``<args>=string.join(<list>,' ')``, but in Python. Unless
``-h`` is used, this function returns a dictionary containing
information on generated modules and their dependencies on source
files. For example, the command ``f2py -m scalar scalar.f`` can be
executed from Python as follows
You cannot build extension modules with this function, that is,
using ``-c`` is not allowed. Use ``compile`` command instead
Examples
--------
.. include:: run_main_session.dat
:literal:
"""
crackfortran.reset_global_f2py_vars()
f2pydir = os.path.dirname(os.path.abspath(cfuncs.__file__))
fobjhsrc = os.path.join(f2pydir, 'src', 'fortranobject.h')
fobjcsrc = os.path.join(f2pydir, 'src', 'fortranobject.c')
files, options = scaninputline(comline_list)
auxfuncs.options = options
postlist = callcrackfortran(files, options)
isusedby = {}
for i in range(len(postlist)):
if 'use' in postlist[i]:
for u in postlist[i]['use'].keys():
if u not in isusedby:
isusedby[u] = []
isusedby[u].append(postlist[i]['name'])
for i in range(len(postlist)):
if postlist[i]['block'] == 'python module' and '__user__' in postlist[i]['name']:
if postlist[i]['name'] in isusedby:
# if not quiet:
outmess('Skipping Makefile build for module "%s" which is used by %s\n' % (
postlist[i]['name'], ','.join(['"%s"' % s for s in isusedby[postlist[i]['name']]])))
if 'signsfile' in options:
if options['verbose'] > 1:
outmess(
'Stopping. Edit the signature file and then run f2py on the signature file: ')
outmess('%s %s\n' %
(os.path.basename(sys.argv[0]), options['signsfile']))
return
for i in range(len(postlist)):
if postlist[i]['block'] != 'python module':
if 'python module' not in options:
errmess(
'Tip: If your original code is Fortran source then you must use -m option.\n')
raise TypeError('All blocks must be python module blocks but got %s' % (
repr(postlist[i]['block'])))
auxfuncs.debugoptions = options['debug']
f90mod_rules.options = options
auxfuncs.wrapfuncs = options['wrapfuncs']
ret = buildmodules(postlist)
for mn in ret.keys():
dict_append(ret[mn], {'csrc': fobjcsrc, 'h': fobjhsrc})
return ret
开发者ID:Horta,项目名称:numpy,代码行数:64,代码来源:f2py2e.py
注:本文中的numpy.distutils.misc_util.dict_append函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论