本文整理汇总了Python中utils.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: scattercisr
def scattercisr(xs, ys, amoeboids, mesenchymals, labels = None, xlabel = None, ylabel = None, xlabels=None, title=None, legend=None, showGrid=False, folder=None, savefile=None, **plotargs):
assert len(xs)==len(ys), "y0 and y1 don't have the same length"
fig = plt.figure()
ax = fig.add_subplot(111)
plt.grid(showGrid)
handles = []
h0 = ax.scatter(xs[mesenchymals], ys[mesenchymals], color='g', marker='o', s=7, label="mesenchymals")
h1 = ax.scatter(xs[amoeboids], ys[amoeboids], color='b', marker='o', s=7, label="amoeboids")
handles.append(h0)
handles.append(h1)
ax.legend(loc=10)
if legend is not None:
ax.legend(handles, legend, loc=10)
if xlabel is not None:
ax.set_xlabel(xlabel)
if ylabel is not None:
ax.set_ylabel(ylabel)
if title is not None:
ax.set_title(title)
if "xlim" in plotargs.keys():
ax.set_xlim(plotargs["xlim"])
if "ylim" in plotargs.keys():
ax.set_ylim(plotargs["ylim"])
if folder is None:
folder = ""
if savefile is not None:
savefilepath = join(folder, savefile)
plt.savefig(savefilepath)
info(savefile + " written.")
if savefile is None:
plt.show()
plt.close()
开发者ID:frebdel,项目名称:mcc,代码行数:33,代码来源:plotting.py
示例2: plot
def plot(x, y, labels = None, xlabel = None, ylabel = None, xlabels=None, title=None, legend=None, showGrid=False, folder=None, savefile=None):
assert len(x)==len(y), "x and y don't have the same length"
assert len(x)>0 and type(x)==list
fig = plt.figure()
ax = fig.add_subplot(111)
plt.grid(showGrid)
handles = []
for i, _ in enumerate(x):
handles.append(ax.plot(x[i], y[i], linestyle=':', marker='s')[0])
#That label stuff doesn't yet work as it should.
if labels is not None:
ax.text(x[i][0], y[i][0], labels[0], horizontalalignment='left', verticalalignment='top', transform=ax.transAxes)
if legend is not None:
ax.legend(handles, legend, loc=0)
if xlabel is not None:
ax.set_xlabel(xlabel)
if ylabel is not None:
ax.set_ylabel(ylabel)
if title is not None:
ax.set_title(title)
if folder is None:
folder = ""
if savefile is not None:
plt.savefig(join(folder, savefile))
info(savefile + " written.")
if savefile is None:
plt.show()
plt.close()
开发者ID:frebdel,项目名称:mcc,代码行数:28,代码来源:plotting.py
示例3: bars_stacked
def bars_stacked(y0, color0, y1, color1, left, width, y_bars=None, labels = None, xlabel = None, ylabel = None, xlabels=None, title=None, legend=None, showGrid=False, folder=None, savefile=None, **plotargs):
assert len(y0)==len(y1), "y0 and y1 don't have the same length"
fig = plt.figure()
ax = fig.add_subplot(111)
plt.grid(showGrid)
handles = []
h0 = ax.bar(left, y0, width, color=color0, label="successful")
h1 = ax.bar(left, y1, width, bottom=y0, color=color1, label="unsuccessful")
handles.append(h0)
handles.append(h1)
ax.legend()
if legend is not None:
ax.legend(handles, legend, loc=0)
if xlabel is not None:
ax.set_xlabel(xlabel)
if ylabel is not None:
ax.set_ylabel(ylabel)
if title is not None:
ax.set_title(title)
if "xlim" in plotargs.keys():
ax.set_xlim(plotargs["xlim"])
if "ylim" in plotargs.keys():
ax.set_ylim(plotargs["ylim"])
if folder is None:
folder = ""
if savefile is not None:
savefilepath = join(folder, savefile)
plt.savefig(savefilepath)
info(savefile + " written.")
if savefile is None:
plt.show()
plt.close()
开发者ID:frebdel,项目名称:mcc,代码行数:33,代码来源:plotting.py
示例4: setup_server
def setup_server(cfg, db):
'''Setup seafile server with the setup-seafile.sh script. We use pexpect to
interactive with the setup process of the script.
'''
info('uncompressing server tarball')
shell('tar xf seafile-server_{}_x86-64.tar.gz -C {}'
.format(cfg.version, cfg.installdir))
if db == 'mysql':
autosetup_mysql(cfg)
else:
autosetup_sqlite3(cfg)
with open(join(cfg.installdir, 'conf/seahub_settings.py'), 'a') as fp:
fp.write('\n')
fp.write('DEBUG = True')
fp.write('\n')
fp.write('''\
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_RATES': {
'ping': '600/minute',
'anon': '1000/minute',
'user': '1000/minute',
},
}''')
fp.write('\n')
开发者ID:285452612,项目名称:seafile,代码行数:25,代码来源:autosetup.py
示例5: setup_network
def setup_network():
global tapdev
info('Configuring VM networking')
tapdev = sh_str('ifconfig tap create')
info('Using tap device {0}', tapdev)
sh('ifconfig ${tapdev} inet ${HOST_IP} ${NETMASK} up')
开发者ID:abwaters,项目名称:freenas-build,代码行数:7,代码来源:run-trueos-tests.py
示例6: GetSmoothingFactor
def GetSmoothingFactor(points, hRefmethod, modifier, proportionAmount):
hRef = 0
if hRefmethod.lower() == "worton":
hRef = HrefWorton(points)
elif hRefmethod.lower() == "tufto":
hRef = HrefTufto(points)
elif hRefmethod.lower() == "silverman":
hRef = HrefSilverman(points)
elif hRefmethod.lower() == "gaussian":
hRef = HrefGaussianApproximation(points)
elif not hrefmethod or hrefmethod == "#":
hRef = HrefWorton(points)
if hRef == 0:
utils.die("No valid hRef method was provided. Quitting.")
if modifier.lower() == "proportion":
h = proportionAmount * hRef
elif modifier.lower() == "lscv":
h = Minimize(LSCV, hRef, points)
elif modifier.lower() == "bcv2":
h = Minimize(BCV2, hRef, points)
else:
h = hRef
utils.info("hRef (" + hRefmethod + ") = " + str(hRef))
utils.info("Using h = " + str(h))
return h
开发者ID:FabianUx,项目名称:AnimalMovement,代码行数:28,代码来源:UD_SmoothingFactor.py
示例7: symfony_fix_permissions
def symfony_fix_permissions():
with settings(warn_only=True):
if run('test -d %s/app/cache' % env.project_path).succeeded:
info('fixing cache and logs permissions')
www_user = run('ps aux | grep -E \'nginx\' | grep -v root | head -1 | cut -d\ -f1')
sudo('setfacl -R -m u:%(www_user)s:rwX -m u:$(whoami):rwX %(project_path)s/app/cache %(project_path)s/app/logs' % { 'www_user': www_user, 'project_path': env.project_path })
sudo('setfacl -dR -m u:%(www_user)s:rwX -m u:$(whoami):rwX %(project_path)s/app/cache %(project_path)s/app/logs' % { 'www_user': www_user, 'project_path': env.project_path })
开发者ID:Halleck45,项目名称:stage1,代码行数:7,代码来源:symfony.py
示例8: unbindFeature
def unbindFeature(self, qgsfeature, editingmode=False):
"""
Unbinds the feature from the form saving the values back to the QgsFeature.
qgsfeature -- A QgsFeature that will store the new values.
"""
savefields = []
for index, control in self.fieldtocontrol.items():
value = QVariant()
if isinstance(control, QDateTimeEdit):
value = control.dateTime().toString(Qt.ISODate)
else:
if self.layer.editType(index) == QgsVectorLayer.UniqueValues and control.isEditable():
# Due to http://hub.qgis.org/issues/7012 we can't have editable
# comboxs using QgsAttributeEditor. If the value isn't in the
# dataset already it will return null. Until that bug is fixed
# we are just going to handle ourself.
value = control.currentText()
else:
modified = QgsAttributeEditor.retrieveValue(control, self.layer, index, value)
info("Setting value to %s from %s" % (value, control.objectName()))
qgsfeature.changeAttribute(index, value)
# Save the value to the database as a default if it is needed.
if self.shouldSaveValue(control):
savefields.append(index)
if not editingmode:
m = qgsfeature.attributeMap()
fields_map = self.layer.pendingFields()
attr = {str(fields_map[k].name()): str(v.toString()) for k, v in m.items() if k in savefields}
self.form.setSavedValues(attr)
return qgsfeature
开发者ID:vadimshenikov,项目名称:qmap,代码行数:35,代码来源:form_binder.py
示例9: _update_from_iter
def _update_from_iter(self):
if self.it != None:
self.file = self.tree.get_model().get_value(self.it, 1)
if self.tree.get_model().get_value(self.it, 9):
# FIXME: Controlla se esiste gia il file(se l'abbiamo scaricato precedentemente)
tmp = os.path.join(utils.UPDT_DIR, self.file)
if os.path.exists(tmp):
# Controlliamo se il file e' corretto
bytes = os.path.getsize(tmp)
md5 = generate.Generator.checksum(tmp)
if md5 != self.tree.get_model().get_value(self.it, 4) or int(bytes) != self.tree.get_model().get_value(self.it, 3):
os.remove(tmp)
self._thread(self._update_file, utils.url_encode(BASE_DIR + self.file))
else:
self._update_percentage()
self._go_with_next_iter()
else:
self._thread(self._update_file, utils.url_encode(BASE_DIR + self.file))
else:
self._update_percentage()
self._go_with_next_iter()
else:
self.xml_util.dump_tree_to_file(self.diff_object, os.path.join(utils.UPDT_DIR, ".diff.xml"))
utils.info(_("Riavvia per procedere all'aggiornamento di PyAcqua"))
self.destroy()
开发者ID:kucukkose,项目名称:py-acqua,代码行数:31,代码来源:webupdate.py
示例10: kill_me_later
def kill_me_later(timeout, extra_time=60):
pid = os.getpid()
if os.fork() != 0:
return
signal.signal(signal.SIGINT, signal.SIG_IGN)
int_deadline = datetime.now() + timedelta(seconds=timeout)
kill_deadline = int_deadline + timedelta(seconds=extra_time)
int_sent = False
while True:
time.sleep(1)
now = datetime.now()
try:
if now < int_deadline:
os.kill(pid, 0) # Just poll the process
elif now < kill_deadline:
utils.info("execution timeout reached, interrupting")
os.kill(pid, signal.SIGINT if not int_sent else 0)
int_sent = True
else:
utils.info("execution timeout reached, killing")
os.kill(pid, signal.SIGKILL)
break
except OSError: # The process terminated
break
exit(0)
开发者ID:AmesianX,项目名称:chef,代码行数:25,代码来源:run.py
示例11: _run_theta_single
def _run_theta_single(name, debug):
cache_dir = os.path.join(global_config.workdir, 'cache')
cfgfile = name + '.cfg'
dbfile = name + '.db'
cfgfile_cache = os.path.join(cache_dir, cfgfile)
dbfile_cache = os.path.join(cache_dir, dbfile)
cfgfile_full = os.path.join(global_config.workdir, cfgfile)
already_done = False
theta = os.path.realpath(os.path.join(global_config.theta_dir, 'bin', 'theta'))
if os.path.exists(cfgfile_cache) and os.path.exists(os.path.join(cache_dir, dbfile)):
# compare the config files:
already_done = open(cfgfile_cache, 'r').read() == open(cfgfile_full, 'r').read()
if already_done:
utils.info("Skipping 'theta %s': found corresponding output file in cachedir" % cfgfile)
return
utils.info("Running 'theta %s'" % cfgfile)
params = ""
#if debug: params += " --redirect-io=False"
retval = os.system(theta + params + " " + cfgfile_full)
if retval != 0:
if os.isatty(1):
attr = termios.tcgetattr(1)
attr[3] |= termios.ECHO
termios.tcsetattr(1, termios.TCSANOW, attr)
if os.path.exists(dbfile) and not debug: os.unlink(dbfile)
raise RuntimeError, "executing theta for cfg file '%s' failed with exit code %d" % (cfgfile, retval)
# move to cache, also the config file ...
shutil.move(dbfile, dbfile_cache)
shutil.copy(cfgfile_full, cfgfile_cache)
开发者ID:drankincms,项目名称:David_bak,代码行数:29,代码来源:theta_interface.py
示例12: setup_rootfs
def setup_rootfs():
buildkernel(e('${KERNCONF}-DEBUG'), ['mach'], buildkernellog)
installworld('${OBJDIR}/test-root', installworldlog, distributionlog, conf="run")
installkernel(e('${KERNCONF}'), '${OBJDIR}/test-root', installkernellog, modules=['mach'], conf="run")
info('Installing overlay files')
sh('rsync -ah ${TESTS_ROOT}/trueos/overlay/ ${OBJDIR}/test-root')
sh('makefs -M ${IMAGE_SIZE} ${OBJDIR}/test-root.ufs ${OBJDIR}/test-root')
开发者ID:abwaters,项目名称:freenas-build,代码行数:7,代码来源:run-trueos-tests.py
示例13: upload
def upload(directory):
"""Upload a directory to S3.
DIRECTORY: Directory to upload. Required.
"""
if not AWS_BUCKET:
utils.error('AWS_BUCKET environment variable not set. Exiting.')
return
conn = S3Connection()
bucket = get_or_create_bucket(conn, AWS_BUCKET)
files = list(utils.get_files(directory))
total_size = 0
utils.info('Found', len(files), 'files to upload to s3://' + AWS_BUCKET)
for path in files:
filesize = os.path.getsize(path)
total_size += filesize
utils.info('Uploading', path, '-', sizeof_fmt(filesize))
k = Key(bucket)
k.key = path
k.set_contents_from_filename(path)
utils.success('Done. Uploaded', sizeof_fmt(total_size))
开发者ID:nathancahill,项目名称:Processing,代码行数:28,代码来源:upload.py
示例14: export
def export(self, targz: str, **kwargs: dict):
if not os.path.isdir(self.path):
utils.fail("%s: VM does not exist" % self.name)
exit(1)
if not targz:
targz = '%s.tar.gz' % self.name
targz = os.path.abspath(targz)
utils.info("exporting to %s" % targz)
tar = '%s/%s' % (self.path, os.path.basename(os.path.splitext(targz)[0]))
if os.path.exists(targz):
utils.fail("%s: package already exists" % targz)
exit(1)
os.chdir(self.path) # create intermediate files in VM's path
utils.pend("package disk image")
utils.execute(['tar', '-cSf', tar, os.path.basename(self.path_raw)])
utils.ok()
for s in self.snapshots:
utils.pend("package snapshot: %s" % s)
local_snapshot = '%s.%s' % (os.path.basename(self.path_raw), s)
utils.execute(['tar', '-rf', tar, local_snapshot])
utils.ok()
utils.pend("compress package", msg="may take some time")
utils.execute(['gzip', '-c', tar], outfile=targz)
utils.ok()
utils.pend("clean up")
os.unlink(tar)
utils.ok()
self.scan_snapshots()
开发者ID:AmesianX,项目名称:chef,代码行数:34,代码来源:vm.py
示例15: output
def output(self, output_formats, **output_options):
"""
output all results to appropriate URLs
- output_formats: a dict mapping formats to a list of URLs
- output_options: a dict mapping formats to options for each format
"""
utils.info("Outputting talos results => %s", output_formats)
tbpl_output = {}
try:
for key, urls in output_formats.items():
options = output_options.get(key, {})
_output = output.formats[key](self, **options)
results = _output()
for url in urls:
_output.output(results, url, tbpl_output)
except utils.talosError, e:
# print to results.out
try:
_output = output.GraphserverOutput(self)
results = _output()
_output.output('file://%s' % os.path.join(os.getcwd(), 'results.out'), results)
except:
pass
print '\nFAIL: %s' % e.msg.replace('\n', '\nRETURN:')
raise e
开发者ID:djmitche,项目名称:build-talos,代码行数:28,代码来源:results.py
示例16: __init__
def __init__(self, const, noDelete=False):
"""Constructs the ``Simulation`` object according to ``const`` and creates an empty directory for the results."""
self.const = const
self.path = os.getcwd() + "/"
self.resultsdir = os.path.join(self.path, constants.resultspath, const["name"])
if not os.path.exists(self.resultsdir):
os.mkdir(self.resultsdir)
if noDelete==False:
utils.makeFolderEmpty(self.resultsdir)
self.N_amoeboid = self.const["N_amoeboid"]
self.N_mesenchymal = self.const["N_mesenchymal"]
self.N = self.N_amoeboid + self.N_mesenchymal
self.NNN = int(const["max_time"] / const["dt"])
self.retainCompleteDataset = utils.retainCompleteDataset(const)
if noDelete==False:
self.dsA = Dataset(Dataset.ARRAYS, const["max_time"], const["dt"], self.N, constants.DIM, self.resultsdir, fileprefix=None)
if self.retainCompleteDataset:
info("Created dataset of size %s" % self.dsA.getHumanReadableSize())
else:
info("Created temporary dataset of size %s" % self.dsA.getHumanReadableSize())
开发者ID:frebdel,项目名称:mcc,代码行数:25,代码来源:classSimulation.py
示例17: autosetup_mysql
def autosetup_mysql(cfg):
createdbs()
setup_script = get_script(cfg, 'setup-seafile-mysql.sh')
info('setting up seafile server with pexepct, script %s', setup_script)
if not exists(setup_script):
print 'please specify seafile script path'
answers = [
('ENTER', ''),
# server name
('server name', 'my-seafile'),
# ip or domain
('ip or domain', '127.0.0.1'),
# seafile data dir
('seafile-data', ''),
# fileserver port
('seafile fileserver', ''),
# use existing
('choose a way to initialize seafile databases', '2'),
('host of mysql server', ''),
('port of mysql server', ''),
('Which mysql user', 'seafile'),
('password for mysql user', 'seafile'),
('ccnet database', 'ccnet-existing'),
('seafile database', 'seafile-existing'),
('seahub database', 'seahub-existing'),
('ENTER', ''),
]
_answer_questions(abspath(setup_script), answers)
开发者ID:EagleSmith,项目名称:seafile,代码行数:28,代码来源:autosetup.py
示例18: checkout
def checkout(self, runLogDir):
utils.info(
'Attempting to checkout Lucene/Solr revision: %s into directory: %s' % (
self.revision, self.checkoutDir))
if not os.path.exists(self.checkoutDir):
os.makedirs(self.checkoutDir)
f = os.listdir(self.checkoutDir)
x = os.getcwd()
try:
os.chdir(self.checkoutDir)
if len(f) == 0:
# clone
if self.revision == 'LATEST':
utils.runCommand(
'%s clone --progress http://git-wip-us.apache.org/repos/asf/lucene-solr.git . > %s/checkout.log.txt 2>&1' % (
constants.GIT_EXE, runLogDir))
else:
utils.runCommand(
'%s clone --progress http://git-wip-us.apache.org/repos/asf/lucene-solr.git . > %s/checkout.log.txt 2>&1' % (
constants.GIT_EXE, runLogDir))
self.updateToRevision(runLogDir)
utils.runCommand('%s ivy-bootstrap' % constants.ANT_EXE)
else:
self.updateToRevision(runLogDir)
finally:
os.chdir(x)
开发者ID:anshumg,项目名称:solr-perf-tools,代码行数:26,代码来源:bench.py
示例19: override_profile_config
def override_profile_config(config):
# local import may be needed to avoid circular import issues
from utils import info
override = {k.replace(DSL_PREFIX, ''): v for k, v in os.environ.items() if k.startswith(DSL_PREFIX)}
for k, v in override.items():
dest = None
split_keys = k.split('.')
try:
for subkey in split_keys[:-1]:
dest = dest or config
if isinstance(dest, dict):
dest = dest[subkey]
elif isinstance(dest, list):
for dictitem in dest:
if dictitem['name'] == subkey:
dest = dictitem
break
else:
raise KeyError(subkey)
if dest and isinstance(dest, dict):
dest[split_keys[-1]] = v
else:
# means that the split resulted in a single element
# thus we can just use the original key
config[k] = v
info('Overriding {0}{1} build config var to: {2}'.format(DSL_PREFIX, k, v))
except KeyError as e:
# this key does not exist in the build config
# moving on post logging this
info('{0}{1} is not a proper build config key! KeyError for {2}'.format(DSL_PREFIX, k, e))
return config
开发者ID:DeepikaDhiman,项目名称:freenas-build,代码行数:31,代码来源:dsl.py
示例20: make_build_env
def make_build_env():
env = dict(os.environ)
libsearpc_dir = abspath(join(TOPDIR, 'libsearpc'))
ccnet_dir = abspath(join(TOPDIR, 'ccnet'))
def _env_add(*a, **kw):
kw['env'] = env
return prepend_env_value(*a, **kw)
_env_add('CPPFLAGS', '-I%s' % join(PREFIX, 'include'), seperator=' ')
_env_add('LDFLAGS', '-L%s' % os.path.join(PREFIX, 'lib'), seperator=' ')
_env_add('LDFLAGS', '-L%s' % os.path.join(PREFIX, 'lib64'), seperator=' ')
_env_add('PATH', os.path.join(PREFIX, 'bin'))
_env_add('PATH', THIRDPARTDIR)
_env_add('PKG_CONFIG_PATH', os.path.join(PREFIX, 'lib', 'pkgconfig'))
_env_add('PKG_CONFIG_PATH', os.path.join(PREFIX, 'lib64', 'pkgconfig'))
_env_add('PKG_CONFIG_PATH', libsearpc_dir)
_env_add('PKG_CONFIG_PATH', ccnet_dir)
for key in ('PATH', 'PKG_CONFIG_PATH', 'CPPFLAGS', 'LDFLAGS',
'PYTHONPATH'):
info('%s: %s', key, env.get(key, ''))
return env
开发者ID:EagleSmith,项目名称:seafile,代码行数:26,代码来源:run.py
注:本文中的utils.info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论