本文整理汇总了Python中utils.call函数的典型用法代码示例。如果您正苦于以下问题:Python call函数的具体用法?Python call怎么用?Python call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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)
示例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))
示例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)
示例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
示例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)
示例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()
示例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"])
示例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
示例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
示例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)
示例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))
示例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)
示例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
示例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