本文整理汇总了Python中utils.show函数的典型用法代码示例。如果您正苦于以下问题:Python show函数的具体用法?Python show怎么用?Python show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: start_supervisor
def start_supervisor():
"""Start supervisor process."""
conf = pjoin(cget('service_dir'), 'supervisor', 'config',
'supervisord.conf')
pname = cget('supervisor_process_id')
show(yellow("Starting supervisor with id: %s." % pname))
return sudo('supervisord --configuration="%s"' % conf)
开发者ID:borysiam,项目名称:Mturk-Tracker,代码行数:7,代码来源:supervisor.py
示例2: ProcessDepFields
def ProcessDepFields(depfields,res,rtype,mode='real'):
if len(depfields.comps.__dict__) == 0:
return res
else:
oldlength = len(depfields.comps.__dict__)
todelete = []
for l in depfields.comps.__dict__:
Resolved = ComputeDepType(res,depfields.comps.__getattribute__(l),rtype.poss)
#print(show(Resolved))
if 'not a label' in show(Resolved): #Is this condition still used?
pass
elif Resolved == None:
pass
else:
if mode=='real':
res.addfield(l,Resolved.in_poss(rtype.poss).create())
todelete.append(l)
elif mode=='hyp':
res.addfield(l,Resolved.create_hypobj())
todelete.append(l)
else:
print(mode+' not recognized as option for ProcessDepFields')
for l in todelete:
del depfields.comps.__dict__[l]
if len(depfields.comps.__dict__) < oldlength:
return ProcessDepFields(depfields,res,rtype,mode)
else:
if ttracing('create') or ttracing('create_hypobj'):
print('Unresolved dependency in '+show(rtype))
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:30,代码来源:ttrtypes.py
示例3: ensure_language
def ensure_language(dbname, lang):
"""Ensures language exists."""
sql_command = """
CREATE OR REPLACE FUNCTION create_language_{0}() RETURNS BOOLEAN AS \$\$
CREATE LANGUAGE {0};
SELECT TRUE;
\$\$ LANGUAGE SQL;
SELECT CASE WHEN NOT
(
SELECT TRUE AS exists
FROM pg_language
WHERE lanname = '{0}'
UNION
SELECT FALSE AS exists
ORDER BY exists DESC
LIMIT 1
)
THEN
create_language_{0}()
ELSE
FALSE
END AS {0}_created;
DROP FUNCTION create_language_{0}();
""".format(
lang
)
show(colors.yellow("Ensuring PostgreSQL language exists: %s"), lang)
call_psql(sql_command, database=dbname)
开发者ID:neilthemathguy,项目名称:Mturk-Tracker,代码行数:30,代码来源:database.py
示例4: start_supervisor
def start_supervisor(conf=None):
"""Start supervisor process."""
if not conf:
conf = pjoin(cget("service_dir"), "supervisor", "config", "supervisord.conf")
pname = cget("supervisor_process_id")
show(yellow("Starting supervisor with id: %s." % pname))
return sudo('supervisord --configuration="%s"' % conf)
开发者ID:ipeirotis,项目名称:urlannotator,代码行数:7,代码来源:supervisor.py
示例5: ti_apply
def ti_apply(Tf, Targ):
if isinstance(Tf, FunType) \
and Targ.subtype_of(Tf.comps.domain):
return Tf.comps.range
else:
if ttracing('ti_apply'):
print('Not a well-typed function application: '+ show(Tf) + show(Targ))
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:8,代码来源:ttrtypes.py
示例6: create_virtualenv
def create_virtualenv():
"""Creates the virtualenv."""
ve_dir = cget("virtualenv_dir")
bin_path = pjoin(ve_dir, "bin")
if not dir_exists(bin_path) or not exists(pjoin(bin_path, "activate")):
show(yellow("Setting up new Virtualenv in: %s"), ve_dir)
with settings(hide("stdout", "running")):
run("virtualenv --distribute %s" % ve_dir)
开发者ID:borysiam,项目名称:Mturk-Tracker,代码行数:8,代码来源:virtualenv.py
示例7: __init__
def __init__(self,T,a):
self.comps = Rec({'base_type':T, 'obj':a})
self.witness_cache = []
self.supertype_cache = []
self.witness_conditions = [lambda x: show(x) == show(a) and T.query(x),\
lambda x: isinstance(a,LazyObj)\
and show(x) == show(a.eval()) and T.in_poss(self.poss).query(x)]
self.witness_types = []
self.poss = ''
开发者ID:robincooper,项目名称:pyttr,代码行数:9,代码来源:ttrtypes.py
示例8: summary
def summary(self,*vars):
"""Display a summary of all recorded notes, checks, records."""
if vars:
print("Values Used:")
print("============")
print()
show(*vars,depth=1)
var = self.var
hd = 'Summary of'
if var is not None:
hd += ' '+var+' for '
hd += self.__class__.__name__
if self.title:
hd += ': '+str(self.title)
print()
print(hd)
print('=' * len(hd))
print()
if self._notes:
print('Notes:')
print('------')
for txt in self._notes:
print(' -',txt)
print()
if self._checks:
print('Checks:')
print('-------')
width = max([len(l) for f,l,v,d in self._checks])
for chk in self._checks:
print(self.fmt_check(chk,width=width+2))
print()
hd = 'Values'
if self.var:
hd += ' of '+self.var
hd += ':'
print(hd)
print('-'*len(hd))
width = max([len(l) for l,v,d in self._record])
govval = None
if var:
govval = self.selector([d[var] for l,v,d in self._record])
for rec in self._record:
print(self.fmt_record(rec,var=var,width=width+1,govval=govval,nsigfigs=self.nsigfigs))
if govval is not None:
print()
h = 'Governing Value:'
print(' ',h)
print(' ','-'*len(h))
print(' ','{0} = {1}'.format(var,(sfrounds(govval,self.nsigfigs) if isfloat(govval) else "{0!r}".format(govval))), self.units if self.units is not None else '')
开发者ID:nholtz,项目名称:ca-steel-design,代码行数:56,代码来源:Designer.py
示例9: merge_dep_types
def merge_dep_types(f1,f2):
if isinstance(f1,Type) and isinstance(f1,Type):
return f1.merge(f2)
elif isinstance(f1,Fun) and isinstance(f2,Fun):
var = gensym('v')
return Fun(var, f1.domain_type.merge(f2.domain_type),
merge_dep_types(f1.body.subst(f1.var,var),f2.body.subst(f2.var,var)))
else:
if ttracing('merge_dep_types'):
print(show(f1)+' and '+show(f2)+' cannot be merged.')
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:11,代码来源:ttrtypes.py
示例10: shutdown
def shutdown():
"""Requests supervisor process and all controlled services shutdown."""
ve_dir = cget("virtualenv_dir")
activate = pjoin(ve_dir, "bin", "activate")
show(yellow("Shutting supervisor down."))
with prefix("source %s" % activate):
with settings(hide("stderr", "stdout", "running"), warn_only=True):
res = run_supevisordctl("shutdown all")
if res.return_code != 2:
msg = "Could not shutdown supervisor, process does not exists."
show(yellow(msg))
开发者ID:ipeirotis,项目名称:urlannotator,代码行数:11,代码来源:supervisor.py
示例11: subtype_of_dep_types
def subtype_of_dep_types(f1,f2):
if isinstance(f1,Type) and isinstance(f2,Type):
return f1.subtype_of(f2)
elif isinstance(f1,Fun):
f1inst = f1.app(f1.domain_type.create_hypobj())
return subtype_of_dep_types(f1inst,f2)
elif isinstance(f2,Fun):
f2inst = f2.app(f2.domain_type.create_hypobj())
return subtype_of_dep_types(f1,f2inst)
else:
if ttracing('subtype_of_dep_types'):
print(show(f1)+ ' and '+show(f2)+' cannot be compared for subtyping.')
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:13,代码来源:ttrtypes.py
示例12: configure
def configure():
"""Configures the doc module.
Creates doc_dir and copies documentation sources there.
Formats and uploads scripts for building the documentation.
Finally, loads django-sphinxdoc project from a fixture.
Project fixture can be found in deployment/files/doc/fixture.json.
"""
# Add extra context variables used by sphinx-doc and apidoc
excluded = cget('autodoc_excluded_apps')
excluded = ' '.join(excluded) if excluded else ''
cset("autodoc_excluded_apps", excluded, force=True)
cset("project_display_name_slug", slugify(cget('project_display_name')))
# Asure the doc folder exists
user = cget('user')
ddir = cget('doc_dir')
source_doc_dir = pjoin(cget("project_dir"), "code", "docs")
create_target_directories([ddir], "755", user)
# Delete the content of the folder if exist
with settings(hide("running", "stdout", "stderr")):
output = sudo('ls -A {doc_dir}'.format(doc_dir=ddir))
if len(output) > 0:
sudo("rm -r {doc_dir}/*".format(doc_dir=ddir))
# Copy files to doc dir
with settings(hide("running", "stdout")):
run("cp -r {source}/* {dest}".format(source=source_doc_dir, dest=ddir))
ensure_permissions(ddir, user=user, group=user, recursive=True)
context = dict(env["ctx"])
# Upload formatted build script
scripts = ['make_apidoc.sh']
local_dir = local_files_dir("doc")
show(yellow("Uploading doc scripts: {0}.".format(' '.join(scripts))))
for script_name in scripts:
source = pjoin(local_dir, script_name)
destination = pjoin(cget("script_dir"), script_name)
upload_template_with_perms(source, destination, context, mode="755")
# Upload formatted conf.py file
show(yellow("Uploading formatted conf.py file."))
conf_file = "conf_formatted.py"
source = pjoin(cget("local_root"), "docs", 'source', conf_file)
destination = pjoin(ddir, 'source', conf_file)
upload_template_with_perms(source, destination, context, mode="755")
开发者ID:dkoleda,项目名称:urlannotator,代码行数:50,代码来源:doc.py
示例13: nu
def nu(self,assgn):
if self.fixed_nu is None:
res = PType_n(andpred,[self.comps.left,self.comps.right],assgn) # Meet types are treated neurologically as neurological PTypes not neurological Meet types
res.name = show(self)+'_n'
return res
else:
return self.fixed_nu
开发者ID:robincooper,项目名称:pyttr,代码行数:7,代码来源:nu.py
示例14: appc_m
def appc_m(self,arg,M):
if self.validate_arg_m(arg,M):
return self.app(arg)
else:
if ttracing('appc_m'):
print (self.show()+'('+show(arg)+'): badly typed function application')
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:7,代码来源:ttrtypes.py
示例15: occupancies_ref
def occupancies_ref(ks,q):
def remove(xs,x):
xs_new = xs[:]
xs_new.remove(x)
return xs_new
Z = float(sum(falling_fac(q,n)*esp(ks,n) for n in range(q+1)))
print "Z:",Z
return [(q*k*sum(show(falling_fac(q-1,n)*esp(remove(ks,k),n)) for n in range(q)))/Z for k in ks]
开发者ID:poneill,项目名称:amic,代码行数:8,代码来源:transfer_matrix_reduced.py
示例16: combine_dep_types
def combine_dep_types(f1,f2):
if isinstance(f1,Type) and isinstance(f2,Type):
return f1.merge(f2)
elif isinstance(f1,Fun) and isinstance(f2,Type):
var = gensym('v')
return Fun(var, f1.domain_type, combine_dep_types(f1.body.subst(f1.var,var),f2))
elif isinstance(f1,Type) and isinstance(f2,Fun):
var = gensym('v')
return Fun(var, f2.domain_type, combine_dep_types(f1,f2.body.subst(f2.var,var)))
elif isinstance(f1,Fun) and isinstance(f2,Fun):
var1 = gensym('v')
var2 = gensym('v')
return Fun(var1, f1.domain_type,
Fun(var2, f2.domain_type, combine_dep_types(f1.body.subst(f1.var,var1),f2.body.subst(f2.var,var2))))
else:
if ttracing('combine_dep_types'):
print(show(f1)+' and '+show(f2)+' cannot be combined.')
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:18,代码来源:ttrtypes.py
示例17: build
def build():
"""Creates the documentation files and adds them to the database.
The first step is to create automatic module documentation using apidoc.
Next the documentation is built and added to the database using
updatedoc management command from django-sphinxdoc.
See doc/readme.rst for more details.
Apidoc generating script resides in deployment/files/doc/make_apidoc.sh.
Note: This script is project-specific.
"""
show(yellow("Bulding documentation"))
apidoc_script = pjoin(cget("script_dir"), "make_apidoc.sh")
with settings(hide("running", "stdout"), warn_only=True):
run(apidoc_script)
开发者ID:dkoleda,项目名称:urlannotator,代码行数:18,代码来源:doc.py
示例18: type
def type(self):
if self.oplist[1] == '@':
if 'types' in [x for x in dir(self.oplist[0])
if x in dir(self.oplist[2])]:
return ti_apply(self.oplist[0].types[0],
self.oplist[2].types[0])
else:
pass
else:
print('Unable to compute type of ' + show(self))
return None
开发者ID:robincooper,项目名称:pyttr,代码行数:11,代码来源:ttrtypes.py
示例19: configure
def configure():
"""Upload supervisor configuration files."""
user = cget("user")
# settings directories
sdir = cset("supervisor_dir", pjoin(cget("service_dir"), "supervisor"))
slogdir = cset("supervisor_log_dir", pjoin(cget("log_dir"), "supervisor"))
cset("supervisor_process_base", cget("project_name").replace("-", "_"))
cset("supervisor_process_id", "%s%s" % (cget("supervisor_process_base"), "_supervisor"))
# create all dirs and log dirs
dirs = ["", "config", cget("project_name")]
dirs = [pjoin(sdir, l) for l in dirs]
log_dirs = ["", cget("project_name"), "child_auto", "solr"]
log_dirs = [pjoin(slogdir, l) for l in log_dirs]
create_target_directories(dirs + log_dirs, "700", user)
context = dict(env["ctx"])
local_dir = local_files_dir("supervisor")
dest_dir = pjoin(sdir, "config")
confs = cget("supervisor_files")
show(yellow("Uploading service configuration files: %s." % confs))
for name in confs:
source = pjoin(local_dir, name)
destination = pjoin(dest_dir, name)
if isdir(source):
upload_templated_folder_with_perms(source, local_dir, dest_dir, context, mode="644", directories_mode="700")
else:
upload_template_with_perms(source, destination, context, mode="644")
scripts = [
"supervisorctl.sh",
"supervisord.sh",
"rabbitmq.sh",
"celery-worker.sh",
"supervisord-services.sh",
"supervisorctl-services.sh",
]
for script_name in scripts:
source = pjoin(cget("local_root"), "deployment", "scripts", script_name)
destination = pjoin(cget("script_dir"), script_name)
upload_template_with_perms(source, destination, context, mode="755")
开发者ID:ipeirotis,项目名称:urlannotator,代码行数:41,代码来源:supervisor.py
示例20: pathvalue
def pathvalue(self, path):
splits=deque(path.split("."))
if (len(splits) == 1):
if splits[0] in dir(self):
return self.__getattribute__(splits[0])
else:
if ttracing('pathvalue'):
print(splits[0]+' not a label in '+self.show())
return None
else:
addr = splits.popleft()
if addr not in dir(self):
if ttracing('pathvalue'):
print('No attribute '+addr+' in '+show(self))
return None
elif 'pathvalue' not in dir(self.__getattribute__(addr)):
if ttracing('pathvalue'):
print('No paths into '+show(self.__getattribute__(addr)))
return None
else:
return self.__getattribute__(addr).pathvalue(".".join(splits))
开发者ID:robincooper,项目名称:pyttr,代码行数:21,代码来源:records.py
注:本文中的utils.show函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论