本文整理汇总了Python中utils.call函数的典型用法代码示例。如果您正苦于以下问题:Python call函数的具体用法?Python call怎么用?Python call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: event
def event(event_type, *args, **kwargs):
if event_type in girls_data.girl_events:
if girls_data.girl_events[event_type] is not None:
call(girls_data.girl_events[event_type], *args, **kwargs)
else:
raise Exception("Unknown event: %s" % event_type)
return
开发者ID:Kanasopan,项目名称:DefilerWings,代码行数:7,代码来源:girls.py
示例2: build_platform
def build_platform(rel_info):
"""Do a clean build of the platform (w/ experiment changes).
"""
args = rel_info.args
logger.info("Building platform.")
os.chdir(args.aosp_root)
utils.call('make clean', verbose=args.verbose)
utils.call('make -j %d' % (args.j), verbose=args.verbose)
开发者ID:stormspirit,项目名称:project.phonelab.platform_checker,代码行数:9,代码来源:checker.py
示例3: merge_branches
def merge_branches(rel_info):
"""Merge the experiment branch.
First figure out the exact branch name, then merge the experiment into the
test branch.
Throws:
Exception: if the experiment branch does not exist.
"""
args = rel_info.args
os.chdir(os.path.join(args.aosp_root, 'frameworks', 'base'))
logger.debug("Parsing experiment branches.")
lines = subprocess.check_output('git branch -a', shell=True)
exp_branches = []
logging_branches = []
for line in sorted(lines.split('\n')):
line = line.strip()
b = '/'.join(line.split('/')[1:])
if line.startswith('remotes/%s/%s/android-%s' %
(args.remote, LOGGING_BRANCH_PREFIX, args.aosp_base)):
logger.info("Find logging branch %s" % (b))
logging_branches.append(b)
if line.startswith('remotes/%s/%s/android-%s' %
(args.remote,
EXPERIMENT_BRANCH_PREFIX, args.aosp_base)):
if any([e in b for e in args.exp]):
logger.info("Find experiment branch %s" % (b))
exp_branches.append(b)
if len(exp_branches) == 0:
raise Exception(
"No experiment branch found for experiment %s" % (args.exp))
os.chdir(args.aosp_root)
logger.info("Merging logging branches...")
for b in logging_branches:
utils.repo_forall('git merge %s -m "merge"' % (b), verbose=args.verbose)
projs = utils.get_repo_projs(args.aosp_root)
for exp in exp_branches:
logger.info("Merging %s ..." % (exp))
for proj in projs:
os.chdir(os.path.join(args.aosp_root, proj))
try:
utils.call('git merge %s -m "test merge"' % (exp), verbose=args.verbose)
except:
logger.error("Failed to merge %s in repo %s" % (exp, proj))
raise
finally:
os.chdir(os.path.join(args.aosp_root))
开发者ID:blue-systems-group,项目名称:project.phonelab.platform_checker,代码行数:56,代码来源:checker.py
示例4: _set_volume
def _set_volume(self, volume):
# remember
old_volume = self.volume
self.volume = volume
# actually set the volume
call('/usr/bin/amixer', '-c 0 set Master %s' % self.volume_map[volume])
# sync the LEDs
self._update_leds(volume, old_volume)
开发者ID:ronaldevers,项目名称:twister,代码行数:10,代码来源:volume.py
示例5: level
def level(self, value):
value = int(value)
if value >= 0:
if value > self._lvl:
self.max = value
self._lvl = value
if game_events["mobilization_increased"] is not None:
call(game_events["mobilization_increased"])
if value < self._lvl:
self.decrease += self._lvl - value
self._lvl = value
开发者ID:Kanasopan,项目名称:DefilerWings,代码行数:11,代码来源:points.py
示例6: __init__
def __init__(self,objpath):
self.objpath=objpath
self.symbols={}
(dir,name)=os.path.split(objpath)
(rawline,err_rawline)=utils.call(dir,'objdump','--dwarf=rawline',name)
if err_rawline.strip().endswith('No such file'):
raise IOError()
self.files={}
self.collectFiles(rawline)
(info,err_info)=utils.call(dir,'objdump','--dwarf=info',name)
self.collectSymbols(info)
开发者ID:amirgeva,项目名称:coide,代码行数:11,代码来源:dwarf.py
示例7: _toggle_mute
def _toggle_mute(self):
if self.muted:
call('amixer', '-c 0 set Master unmute')
self.launchpad.note_on(self.position + MUTE_PAD, GREEN)
else:
call('amixer', '-c 0 set Master mute')
self.launchpad.note_on(self.position + MUTE_PAD, RED)
self.muted = not self.muted
# use 0 to force redrawing
self._update_leds()
开发者ID:ronaldevers,项目名称:twister,代码行数:12,代码来源:volume.py
示例8: apply_planned
def apply_planned(self):
"""
Применяем запланированные изменения в разрухе
"""
callback = False
if self._planned > 0:
callback = True
if self._value + self._planned >= 0:
self._value += self._planned
else:
self._value = 0
self._planned = 0
if callback and game_events["poverty_increased"] is not None:
call(game_events["poverty_increased"])
开发者ID:Kanasopan,项目名称:DefilerWings,代码行数:14,代码来源:points.py
示例9: submit_judgment
def submit_judgment(self, judgment_id, correct, metadata, **kwargs):
'''Submits the result of the grading task.'''
js = utils.call(action='submit_judgment', judgment_id=judgment_id, judge_id=self.judge_id, contest_id=self.contest_id, correct=correct, metadata=json.dumps(metadata, separators=(',',':')), **kwargs)
if not js['success']:
raise Exception('Judgment not successfully submitted.')
return js
开发者ID:frankchn,项目名称:contest,代码行数:7,代码来源:autojudge.py
示例10: fetch_task
def fetch_task(self):
'''Fetch a new grading task.'''
js = utils.call(action='fetch_task', judge_id=self.judge_id, contest_id=self.contest_id)
if not js['success']:
raise Exception('Task not successfully fetched.')
return js
开发者ID:frankchn,项目名称:contest,代码行数:7,代码来源:autojudge.py
示例11: surecall
def surecall(cmd):
for i in xrange(10):
ret = call(cmd)
if ret == 0:
return
time.sleep(10)
raise Exception('Error running command: %s' % cmd)
开发者ID:WeiChengLiou,项目名称:setAWS,代码行数:7,代码来源:setAWS.py
示例12: setup
def setup(self):
logger.info("News_Report: In setup")
# Start caller/messager list
r = redis.StrictRedis(host='localhost', port=6379, db=0)
r.set(self.caller_list,[])
# from now on get list as
#numbers = ast.literal_eval(r.get(self.caller_list))
#numbers.append(incoming)
#r.set(self.caller_list,numbers)
#check soundfile
import requests
response = requests.head(self.sound_url)
if response.status_code != 200:
logger.error('No sound file available at url:'.format(self.sound_url))
#allocate outgoing line
print r.llen('outgoing_unused')+" free phone lines available"
number = r.rpoplpush('outgoing_unused','outgoing_busy')
#place calls
call_result = call( to_number=self.station.cloud_number,
from_number=number,
gateway='sofia/gateway/utl/',
answered='http://127.0.0.1:5000/'+'/confer/'+episode_id+'/',
extra_dial_string="bridge_early_media=true,hangup_after_bridge=true,origination_caller_id_name=rootio,origination_caller_id_number="+number,
)
logger.info(str(call_result))
开发者ID:andaluri,项目名称:rootio_telephony,代码行数:30,代码来源:news_report.py
示例13: version
def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
version_string = call(binary, "--version").strip()
m = re.match(r"Mozilla Firefox (.*)", version_string)
if not m:
return None
return m.group(1)
开发者ID:foolip,项目名称:web-platform-tests,代码行数:7,代码来源:browser.py
示例14: updateProject
def updateProject(
name):
projectDirectory = DevEnv.projectDirectory(name)
basename = os.path.basename(projectDirectory)
assert os.path.exists(projectDirectory), projectDirectory
assert os.path.isdir(projectDirectory), projectDirectory
# Update project.
os.chdir(projectDirectory)
if os.path.exists(".svn"):
result = utils.call("svn update")
elif os.path.exists(".git"):
result = utils.call("git pull")
return result
开发者ID:gaoshuai,项目名称:pcraster,代码行数:16,代码来源:codeutils.py
示例15: version
def version(self, binary=None, webdriver_binary=None):
command = "(Get-AppxPackage Microsoft.MicrosoftEdge).Version"
try:
return call("powershell.exe", command).strip()
except (subprocess.CalledProcessError, OSError):
self.logger.warning("Failed to call %s in PowerShell" % command)
return None
开发者ID:simartin,项目名称:servo,代码行数:7,代码来源:browser.py
示例16: _command_jenkinsrun
def _command_jenkinsrun(args):
'''Run task as part of a jenkins job.'''
p = _make_task_argparser('jenkinsrun')
p.add_argument('-s', '--submit', action='store_true', default=False,
help='Submit results to artifact storage at end of task')
argconfig = p.parse_args(args)
argconfig.existing = True
buildconfig = _make_buildconfig(argconfig)
build, buildname = _make_buildscript('./mk-jenkinsrun-build', buildconfig,
keep_buildconfig=True)
if argconfig.submit:
build += _mk_submit_results(buildname)
with open("run.sh", "w") as runfile:
runfile.write(build)
retcode = utils.call(['/bin/sh', 'run.sh'])
if retcode != 0:
sys.stdout.write("*Build failed!* (return code %s)\n" % retcode)
sys.stdout.flush()
taskdir = os.path.dirname(buildconfig.taskfilename)
repro_script = os.path.join(taskdir, 'repro_message.sh')
if os.access(repro_script, os.X_OK):
utils.check_call([repro_script, _userdir,
buildconfig.taskfilename])
sys.exit(retcode)
开发者ID:efcs,项目名称:zorg,代码行数:27,代码来源:task.py
示例17: get_version_and_channel
def get_version_and_channel(self, binary):
version_string = call(binary, "--version").strip()
m = re.match(r"Mozilla Firefox (\d+\.\d+(?:\.\d+)?)(a|b)?", version_string)
if not m:
return None, "nightly"
version, status = m.groups()
channel = {"a": "nightly", "b": "beta"}
return version, channel.get(status, "stable")
开发者ID:dfahlander,项目名称:web-platform-tests,代码行数:8,代码来源:browser.py
示例18: version
def version(self, binary=None, channel=None):
"""Retrieve the release version of the installed browser."""
binary = binary or self.find_binary(channel)
version_string = call(binary, "--version").strip()
m = re.match(r"Mozilla Firefox (.*)", version_string)
if not m:
return None
return m.group(1)
开发者ID:frivoal,项目名称:web-platform-tests,代码行数:8,代码来源:browser.py
示例19: statusOfProject
def statusOfProject(
name):
projectDirectory = DevEnv.projectDirectory(name)
assert os.path.exists(projectDirectory), projectDirectory
assert os.path.isdir(projectDirectory), projectDirectory
# Update project.
os.chdir(projectDirectory)
sys.stdout.write("$%s\n" % (name.upper()))
sys.stdout.flush()
if os.path.exists(".svn"):
result = utils.call("svn status")
elif os.path.exists(".git"):
result = utils.call("git status")
return result
开发者ID:gaoshuai,项目名称:pcraster,代码行数:17,代码来源:codeutils.py
示例20: main
def main(argv=None):
args = docopt(__doc__, argv=argv)
rules = yaml.load(open(args['--config']).read())
existing_rules = get_existing_rules()
for rule in rules:
if rule in existing_rules:
print('skipping rule', format(rule))
continue
print('enforcing rule', format(rule))
command = ['upnpc', '-r', str(rule['port'])]
if 'external_port' in rule:
command += [str(rule['external_port'])]
command += [rule['protocol']]
utils.call(*command)
开发者ID:ibizaman,项目名称:mFPN-organizer,代码行数:17,代码来源:ports.py
注:本文中的utils.call函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论