本文整理汇总了Python中numpy.distutils.misc_util.is_string函数的典型用法代码示例。如果您正苦于以下问题:Python is_string函数的具体用法?Python is_string怎么用?Python is_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_string函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: link
def link(
self,
target_desc,
objects,
output_filename,
output_dir=None,
libraries=None,
library_dirs=None,
runtime_library_dirs=None,
export_symbols=None,
debug=0,
extra_preargs=None,
extra_postargs=None,
build_temp=None,
target_lang=None,
):
objects, output_dir = self._fix_object_args(objects, output_dir)
libraries, library_dirs, runtime_library_dirs = self._fix_lib_args(
libraries, library_dirs, runtime_library_dirs
)
lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs, libraries)
if is_string(output_dir):
output_filename = os.path.join(output_dir, output_filename)
elif output_dir is not None:
raise TypeError("'output_dir' must be a string or None")
if self._need_link(objects, output_filename):
if self.library_switch[-1] == " ":
o_args = [self.library_switch.strip(), output_filename]
else:
o_args = [self.library_switch.strip() + output_filename]
if is_string(self.objects):
ld_args = objects + [self.objects]
else:
ld_args = objects + self.objects
ld_args = ld_args + lib_opts + o_args
if debug:
ld_args[:0] = ["-g"]
if extra_preargs:
ld_args[:0] = extra_preargs
if extra_postargs:
ld_args.extend(extra_postargs)
self.mkpath(os.path.dirname(output_filename))
if target_desc == CCompiler.EXECUTABLE:
linker = self.linker_exe[:]
else:
linker = self.linker_so[:]
command = linker + ld_args
try:
self.spawn(command)
except DistutilsExecError:
msg = str(get_exception())
raise LinkError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
开发者ID:hitej,项目名称:meta-core,代码行数:57,代码来源:__init__.py
示例2: __get_flags
def __get_flags(self, command, envvar=None, confvar=None):
if command is None:
var = []
elif is_string(command):
var = self.executables[command][1:]
else:
var = command()
if envvar is not None:
var = os.environ.get(envvar, var)
if confvar is not None:
var = confvar[0].get(confvar[1], [None,var])[1]
if is_string(var):
var = split_quoted(var)
return var
开发者ID:radical-software,项目名称:radicalspam,代码行数:14,代码来源:__init__.py
示例3: set_command
def set_command(self, key, value):
if not key in self._executable_keys:
raise ValueError("unknown executable '%s' for class %s" % (key, self.__class__.__name__))
if is_string(value):
value = split_quoted(value)
assert value is None or is_sequence_of_strings(value[1:]), (key, value)
self.executables[key] = value
开发者ID:hitej,项目名称:meta-core,代码行数:7,代码来源:__init__.py
示例4: find_modules
def find_modules(self):
old_py_modules = self.py_modules[:]
new_py_modules = [_m for _m in self.py_modules if is_string(_m)]
self.py_modules[:] = new_py_modules
modules = old_build_py.find_modules(self)
self.py_modules[:] = old_py_modules
return modules
开发者ID:arthornsby,项目名称:numpy,代码行数:8,代码来源:build_py.py
示例5: __get_cmd
def __get_cmd(self, command, envvar=None, confvar=None):
if command is None:
var = None
elif is_string(command):
var = self.executables[command]
if var is not None:
var = var[0]
else:
var = command()
if envvar is not None:
var = os.environ.get(envvar, var)
if confvar is not None:
var = confvar[0].get(confvar[1], [None,var])[1]
return var
开发者ID:radical-software,项目名称:radicalspam,代码行数:14,代码来源:__init__.py
示例6: generate_scripts
def generate_scripts(self, scripts):
new_scripts = []
func_scripts = []
for script in scripts:
if is_string(script):
new_scripts.append(script)
else:
func_scripts.append(script)
if not func_scripts:
return new_scripts
build_dir = self.build_dir
self.mkpath(build_dir)
for func in func_scripts:
script = func(build_dir)
if not script:
continue
if is_string(script):
log.info(" adding '%s' to scripts" % (script,))
new_scripts.append(script)
else:
[log.info(" adding '%s' to scripts" % (s,)) for s in script]
new_scripts.extend(list(script))
return new_scripts
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:24,代码来源:build_scripts.py
示例7: _dict_append
def _dict_append(d, **kws):
for k,v in kws.items():
if k not in d:
d[k] = v
continue
dv = d[k]
if isinstance(dv, tuple):
d[k] = dv + tuple(v)
elif isinstance(dv, list):
d[k] = dv + list(v)
elif isinstance(dv, dict):
_dict_append(dv, **v)
elif is_string(dv):
d[k] = dv + v
else:
raise TypeError(repr(type(dv)))
开发者ID:arthornsby,项目名称:numpy,代码行数:16,代码来源:core.py
示例8: _environment_hook
def _environment_hook(self, name, hook_name):
if hook_name is None:
return None
if is_string(hook_name):
if hook_name.startswith('self.'):
hook_name = hook_name[5:]
hook = getattr(self, hook_name)
return hook()
elif hook_name.startswith('exe.'):
hook_name = hook_name[4:]
var = self.executables[hook_name]
if var:
return var[0]
else:
return None
elif hook_name.startswith('flags.'):
hook_name = hook_name[6:]
hook = getattr(self, 'get_flags_' + hook_name)
return hook()
else:
return hook_name()
开发者ID:blitzmann,项目名称:Pyfa-skel,代码行数:21,代码来源:__init__.py
示例9: generate_sources
def generate_sources(self, sources, extension):
new_sources = []
func_sources = []
for source in sources:
if is_string(source):
new_sources.append(source)
else:
func_sources.append(source)
if not func_sources:
return new_sources
if self.inplace and not is_sequence(extension):
build_dir = self.ext_target_dir
else:
if is_sequence(extension):
name = extension[0]
# if 'include_dirs' not in extension[1]:
# extension[1]['include_dirs'] = []
# incl_dirs = extension[1]['include_dirs']
else:
name = extension.name
# incl_dirs = extension.include_dirs
#if self.build_src not in incl_dirs:
# incl_dirs.append(self.build_src)
build_dir = os.path.join(*([self.build_src]\
+name.split('.')[:-1]))
self.mkpath(build_dir)
for func in func_sources:
source = func(extension, build_dir)
if not source:
continue
if is_sequence(source):
[log.info(" adding '%s' to sources." % (s,)) for s in source]
new_sources.extend(source)
else:
log.info(" adding '%s' to sources." % (source,))
new_sources.append(source)
return new_sources
开发者ID:anntzer,项目名称:numpy,代码行数:38,代码来源:build_src.py
示例10: setup
def setup(**attr):
cmdclass = numpy_cmdclass.copy()
new_attr = attr.copy()
if 'cmdclass' in new_attr:
cmdclass.update(new_attr['cmdclass'])
new_attr['cmdclass'] = cmdclass
if 'configuration' in new_attr:
# To avoid calling configuration if there are any errors
# or help request in command in the line.
configuration = new_attr.pop('configuration')
old_dist = distutils.core._setup_distribution
old_stop = distutils.core._setup_stop_after
distutils.core._setup_distribution = None
distutils.core._setup_stop_after = "commandline"
try:
dist = setup(**new_attr)
finally:
distutils.core._setup_distribution = old_dist
distutils.core._setup_stop_after = old_stop
if dist.help or not _command_line_ok():
# probably displayed help, skip running any commands
return dist
# create setup dictionary and append to new_attr
config = configuration()
if hasattr(config,'todict'):
config = config.todict()
_dict_append(new_attr, **config)
# Move extension source libraries to libraries
libraries = []
for ext in new_attr.get('ext_modules',[]):
new_libraries = []
for item in ext.libraries:
if is_sequence(item):
lib_name, build_info = item
_check_append_ext_library(libraries, lib_name, build_info)
new_libraries.append(lib_name)
elif is_string(item):
new_libraries.append(item)
else:
raise TypeError("invalid description of extension module "
"library %r" % (item,))
ext.libraries = new_libraries
if libraries:
if 'libraries' not in new_attr:
new_attr['libraries'] = []
for item in libraries:
_check_append_library(new_attr['libraries'], item)
# sources in ext_modules or libraries may contain header files
if ('ext_modules' in new_attr or 'libraries' in new_attr) \
and 'headers' not in new_attr:
new_attr['headers'] = []
# Use our custom NumpyDistribution class instead of distutils' one
new_attr['distclass'] = NumpyDistribution
return old_setup(**new_attr)
开发者ID:arthornsby,项目名称:numpy,代码行数:63,代码来源:core.py
示例11: str2bool
def str2bool(s):
if is_string(s):
return strtobool(s)
return bool(s)
开发者ID:blitzmann,项目名称:Pyfa-skel,代码行数:4,代码来源:__init__.py
示例12: flaglist
def flaglist(s):
if is_string(s):
return split_quoted(s)
else:
return s
开发者ID:blitzmann,项目名称:Pyfa-skel,代码行数:5,代码来源:__init__.py
示例13: _fix_args
def _fix_args(args,flag=1):
if is_string(args):
return args.replace('%','%%')
if flag and is_sequence(args):
return tuple([_fix_args(a,flag=0) for a in args])
return args
开发者ID:glimmercn,项目名称:numpy,代码行数:6,代码来源:log.py
示例14: setup
def setup(**attr):
if len(sys.argv) <= 1 and not attr.get("script_args", []):
from interactive import interactive_sys_argv
import atexit
atexit.register(_exit_interactive_session)
sys.argv[:] = interactive_sys_argv(sys.argv)
if len(sys.argv) > 1:
return setup(**attr)
cmdclass = numpy_cmdclass.copy()
new_attr = attr.copy()
if "cmdclass" in new_attr:
cmdclass.update(new_attr["cmdclass"])
new_attr["cmdclass"] = cmdclass
if "configuration" in new_attr:
# To avoid calling configuration if there are any errors
# or help request in command in the line.
configuration = new_attr.pop("configuration")
old_dist = distutils.core._setup_distribution
old_stop = distutils.core._setup_stop_after
distutils.core._setup_distribution = None
distutils.core._setup_stop_after = "commandline"
try:
dist = setup(**new_attr)
finally:
distutils.core._setup_distribution = old_dist
distutils.core._setup_stop_after = old_stop
if dist.help or not _command_line_ok():
# probably displayed help, skip running any commands
return dist
# create setup dictionary and append to new_attr
config = configuration()
if hasattr(config, "todict"):
config = config.todict()
_dict_append(new_attr, **config)
# Move extension source libraries to libraries
libraries = []
for ext in new_attr.get("ext_modules", []):
new_libraries = []
for item in ext.libraries:
if is_sequence(item):
lib_name, build_info = item
_check_append_ext_library(libraries, lib_name, build_info)
new_libraries.append(lib_name)
elif is_string(item):
new_libraries.append(item)
else:
raise TypeError("invalid description of extension module " "library %r" % (item,))
ext.libraries = new_libraries
if libraries:
if "libraries" not in new_attr:
new_attr["libraries"] = []
for item in libraries:
_check_append_library(new_attr["libraries"], item)
# sources in ext_modules or libraries may contain header files
if ("ext_modules" in new_attr or "libraries" in new_attr) and "headers" not in new_attr:
new_attr["headers"] = []
# Use our custom NumpyDistribution class instead of distutils' one
new_attr["distclass"] = NumpyDistribution
return old_setup(**new_attr)
开发者ID:ECain,项目名称:MissionPlanner,代码行数:70,代码来源:core.py
注:本文中的numpy.distutils.misc_util.is_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论